FindModel (@NotNull final Editor editor) { if (myFindNextModel == null) return null; EditorSearchSession search = EditorSearchSession.get(editor); if (search != null && !isSelectNextOccurrenceWasPerformed) { String textInField = search.getTextInField(); if (!Objects.equals(textInField, myFindInFileModel.getStringToFind()) && !textInField.isEmpty()) { FindModel patched = new FindModel(); patched.copyFrom(myFindNextModel); patched.setStringToFind(textInField); return patched; } } return myFindNextModel; }