void () { // the "reflection" of the testCaretNotificationsOfSelectionMovementsWithoutTextModificationsFromTopLeft // Bottom right final int initialCaretLine = 5; final int initialCaretColumn = LOREM_IPSUM.length(); 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(() -> rightWithSelection(), null), new CaretAction(() -> rightWithSelection(), null), // step 2 new CaretAction(() -> downWithSelection(), null), new CaretAction(() -> downWithSelection(), null), // step 3 new CaretAction(() -> rightWithSelection(), null), // step 4 new CaretAction(() -> downWithSelection(), null), // step 5 new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 1, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 2, initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 3, initialCaretOffset)), // step 6 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 7 new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 4 - 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 8 new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 4 - 3 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 9 new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 5 - 3 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 6 - 3 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> leftWithSelection(), new CaretPos(initialCaretOffset - 7 - 3 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 10 new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 7 - 4 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 7 - 5 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 11 new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 7 - 4 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 7 - 3 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 7 - 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 12 new CaretAction(() -> upWithSelection(), new CaretPos(initialCaretOffset - 7 - 3 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 13 new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 7 - 2 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset - 7 - 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 14 new CaretAction(() -> moveCaretToNextWordWithSelection(), new CaretPos(initialCaretOffset - 1 - 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), new CaretAction(() -> rightWithSelection(), new CaretPos(initialCaretOffset - 1 * (LOREM_IPSUM.length() + 1), initialCaretOffset)), // step 15 new CaretAction(() -> downWithSelection(), new CaretPos(initialCaretOffset, initialCaretOffset)) ); }