void (@NotNull CaretEvent e) { if (!myEditorWindow.getDocument().isValid()) return; // injected document can be destroyed by now Caret caret = e.getCaret(); assert caret != null; CaretEvent event = new CaretEvent(createInjectedCaret(caret), myEditorWindow.hostToInjected(e.getOldPosition()), myEditorWindow.hostToInjected(e.getNewPosition())); listener.caretPositionChanged(event); }