void () { // Similar to testCaretNotificationsDuringTyping, but for multiple carets /* * caret #1 * v * (0th) |Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * ... * caret #5 * v * (2nd) Lorem ipsum dolor sit amet, consectetur adipisci|ng elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * ... * caret #4 * (primary) * v * (4th) Lorem ipsum dolor| sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. * * caret #2 * v * (5th) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incidid|unt ut labore et dolore magna aliqua. * ... * caret #3 * v * (7th) Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.| */ final EditorImpl editor = initEditor( StringUtil.repeat(LOREM_IPSUM + '\n', 7) + LOREM_IPSUM, // caret #1 0, 0, 0 ); // caret #2 addCaret(editor, false, 5, 86, 5 * (LOREM_IPSUM.length() + 1) + 86); // caret #3 addCaret(editor, false, 7, LOREM_IPSUM.length(), 7 * (LOREM_IPSUM.length() + 1) + LOREM_IPSUM.length()); // caret #4 (primary) final int primaryCaretLine = 4; final int primaryCaretColumn = 17; final int primaryCaretInitialDot = primaryCaretLine * (LOREM_IPSUM.length() + 1) + primaryCaretColumn; addCaret(editor, true, primaryCaretLine, primaryCaretColumn, primaryCaretInitialDot); // caret #5 addCaret(editor, false, 2, 48, 2 * (LOREM_IPSUM.length() + 1) + 48); final int caretsBeforePrimaryCount = 2; // all notifications have to belong only to primary caret //noinspection PointlessArithmeticExpression doTestCaretNotifications( editor.getContentComponent(), new CaretAction(() -> type('u'), new CaretPos( 1 * caretsBeforePrimaryCount + primaryCaretInitialDot + 1, 1 * caretsBeforePrimaryCount + primaryCaretInitialDot + 1)), new CaretAction(() -> type('n'), new CaretPos( 2 * caretsBeforePrimaryCount + primaryCaretInitialDot + 2, 2 * caretsBeforePrimaryCount + primaryCaretInitialDot + 2)), new CaretAction(() -> type('u'), new CaretPos( 3 * caretsBeforePrimaryCount + primaryCaretInitialDot + 3, 3 * caretsBeforePrimaryCount + primaryCaretInitialDot + 3)), new CaretAction(() -> type('s'), new CaretPos( 4 * caretsBeforePrimaryCount + primaryCaretInitialDot + 4, 4 * caretsBeforePrimaryCount + primaryCaretInitialDot + 4)), new CaretAction(() -> type(' '), new CaretPos( 5 * caretsBeforePrimaryCount + primaryCaretInitialDot + 5, 5 * caretsBeforePrimaryCount + primaryCaretInitialDot + 5)), new CaretAction(() -> type('d'), new CaretPos( 6 * caretsBeforePrimaryCount + primaryCaretInitialDot + 6, 6 * caretsBeforePrimaryCount + primaryCaretInitialDot + 6)), new CaretAction(() -> type('u'), new CaretPos( 7 * caretsBeforePrimaryCount + primaryCaretInitialDot + 7, 7 * caretsBeforePrimaryCount + primaryCaretInitialDot + 7)), new CaretAction(() -> type('o'), new CaretPos( 8 * caretsBeforePrimaryCount + primaryCaretInitialDot + 8, 8 * caretsBeforePrimaryCount + primaryCaretInitialDot + 8)), new CaretAction(() -> type(' '), new CaretPos( 9 * caretsBeforePrimaryCount + primaryCaretInitialDot + 9, 9 * caretsBeforePrimaryCount + primaryCaretInitialDot + 9)), new CaretAction(() -> type('t'), new CaretPos(10 * caretsBeforePrimaryCount + primaryCaretInitialDot + 10, 10 * caretsBeforePrimaryCount + primaryCaretInitialDot + 10)), new CaretAction(() -> type('r'), new CaretPos(11 * caretsBeforePrimaryCount + primaryCaretInitialDot + 11, 11 * caretsBeforePrimaryCount + primaryCaretInitialDot + 11)), new CaretAction(() -> type('e'), new CaretPos(12 * caretsBeforePrimaryCount + primaryCaretInitialDot + 12, 12 * caretsBeforePrimaryCount + primaryCaretInitialDot + 12)), new CaretAction(() -> type('s'), new CaretPos(13 * caretsBeforePrimaryCount + primaryCaretInitialDot + 13, 13 * caretsBeforePrimaryCount + primaryCaretInitialDot + 13)), new CaretAction(() -> type(' '), new CaretPos(14 * caretsBeforePrimaryCount + primaryCaretInitialDot + 14, 14 * caretsBeforePrimaryCount + primaryCaretInitialDot + 14)) ); }