// Find in files.
 public ListOccurrencesInFilesBuffer(Search search) {
   super(search);
   if (search instanceof FindInFiles) {
     appendLine("Files: " + ((FindInFiles) search).getFiles());
     if (search.wholeWordsOnly())
       appendLine("Mode: " + ((FindInFiles) search).getMode().getDisplayName());
     renumber();
   }
   title = "\"" + search.getPattern() + "\"";
   setLoaded(true);
 }
예제 #2
0
 private LineSegmentList formatOutputLine(OccurrenceLine line) {
   final String text = getDetabbedText(line);
   // Include the ':' in the first segment.
   int index = text.indexOf(':') + 1;
   addSegment(text, 0, index, FORMAT_COMMENT);
   Position start = new Position(line, index);
   int startCol = index;
   while (true) {
     Position pos = search.findInLine(parentMode, start);
     if (pos == null) break;
     int matchCol = buffer.getCol(pos);
     if (matchCol != startCol) addSegment(text, startCol, matchCol, FORMAT_TEXT);
     int length;
     if (search.getMatch() != null) length = search.getMatch().group().length();
     else length = search.getPatternLength();
     startCol = buffer.getCol(pos.getLine(), pos.getOffset() + length);
     addSegment(text, matchCol, startCol, FORMAT_MATCHING_TEXT);
     start = new Position(pos.getLine(), pos.getOffset() + length);
   }
   startCol = buffer.getCol(start);
   addSegment(text, startCol, FORMAT_TEXT);
   return segmentList;
 }