changeset 41740:ee77a6dd8fb8

color: give colours to the grep.inserted and grep.deleted labels I find the "bold" makes it stand out a bit more when the green is next to the line number. Note that these labels are applied before the grep.change label, which is now disabled. To get the old colour, users can restore [color] grep.change = green dim to their hgrc.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Fri, 15 Feb 2019 15:43:22 -0500
parents 8ab42ccb68fe
children a91615b71679
files mercurial/color.py tests/test-grep.t
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/color.py	Fri Feb 15 15:24:04 2019 -0500
+++ b/mercurial/color.py	Fri Feb 15 15:43:22 2019 -0500
@@ -78,11 +78,12 @@
     'grep.match': 'red bold',
     'grep.linenumber': 'green',
     'grep.rev': 'green',
-    'grep.change': 'green',
     'grep.sep': 'cyan',
     'grep.filename': 'magenta',
     'grep.user': 'magenta',
     'grep.date': 'magenta',
+    'grep.inserted': 'green bold',
+    'grep.deleted': 'red bold',
     'bookmarks.active': 'green',
     'branches.active': 'none',
     'branches.closed': 'black bold',
--- a/tests/test-grep.t	Fri Feb 15 15:24:04 2019 -0500
+++ b/tests/test-grep.t	Fri Feb 15 15:43:22 2019 -0500
@@ -304,6 +304,11 @@
   [grep.filename|color][grep.sep|:][grep.rev|2][grep.sep|:][grep.deleted grep.change|-][grep.sep|:][grep.match|orange]
   [grep.filename|color][grep.sep|:][grep.rev|1][grep.sep|:][grep.inserted grep.change|+][grep.sep|:][grep.match|orange]
 
+  $ hg grep --diff orange --color=yes
+  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m3\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
+  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m2\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1m-\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
+  \x1b[0;35mcolor\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32;1m+\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;31;1morange\x1b[0m (esc)
+
   $ hg grep --diff orange
   color:3:+:orange
   color:2:-:orange