Commits

Takayuki KONDO committed 679d452

colorize all fields

Colors were picked in accordance to GNU grep.

  • Participants
  • Parent commits 0ecb860

Comments (0)

Files changed (1)

         before = line[:cstart]
         match = line[cstart:cend]
         after = line[cend:]
-        cols = [fn]
+        cols = [(fn, 'grep.filename')]
         if opts.get('line_number'):
-            cols.append(str(lnum))
-        ui.write(sep.join(cols))
+            cols.append((str(lnum), 'grep.linenumber'))
+        for col, label in cols[:-1]:
+            ui.write(col, label=label)
+            ui.write(sep, label='grep.sep')
+        ui.write(cols[-1][0], label=cols[-1][1])
+
         if not opts.get('text') and binary():
             ui.write(sep + " Binary file matches")
         else:
-            ui.write(sep + before)
+            ui.write(sep, label='grep.sep')
+            ui.write(before)
             ui.write(match, label='grep.match')
             ui.write(after)
         ui.write(eol)