Patchwork [2,of,2] color: enable default color for tabs (BC)

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Aug. 20, 2014, 7:24 p.m.
Message ID <9d34433f73b54557667d.1408562669@Iris>
Download mbox | patch
Permalink /patch/5534/
State Changes Requested
Headers show

Comments

Jordi Gutiérrez Hermoso - Aug. 20, 2014, 7:24 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1408562377 14400
#      Wed Aug 20 15:19:37 2014 -0400
# Node ID 9d34433f73b54557667de9a8da77c7dde9e7c33c
# Parent  b58e6a9a966a2ae349db1af92943d2bc8898aa06
color: enable default color for tabs (BC)

This makes the color extension by default highlight tabs in changed
lines of a diff. I picked magenta as the color of a tab.
Sean Farley - Aug. 20, 2014, 11:48 p.m.
Jordi Gutiérrez Hermoso writes:

> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1408562377 14400
> #      Wed Aug 20 15:19:37 2014 -0400
> # Node ID 9d34433f73b54557667de9a8da77c7dde9e7c33c
> # Parent  b58e6a9a966a2ae349db1af92943d2bc8898aa06
> color: enable default color for tabs (BC)
>
> This makes the color extension by default highlight tabs in changed
> lines of a diff. I picked magenta as the color of a tab.

A big +1 on this.
Pierre-Yves David - Aug. 21, 2014, 7:40 a.m.
On 08/20/2014 12:24 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1408562377 14400
> #      Wed Aug 20 15:19:37 2014 -0400
> # Node ID 9d34433f73b54557667de9a8da77c7dde9e7c33c
> # Parent  b58e6a9a966a2ae349db1af92943d2bc8898aa06
> color: enable default color for tabs (BC)
>
> This makes the color extension by default highlight tabs in changed
> lines of a diff. I picked magenta as the color of a tab.

while I love the idea of having the option to colorize tab, I do not 
believe we can do it by default. There is real people out there that use 
tab for indentation. I do not hink they will be happy to have their diff 
turning pink all around the place.

We can either try to target mixed tab and space. Or just leave the 
default to "not colorise" and suggest this in the example config.


>
> diff --git a/hgext/color.py b/hgext/color.py
> --- a/hgext/color.py
> +++ b/hgext/color.py
> @@ -11,7 +11,7 @@ This extension modifies the status and r
>   to their output to reflect file status, the qseries command to add
>   color to reflect patch status (applied, unapplied, missing), and to
>   diff-related commands to highlight additions, removals, diff headers,
> -and trailing whitespace.
> +tabs, and trailing whitespace.
>
>   Other effects in addition to color, like bold and underlined text, are
>   also available. By default, the terminfo database is used to find the
> @@ -45,6 +45,7 @@ Default effects may be overridden from y
>     diff.deleted = red
>     diff.inserted = green
>     diff.changed = white
> +  diff.tab = bold magenta_background
>     diff.trailingwhitespace = bold red_background
>
>     resolve.unresolved = red bold
> @@ -255,6 +256,7 @@ except ImportError:
>              'diff.file_b': 'green bold',
>              'diff.hunk': 'magenta',
>              'diff.inserted': 'green',
> +           'diff.tab': 'bold magenta_background',
>              'diff.trailingwhitespace': 'bold red_background',
>              'diffstat.deleted': 'red',
>              'diffstat.inserted': 'green',
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -11,7 +11,7 @@  This extension modifies the status and r
 to their output to reflect file status, the qseries command to add
 color to reflect patch status (applied, unapplied, missing), and to
 diff-related commands to highlight additions, removals, diff headers,
-and trailing whitespace.
+tabs, and trailing whitespace.
 
 Other effects in addition to color, like bold and underlined text, are
 also available. By default, the terminfo database is used to find the
@@ -45,6 +45,7 @@  Default effects may be overridden from y
   diff.deleted = red
   diff.inserted = green
   diff.changed = white
+  diff.tab = bold magenta_background
   diff.trailingwhitespace = bold red_background
 
   resolve.unresolved = red bold
@@ -255,6 +256,7 @@  except ImportError:
            'diff.file_b': 'green bold',
            'diff.hunk': 'magenta',
            'diff.inserted': 'green',
+           'diff.tab': 'bold magenta_background',
            'diff.trailingwhitespace': 'bold red_background',
            'diffstat.deleted': 'red',
            'diffstat.inserted': 'green',