From 8f85599aba6b569de5c559994704a416f52bc031 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Fri, 22 Oct 2010 16:14:38 +0100 Subject: git-gui: apply color information from git diff output This patch extracts the ANSI color sequences from git diff output and applies these to the diff view window. This ensures that the gui view makes use of the current git configuration for whitespace display. ANSI codes may include attributes, foreground and background in a single sequence. Handle this and support bold and reverse attributes. Ignore all other attributes. Suggested-by: Tor Arvid Lund Suggested-by: Junio C Hamano Tested-by: Tor Arvid Lund Signed-off-by: Pat Thoyts --- git-gui.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'git-gui.sh') diff --git a/git-gui.sh b/git-gui.sh index efbc446d67..d3acf0d213 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -3323,8 +3323,16 @@ pack $ui_diff -side left -fill both -expand 1 pack .vpane.lower.diff.header -side top -fill x pack .vpane.lower.diff.body -side bottom -fill both -expand 1 +foreach {n c} {0 black 1 red4 2 green4 3 yellow4 4 blue4 5 magenta4 6 cyan4 7 grey60} { + $ui_diff tag configure clr4$n -background $c + $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 clr1 -font font_diffbold + $ui_diff tag conf d_cr -elide true -$ui_diff tag conf d_@ -foreground blue -font font_diffbold +$ui_diff tag conf d_@ -font font_diffbold $ui_diff tag conf d_+ -foreground {#00a000} $ui_diff tag conf d_- -foreground red -- cgit v1.3