void () { /* * (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. * * caret #1 * v * (2nd) Lorem ipsum dolor sit amet, conse|ctetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * * caret #2 * (primary) * v * (3rd) Lorem ipsum dolor sit amet, consec|tetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * * caret #3 * v * (4th) Lorem ipsum dolor sit amet, consect|etur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * (5th) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * (6th) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. */ final int primaryCaretLine = 3; final int primaryCaretColumn = 34; final int primaryCaretInitialDot = primaryCaretLine * (LOREM_IPSUM.length() + 1) + primaryCaretColumn; final EditorImpl editor = initEditor( StringUtil.repeat(LOREM_IPSUM + '\n', 6) + LOREM_IPSUM, // caret #1 primaryCaretLine - 1, primaryCaretColumn - 1, primaryCaretInitialDot - 1 - (LOREM_IPSUM.length() + 1) ); // caret #2 (primary) addCaret(editor, true, primaryCaretLine, primaryCaretColumn, primaryCaretInitialDot); // caret #3 addCaret(editor, false, primaryCaretLine + 1, primaryCaretColumn + 1, primaryCaretInitialDot + 1 + (LOREM_IPSUM.length() + 1)); //noinspection DuplicateExpressions doTestCaretNotifications( editor.getContentComponent(), new CaretAction(() -> leftWithSelection(), new CaretPos(primaryCaretInitialDot - 1, primaryCaretInitialDot)), new CaretAction(() -> rightWithSelection(), new CaretPos(primaryCaretInitialDot, primaryCaretInitialDot)), new CaretAction(() -> leftWithSelection(), new CaretPos(primaryCaretInitialDot - 1, primaryCaretInitialDot)), new CaretAction(() -> leftWithSelection(), new CaretPos(primaryCaretInitialDot - 2, primaryCaretInitialDot)), new CaretAction(() -> rightWithSelection(), new CaretPos(primaryCaretInitialDot - 1, primaryCaretInitialDot)), new CaretAction(() -> rightWithSelection(), new CaretPos(primaryCaretInitialDot, primaryCaretInitialDot)), new CaretAction(() -> rightWithSelection(), new CaretPos(primaryCaretInitialDot + 1, primaryCaretInitialDot)), new CaretAction(() -> rightWithSelection(), new CaretPos(primaryCaretInitialDot + 2, primaryCaretInitialDot)), new CaretAction(() -> leftWithSelection(), new CaretPos(primaryCaretInitialDot + 1, primaryCaretInitialDot)), new CaretAction(() -> leftWithSelection(), new CaretPos(primaryCaretInitialDot, primaryCaretInitialDot)) // Attempts to move the carets up or down cause carets hardly predictable merging, so let's skip them ); }