SearchTaskOptions (boolean directionForward) { SearchTaskOptions options = new SearchTaskOptions() .setSearchDirectionForward(directionForward) .setStringToFind(mySearchReplaceComponent.getSearchTextComponent().getText()) .setCaseSensitive(myToggleCaseSensitiveAction.isSelected()) .setWholeWords(myToggleWholeWordsAction.isSelected()) .setRegularExpression(myToggleRegularExpression.isSelected()) .setContextOneSideLength(CONTEXT_ONE_SIDE_LENGTH); if (!myCloseSearchResultsList.isEmpty() && myCloseSearchResultsList.getSelectedIndex() != -1) { Position position = myCloseSearchResultsList.getSelectedValue().startPosition; if (directionForward) { options.setSearchBounds( //position.pageNumber, position.symbolOffsetInPage + 1, position.pageNumber + 1, 0, SearchTaskOptions.NO_LIMIT, SearchTaskOptions.NO_LIMIT); } else { options.setSearchBounds(SearchTaskOptions.NO_LIMIT, SearchTaskOptions.NO_LIMIT, position.pageNumber, position.symbolOffsetInPage); } } else { long caretPageNumber = largeFileEditor.getCaretPageNumber(); int caretPageOffset = largeFileEditor.getCaretPageOffset(); if (directionForward) { options.setSearchBounds(caretPageNumber, caretPageOffset, SearchTaskOptions.NO_LIMIT, SearchTaskOptions.NO_LIMIT); } else { options.setSearchBounds(SearchTaskOptions.NO_LIMIT, SearchTaskOptions.NO_LIMIT, caretPageNumber, caretPageOffset); } } return options; }