void () { // Undoing a modifying operation near the caret has to cause a caret update notification // The initial configuration is the same as the testCaretNotificationsDuringTyping's one final int caretInitialLineIndex = 10; final int caretInitialColumnIndex = 28; final int caretInitialDot = caretInitialLineIndex * (LOREM_IPSUM.length() + 1) + caretInitialColumnIndex; final EditorImpl editor = initEditor( StringUtil.repeat(LOREM_IPSUM + '\n', 30), caretInitialLineIndex, caretInitialColumnIndex, caretInitialDot ); // copy "unus duo tres " to the clipboard CopyPasteManager.getInstance().setContents(new StringSelection("unus duo tres ")); EditorTestUtil.testUndoInEditor(editor, () -> { doTestCaretNotifications( editor.getContentComponent(), new CaretAction(() -> paste(), new CaretPos(caretInitialDot + 14, caretInitialDot + 14)), new CaretAction(() -> undo(), new CaretPos(caretInitialDot, caretInitialDot)) ); }); }