boolean (HighlightInfo oldInfo, int caretOffset, int newOffset) { if (oldInfo == null) return true; int oldOffset = getNavigationPositionFor(oldInfo, oldInfo.getHighlighter().getDocument()); if (myGoForward) { return caretOffset < oldOffset != caretOffset < newOffset ? caretOffset < newOffset : newOffset < oldOffset; } else { return caretOffset <= oldOffset != caretOffset <= newOffset ? caretOffset > newOffset : newOffset > oldOffset; } }