void (@Nullable TextRange oldCursorRange, @Nullable TextRange next) { boolean justReplaced = next != null; boolean toPush = true; if (justReplaced || (toPush = !repairCursorFromStack())) { if (justReplaced || !tryToRepairOldCursor(oldCursorRange)) { if (myFindModel != null) { if (justReplaced) { nextOccurrence(false, next, false, true, false); } else { myCursor = oldCursorRange == null ? firstOccurrenceAtOrAfterCaret() : firstOccurrenceAfterCaret(); } } else { myCursor = null; } } } if (!justReplaced && myCursor == null && hasMatches()) { nextOccurrence(true, oldCursorRange, false, false, false); } if (toPush && myCursor != null){ push(); } }