@Override
    public void caretPositionChanged(@NotNull CaretEvent e) {
      Caret caret = e.getCaret();
      if (caret != editor.getCaretModel().getPrimaryCaret()) {
        return;
      }
      int dot = caret.getOffset();
      int mark = caret.getLeadSelectionOffset();
      if (myCaretPos != dot) {
        ThreadingAssertions.assertEventDispatchThread();
        firePropertyChange(ACCESSIBLE_CARET_PROPERTY,
                           Integer.valueOf(myCaretPos), Integer.valueOf(dot));
        myPreviousCaretPos = myCaretPos;
        myCaretPos = dot;
      }

      if (mark != dot) {
        ThreadingAssertions.assertEventDispatchThread();
        firePropertyChange(ACCESSIBLE_SELECTION_PROPERTY, null,
                           getSelectedText());
      }
    }
@Override
    public void caretPositionChanged(@NotNull CaretEvent e)