void (VirtualFile file, FindModel model, CharSequence text, Map<Integer, Integer> result, FindModel.SearchContext searchContext, FindManagerImpl manager) { FindModel clonedModel = model.clone(); clonedModel.setSearchContext(searchContext); clonedModel.setForward(true); int offset = 0; while(true) { FindResult customResult = manager.findStringLoop(text, offset, clonedModel, file, null); if (!customResult.isStringFound()) break; result.put(customResult.getStartOffset(), customResult.getEndOffset()); offset = Math.max(customResult.getEndOffset(), offset + 1); // avoid loop for zero size reg exps matches if (offset >= text.length()) break; } }