{"thread":{"id":"25750","subject":"[PATCH] git-gui: support for underline styles","startedAt":"2010-11-15T10:04:58Z","lastAt":"2011-03-30T06:44:09Z","messageCount":5,"participants":["Bert Wesarg","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"155909","messageId":"1289815498-12287-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25750","inReplyTo":null,"subject":"[PATCH] git-gui: support for underline styles","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-15T10:04:58Z","receivedAt":"2010-11-15T10:04:58Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n git-gui/git-gui.sh   |    4 ++++\n git-gui/lib/diff.tcl |    3 ++-\n 2 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex d3acf0d..70c0483 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -3328,6 +3328,10 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr\n \t$ui_diff tag configure clri4$n -foreground $c\n \t$ui_diff tag configure clr3$n -foreground $c\n \t$ui_diff tag configure clri3$n -background $c\n+\t$ui_diff tag configure clru4$n -underline 1 -background $c\n+\t$ui_diff tag configure clrui4$n -underline 1 -foreground $c\n+\t$ui_diff tag configure clru3$n -underline 1 -foreground $c\n+\t$ui_diff tag configure clrui3$n -underline 1 -background $c\n }\n $ui_diff tag configure clr1 -font font_diffbold\n \ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex dcf0711..f59477f 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -463,7 +463,8 @@ proc read_diff {fd cont_info} {\n \n \t\tforeach {posbegin colbegin posend colend} $markup {\n \t\t\tset prefix clr\n-\t\t\tforeach style [split $colbegin \";\"] {\n+\t\t\tforeach style [lsort -integer [split $colbegin \";\"]] {\n+\t\t\t\tif {$style eq \"4\"} {append prefix u; continue}\n \t\t\t\tif {$style eq \"7\"} {append prefix i; continue}\n \t\t\t\tif {$style < 30 || $style > 47} {continue}\n \t\t\t\tset a \"$mark linestart + $posbegin chars\"\n-- \ntg: (6f10c41..) bw/git-gui/support-underline-ansi-styles (depends on: master)\n"},{"id":"156159","messageId":"87oc9lhbjx.fsf@fox.patthoyts.tk","threadId":"25750","inReplyTo":"1289815498-12287-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [PATCH] git-gui: support for underline styles","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2010-11-19T10:00:49Z","receivedAt":"2010-11-19T10:00:49Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"\nSuggested-by: Bert Wesarg <bert.wesarg@googlemail.com>\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n---\n\nI left underline out because I reckon it would just make text harder to\nread on a gui display. It seems like the option would only be useful on\nmonochrome terminals.\n\nIf we do want to support underlines in the diff view window then we can\nhave a different tag rather than replicating each color to get a\nunderlined version of the same color.\nSomething like the following should do it:\n\n\n git-gui.sh   |    1 +\n lib/diff.tcl |    2 +-\n 2 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex d3acf0d..137cd72 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3330,6 +3330,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr\n \t$ui_diff tag configure clri3$n -background $c\n }\n $ui_diff tag configure clr1 -font font_diffbold\n+$ui_diff tag configure clr4 -underline 1\n \n $ui_diff tag conf d_cr -elide true\n $ui_diff tag conf d_@ -font font_diffbold\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 0579fa6..203ab07 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -473,7 +473,7 @@ proc read_diff {fd cont_info} {\n \t\t\tset prefix clr\n \t\t\tforeach style [split $colbegin \";\"] {\n \t\t\t\tif {$style eq \"7\"} {append prefix i; continue}\n-\t\t\t\tif {$style < 30 || $style > 47} {continue}\n+\t\t\t\tif {$style != 4 && ($style < 30 || $style > 47)} {continue}\n \t\t\t\tset a \"$mark linestart + $posbegin chars\"\n \t\t\t\tset b \"$mark linestart + $posend chars\"\n \t\t\t\tcatch {$ui_diff tag add $prefix$style $a $b}\n-- \n1.7.3.1.msysgit.0\n"},{"id":"156160","messageId":"AANLkTikmFOQfv6y50JHiWef-BPyOBxUNrOohrxmoThOe@mail.gmail.com","threadId":"25750","inReplyTo":"87oc9lhbjx.fsf@fox.patthoyts.tk","subject":"Re: [PATCH] git-gui: support for underline styles","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-11-19T10:55:09Z","receivedAt":"2010-11-19T10:55:09Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Nov 19, 2010 at 11:00, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n>\n> Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n> ---\n>\n> I left underline out because I reckon it would just make text harder to\n> read on a gui display. It seems like the option would only be useful on\n> monochrome terminals.\n>\n> If we do want to support underlines in the diff view window then we can\n> have a different tag rather than replicating each color to get a\n> underlined version of the same color.\n> Something like the following should do it:\n\nThanks for this simple implementation. My only concern left is the\nordering. If we have '\\033[7;4;30m' than we end up using 'clri4' as\ntag, which does not exists. I suspect that git does not produce such\nunordered attributes. But for clarity I would suggest to keep my lsort\naround the split command.\n\nBert\n\n>\n>\n>  git-gui.sh   |    1 +\n>  lib/diff.tcl |    2 +-\n>  2 files changed, 2 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-gui.sh b/git-gui.sh\n> index d3acf0d..137cd72 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -3330,6 +3330,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr\n>        $ui_diff tag configure clri3$n -background $c\n>  }\n>  $ui_diff tag configure clr1 -font font_diffbold\n> +$ui_diff tag configure clr4 -underline 1\n>\n>  $ui_diff tag conf d_cr -elide true\n>  $ui_diff tag conf d_@ -font font_diffbold\n> diff --git a/lib/diff.tcl b/lib/diff.tcl\n> index 0579fa6..203ab07 100644\n> --- a/lib/diff.tcl\n> +++ b/lib/diff.tcl\n> @@ -473,7 +473,7 @@ proc read_diff {fd cont_info} {\n>                        set prefix clr\n>                        foreach style [split $colbegin \";\"] {\n>                                if {$style eq \"7\"} {append prefix i; continue}\n> -                               if {$style < 30 || $style > 47} {continue}\n> +                               if {$style != 4 && ($style < 30 || $style > 47)} {continue}\n>                                set a \"$mark linestart + $posbegin chars\"\n>                                set b \"$mark linestart + $posend chars\"\n>                                catch {$ui_diff tag add $prefix$style $a $b}\n> --\n> 1.7.3.1.msysgit.0\n>\n>\n"},{"id":"162381","messageId":"AANLkTimnX-OJYzSvot-yUMGKXmqJw9deTGS-6mzywoEe@mail.gmail.com","threadId":"25750","inReplyTo":"87oc9lhbjx.fsf@fox.patthoyts.tk","subject":"Re: [PATCH] git-gui: support for underline styles","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-02-27T20:04:05Z","receivedAt":"2011-02-27T20:04:05Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Fri, Nov 19, 2010 at 11:00, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n>\n> Suggested-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n> ---\n>\n> I left underline out because I reckon it would just make text harder to\n> read on a gui display. It seems like the option would only be useful on\n> monochrome terminals.\n>\n> If we do want to support underlines in the diff view window then we can\n> have a different tag rather than replicating each color to get a\n> underlined version of the same color.\n> Something like the following should do it:\n\nI miss this in git-gui.git.\n\nThanks,\nBert\n\n>\n>\n>  git-gui.sh   |    1 +\n>  lib/diff.tcl |    2 +-\n>  2 files changed, 2 insertions(+), 1 deletions(-)\n>\n> diff --git a/git-gui.sh b/git-gui.sh\n> index d3acf0d..137cd72 100755\n> --- a/git-gui.sh\n> +++ b/git-gui.sh\n> @@ -3330,6 +3330,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr\n>        $ui_diff tag configure clri3$n -background $c\n>  }\n>  $ui_diff tag configure clr1 -font font_diffbold\n> +$ui_diff tag configure clr4 -underline 1\n>\n>  $ui_diff tag conf d_cr -elide true\n>  $ui_diff tag conf d_@ -font font_diffbold\n> diff --git a/lib/diff.tcl b/lib/diff.tcl\n> index 0579fa6..203ab07 100644\n> --- a/lib/diff.tcl\n> +++ b/lib/diff.tcl\n> @@ -473,7 +473,7 @@ proc read_diff {fd cont_info} {\n>                        set prefix clr\n>                        foreach style [split $colbegin \";\"] {\n>                                if {$style eq \"7\"} {append prefix i; continue}\n> -                               if {$style < 30 || $style > 47} {continue}\n> +                               if {$style != 4 && ($style < 30 || $style > 47)} {continue}\n>                                set a \"$mark linestart + $posbegin chars\"\n>                                set b \"$mark linestart + $posend chars\"\n>                                catch {$ui_diff tag add $prefix$style $a $b}\n> --\n> 1.7.3.1.msysgit.0\n>\n>\n"},{"id":"164661","messageId":"2cd6fc8a8da65dc6c2e420d150429b59fdbb3386.1301467146.git.bert.wesarg@googlemail.com","threadId":"25750","inReplyTo":"AANLkTimnX-OJYzSvot-yUMGKXmqJw9deTGS-6mzywoEe@mail.gmail.com","subject":"[PATCH 1/2] git-gui: support for underline styles","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-03-30T06:44:09Z","receivedAt":"2011-03-30T06:44:09Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"From: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nFrom: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nSuggested-by: Bert Wesarg <bert.wesarg@googlemail.com>\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n\nI left underline out because I reckon it would just make text harder to\nread on a gui display. It seems like the option would only be useful on\nmonochrome terminals.\n\nIf we do want to support underlines in the diff view window then we can\nhave a different tag rather than replicating each color to get a\nunderlined version of the same color.\nSomething like the following should do it:\n---\n git-gui.sh   |    1 +\n lib/diff.tcl |    2 +-\n 2 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex fd6a43d..d5c1535 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -3361,6 +3361,7 @@ foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 gr\n \t$ui_diff tag configure clri3$n -background $c\n }\n $ui_diff tag configure clr1 -font font_diffbold\n+$ui_diff tag configure clr4 -underline 1\n \n $ui_diff tag conf d_info -foreground blue -font font_diffbold\n \ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex cf8a95e..39e4d90 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -504,7 +504,7 @@ proc read_diff {fd conflict_size cont_info} {\n \t\t\tset prefix clr\n \t\t\tforeach style [split $colbegin \";\"] {\n \t\t\t\tif {$style eq \"7\"} {append prefix i; continue}\n-\t\t\t\tif {$style < 30 || $style > 47} {continue}\n+\t\t\t\tif {$style != 4 && ($style < 30 || $style > 47)} {continue}\n \t\t\t\tset a \"$mark linestart + $posbegin chars\"\n \t\t\t\tset b \"$mark linestart + $posend chars\"\n \t\t\t\tcatch {$ui_diff tag add $prefix$style $a $b}\n-- \n1.7.4.1.1319.ga04f7.dirty\n"}]}