# [PATCH] git-gui: support for underline styles

5 messages from 2010-11-15 to 2011-03-30. Participants: Bert Wesarg, Pat Thoyts.
Thread: https://gitlist.dev/t/25750

## Bert Wesarg, 2010-11-15 10:04

Subject: [PATCH] git-gui: support for underline styles
Message-ID: <1289815498-12287-1-git-send-email-bert.wesarg@googlemail.com>
URL: https://gitlist.dev/e/1289815498-12287-1-git-send-email-bert.wesarg%40googlemail.com

```
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 git-gui/git-gui.sh   |    4 ++++
 git-gui/lib/diff.tcl |    3 ++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index d3acf0d..70c0483 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -3328,6 +3328,10 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
 	$ui_diff tag configure clri4$n -foreground $c
 	$ui_diff tag configure clr3$n -foreground $c
 	$ui_diff tag configure clri3$n -background $c
+	$ui_diff tag configure clru4$n -underline 1 -background $c
+	$ui_diff tag configure clrui4$n -underline 1 -foreground $c
+	$ui_diff tag configure clru3$n -underline 1 -foreground $c
+	$ui_diff tag configure clrui3$n -underline 1 -background $c
 }
 $ui_diff tag configure clr1 -font font_diffbold
 
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index dcf0711..f59477f 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -463,7 +463,8 @@ proc read_diff {fd cont_info} {
 
 		foreach {posbegin colbegin posend colend} $markup {
 			set prefix clr
-			foreach style [split $colbegin ";"] {
+			foreach style [lsort -integer [split $colbegin ";"]] {
+				if {$style eq "4"} {append prefix u; continue}
 				if {$style eq "7"} {append prefix i; continue}
 				if {$style < 30 || $style > 47} {continue}
 				set a "$mark linestart + $posbegin chars"
-- 
tg: (6f10c41..) bw/git-gui/support-underline-ansi-styles (depends on: master)

```

## Pat Thoyts, 2010-11-19 10:00

Subject: Re: [PATCH] git-gui: support for underline styles
Message-ID: <87oc9lhbjx.fsf@fox.patthoyts.tk>
URL: https://gitlist.dev/e/87oc9lhbjx.fsf%40fox.patthoyts.tk
In-Reply-To: <1289815498-12287-1-git-send-email-bert.wesarg@googlemail.com>

```

Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---

I left underline out because I reckon it would just make text harder to
read on a gui display. It seems like the option would only be useful on
monochrome terminals.

If we do want to support underlines in the diff view window then we can
have a different tag rather than replicating each color to get a
underlined version of the same color.
Something like the following should do it:


 git-gui.sh   |    1 +
 lib/diff.tcl |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index d3acf0d..137cd72 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3330,6 +3330,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
 	$ui_diff tag configure clri3$n -background $c
 }
 $ui_diff tag configure clr1 -font font_diffbold
+$ui_diff tag configure clr4 -underline 1
 
 $ui_diff tag conf d_cr -elide true
 $ui_diff tag conf d_@ -font font_diffbold
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 0579fa6..203ab07 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -473,7 +473,7 @@ proc read_diff {fd cont_info} {
 			set prefix clr
 			foreach style [split $colbegin ";"] {
 				if {$style eq "7"} {append prefix i; continue}
-				if {$style < 30 || $style > 47} {continue}
+				if {$style != 4 && ($style < 30 || $style > 47)} {continue}
 				set a "$mark linestart + $posbegin chars"
 				set b "$mark linestart + $posend chars"
 				catch {$ui_diff tag add $prefix$style $a $b}
-- 
1.7.3.1.msysgit.0

```

## Bert Wesarg, 2010-11-19 10:55

Subject: Re: [PATCH] git-gui: support for underline styles
Message-ID: <AANLkTikmFOQfv6y50JHiWef-BPyOBxUNrOohrxmoThOe@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikmFOQfv6y50JHiWef-BPyOBxUNrOohrxmoThOe%40mail.gmail.com
In-Reply-To: <87oc9lhbjx.fsf@fox.patthoyts.tk>

```
On Fri, Nov 19, 2010 at 11:00, Pat Thoyts
<patthoyts@users.sourceforge.net> wrote:
>
> Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> ---
>
> I left underline out because I reckon it would just make text harder to
> read on a gui display. It seems like the option would only be useful on
> monochrome terminals.
>
> If we do want to support underlines in the diff view window then we can
> have a different tag rather than replicating each color to get a
> underlined version of the same color.
> Something like the following should do it:

Thanks for this simple implementation. My only concern left is the
ordering. If we have '\033[7;4;30m' than we end up using 'clri4' as
tag, which does not exists. I suspect that git does not produce such
unordered attributes. But for clarity I would suggest to keep my lsort
around the split command.

Bert

>
>
>  git-gui.sh   |    1 +
>  lib/diff.tcl |    2 +-
>  2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index d3acf0d..137cd72 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -3330,6 +3330,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
>        $ui_diff tag configure clri3$n -background $c
>  }
>  $ui_diff tag configure clr1 -font font_diffbold
> +$ui_diff tag configure clr4 -underline 1
>
>  $ui_diff tag conf d_cr -elide true
>  $ui_diff tag conf d_@ -font font_diffbold
> diff --git a/lib/diff.tcl b/lib/diff.tcl
> index 0579fa6..203ab07 100644
> --- a/lib/diff.tcl
> +++ b/lib/diff.tcl
> @@ -473,7 +473,7 @@ proc read_diff {fd cont_info} {
>                        set prefix clr
>                        foreach style [split $colbegin ";"] {
>                                if {$style eq "7"} {append prefix i; continue}
> -                               if {$style < 30 || $style > 47} {continue}
> +                               if {$style != 4 && ($style < 30 || $style > 47)} {continue}
>                                set a "$mark linestart + $posbegin chars"
>                                set b "$mark linestart + $posend chars"
>                                catch {$ui_diff tag add $prefix$style $a $b}
> --
> 1.7.3.1.msysgit.0
>
>

```

## Bert Wesarg, 2011-02-27 20:04

Subject: Re: [PATCH] git-gui: support for underline styles
Message-ID: <AANLkTimnX-OJYzSvot-yUMGKXmqJw9deTGS-6mzywoEe@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTimnX-OJYzSvot-yUMGKXmqJw9deTGS-6mzywoEe%40mail.gmail.com
In-Reply-To: <87oc9lhbjx.fsf@fox.patthoyts.tk>

```
On Fri, Nov 19, 2010 at 11:00, Pat Thoyts
<patthoyts@users.sourceforge.net> wrote:
>
> Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> ---
>
> I left underline out because I reckon it would just make text harder to
> read on a gui display. It seems like the option would only be useful on
> monochrome terminals.
>
> If we do want to support underlines in the diff view window then we can
> have a different tag rather than replicating each color to get a
> underlined version of the same color.
> Something like the following should do it:

I miss this in git-gui.git.

Thanks,
Bert

>
>
>  git-gui.sh   |    1 +
>  lib/diff.tcl |    2 +-
>  2 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/git-gui.sh b/git-gui.sh
> index d3acf0d..137cd72 100755
> --- a/git-gui.sh
> +++ b/git-gui.sh
> @@ -3330,6 +3330,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
>        $ui_diff tag configure clri3$n -background $c
>  }
>  $ui_diff tag configure clr1 -font font_diffbold
> +$ui_diff tag configure clr4 -underline 1
>
>  $ui_diff tag conf d_cr -elide true
>  $ui_diff tag conf d_@ -font font_diffbold
> diff --git a/lib/diff.tcl b/lib/diff.tcl
> index 0579fa6..203ab07 100644
> --- a/lib/diff.tcl
> +++ b/lib/diff.tcl
> @@ -473,7 +473,7 @@ proc read_diff {fd cont_info} {
>                        set prefix clr
>                        foreach style [split $colbegin ";"] {
>                                if {$style eq "7"} {append prefix i; continue}
> -                               if {$style < 30 || $style > 47} {continue}
> +                               if {$style != 4 && ($style < 30 || $style > 47)} {continue}
>                                set a "$mark linestart + $posbegin chars"
>                                set b "$mark linestart + $posend chars"
>                                catch {$ui_diff tag add $prefix$style $a $b}
> --
> 1.7.3.1.msysgit.0
>
>

```

## Bert Wesarg, 2011-03-30 06:44

Subject: [PATCH 1/2] git-gui: support for underline styles
Message-ID: <2cd6fc8a8da65dc6c2e420d150429b59fdbb3386.1301467146.git.bert.wesarg@googlemail.com>
URL: https://gitlist.dev/e/2cd6fc8a8da65dc6c2e420d150429b59fdbb3386.1301467146.git.bert.wesarg%40googlemail.com
In-Reply-To: <AANLkTimnX-OJYzSvot-yUMGKXmqJw9deTGS-6mzywoEe@mail.gmail.com>

```
From: Pat Thoyts <patthoyts@users.sourceforge.net>

From: Pat Thoyts <patthoyts@users.sourceforge.net>

Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---

I left underline out because I reckon it would just make text harder to
read on a gui display. It seems like the option would only be useful on
monochrome terminals.

If we do want to support underlines in the diff view window then we can
have a different tag rather than replicating each color to get a
underlined version of the same color.
Something like the following should do it:
---
 git-gui.sh   |    1 +
 lib/diff.tcl |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/git-gui.sh b/git-gui.sh
index fd6a43d..d5c1535 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -3361,6 +3361,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr
 	$ui_diff tag configure clri3$n -background $c
 }
 $ui_diff tag configure clr1 -font font_diffbold
+$ui_diff tag configure clr4 -underline 1
 
 $ui_diff tag conf d_info -foreground blue -font font_diffbold
 
diff --git a/lib/diff.tcl b/lib/diff.tcl
index cf8a95e..39e4d90 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -504,7 +504,7 @@ proc read_diff {fd conflict_size cont_info} {
 			set prefix clr
 			foreach style [split $colbegin ";"] {
 				if {$style eq "7"} {append prefix i; continue}
-				if {$style < 30 || $style > 47} {continue}
+				if {$style != 4 && ($style < 30 || $style > 47)} {continue}
 				set a "$mark linestart + $posbegin chars"
 				set b "$mark linestart + $posend chars"
 				catch {$ui_diff tag add $prefix$style $a $b}
-- 
1.7.4.1.1319.ga04f7.dirty

```
