void () { @SuppressWarnings("SpellCheckingInspection") /* * (0th) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * (1st) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * (2nd) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * * dot and mark * (initial pos and after step 10) * v * (3rd) Lorem ipsum dolor sit amet, |$consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * ^ * Actions from here: * 1. Left with selection x 6 * 2. Right with selection x 3 * 3. Up with selection * 4. Down with selection * 5. Up with selection x 2 * 6. Down with selection x 4 * * (4th) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * * dot * (after step 6) * v * (5th) Lorem ipsum dolor sit ame$t, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * ^ * Actions from here: * 7. Right with selection x 3 * 8. Right by word with selection * 9. Left by word with selection * 10. Up with selection x 2 */ final int initialCaretLine = 3; final int initialCaretColumn = 28; final int initialCaretOffset = initialCaretLine * (LOREM_IPSUM.length() + 1) + initialCaretColumn; final var editor = initEditor(StringUtil.repeat(LOREM_IPSUM + '\n', 5) + LOREM_IPSUM, initialCaretLine, initialCaretColumn, initialCaretOffset); //noinspection DuplicateExpressions,PointlessArithmeticExpression doTestCaretNotifications( editor.getContentComponent(), // step 1 new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 1, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 2, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 3, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 4, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 5, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 6, initialCaretOffset)), // step 2 new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset - 5, initialCaretOffset)), new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset - 4, initialCaretOffset)), new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset - 3, initialCaretOffset)), // step 3 new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 3 - 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 4 new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 3, initialCaretOffset)), // step 5 new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 3 - 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 3 - 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 6 new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 3 - 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 3, initialCaretOffset)), new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 3 + 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 3 + 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 7 new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset - 2 + 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset - 1 + 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset + 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 8 new CaretAction(() -> moveCaretToNextWordWithSelection(), new CaretPos(initialCaretOffset + 11 + 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 9 new CaretAction(() -> moveCaretToPreviousWordWithSelection(), new CaretPos(initialCaretOffset + 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 10 new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset + 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset, initialCaretOffset)) ); }