Browse Source

Make the diff display less gaudy.

The old style is still available as an option (we still need a
preferences window so we can set/clear it though).
maint
Paul Mackerras 20 years ago
parent
commit
f06548617d
  1. 28
      gitk

28
gitk

@ -60,7 +60,7 @@ proc getcommitlines {commfd} {
set stuff [read $commfd] set stuff [read $commfd]
if {$stuff == {}} { if {$stuff == {}} {
if {![eof $commfd]} return if {![eof $commfd]} return
# this works around what is apparently a bug in Tcl... # set it blocking so we wait for the process to terminate
fconfigure $commfd -blocking 1 fconfigure $commfd -blocking 1
if {![catch {close $commfd} err]} { if {![catch {close $commfd} err]} {
after idle finishcommits after idle finishcommits
@ -273,7 +273,7 @@ proc makewindow {} {
global findtype findtypemenu findloc findstring fstring geometry global findtype findtypemenu findloc findstring fstring geometry
global entries sha1entry sha1string sha1but global entries sha1entry sha1string sha1but
global maincursor textcursor global maincursor textcursor
global rowctxmenu global rowctxmenu gaudydiff


menu .bar menu .bar
.bar add cascade -label "File" -menu .bar.file .bar add cascade -label "File" -menu .bar.file
@ -364,11 +364,17 @@ proc makewindow {} {
pack $ctext -side left -fill both -expand 1 pack $ctext -side left -fill both -expand 1
.ctop.cdet add .ctop.cdet.left .ctop.cdet add .ctop.cdet.left


$ctext tag conf filesep -font [concat $textfont bold] $ctext tag conf filesep -font [concat $textfont bold] -back "#aaaaaa"
if {$gaudydiff} {
$ctext tag conf hunksep -back blue -fore white $ctext tag conf hunksep -back blue -fore white
$ctext tag conf d0 -back "#ff8080" $ctext tag conf d0 -back "#ff8080"
$ctext tag conf d1 -back green $ctext tag conf d1 -back green
} else {
$ctext tag conf hunksep -fore blue
$ctext tag conf d0 -fore red
$ctext tag conf d1 -fore "#00a000"
$ctext tag conf found -back yellow $ctext tag conf found -back yellow
}


frame .ctop.cdet.right frame .ctop.cdet.right
set cflist .ctop.cdet.right.cfiles set cflist .ctop.cdet.right.cfiles
@ -465,8 +471,10 @@ proc savestuff {w} {
if {![winfo viewable .]} return if {![winfo viewable .]} return
catch { catch {
set f [open "~/.gitk-new" w] set f [open "~/.gitk-new" w]
puts $f "set mainfont {$mainfont}" puts $f [list set mainfont $mainfont]
puts $f "set textfont {$textfont}" puts $f [list set textfont $textfont]
puts $f [list set findmergefiles $findmergefiles]
puts $f [list set gaudydiff $gaudydiff]
puts $f "set geometry(width) [winfo width .ctop]" puts $f "set geometry(width) [winfo width .ctop]"
puts $f "set geometry(height) [winfo height .ctop]" puts $f "set geometry(height) [winfo height .ctop]"
puts $f "set geometry(canv1) [expr [winfo width $canv]-2]" puts $f "set geometry(canv1) [expr [winfo width $canv]-2]"
@ -1787,6 +1795,7 @@ proc getblobdiffline {bdf ids} {
global diffids blobdifffd ctext curdifftag curtagstart global diffids blobdifffd ctext curdifftag curtagstart
global diffnexthead diffnextnote diffindex difffilestart global diffnexthead diffnextnote diffindex difffilestart
global nextupdate diffpending diffpindex diffinhdr global nextupdate diffpending diffpindex diffinhdr
global gaudydiff


set n [gets $bdf line] set n [gets $bdf line]
if {$n < 0} { if {$n < 0} {
@ -1829,18 +1838,26 @@ proc getblobdiffline {bdf ids} {
set diffinhdr 0 set diffinhdr 0
} elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \ } elseif {[regexp {^@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@(.*)} \
$line match f1l f1c f2l f2c rest]} { $line match f1l f1c f2l f2c rest]} {
if {$gaudydiff} {
$ctext insert end "\t" hunksep $ctext insert end "\t" hunksep
$ctext insert end " $f1l " d0 " $f2l " d1 $ctext insert end " $f1l " d0 " $f2l " d1
$ctext insert end " $rest \n" hunksep $ctext insert end " $rest \n" hunksep
} else {
$ctext insert end "$line\n" hunksep
}
set diffinhdr 0 set diffinhdr 0
} else { } else {
set x [string range $line 0 0] set x [string range $line 0 0]
if {$x == "-" || $x == "+"} { if {$x == "-" || $x == "+"} {
set tag [expr {$x == "+"}] set tag [expr {$x == "+"}]
if {$gaudydiff} {
set line [string range $line 1 end] set line [string range $line 1 end]
}
$ctext insert end "$line\n" d$tag $ctext insert end "$line\n" d$tag
} elseif {$x == " "} { } elseif {$x == " "} {
if {$gaudydiff} {
set line [string range $line 1 end] set line [string range $line 1 end]
}
$ctext insert end "$line\n" $ctext insert end "$line\n"
} elseif {$diffinhdr || $x == "\\"} { } elseif {$diffinhdr || $x == "\\"} {
# e.g. "\ No newline at end of file" # e.g. "\ No newline at end of file"
@ -2379,6 +2396,7 @@ set wrcomcmd "git-diff-tree --stdin -p --pretty"
set mainfont {Helvetica 9} set mainfont {Helvetica 9}
set textfont {Courier 9} set textfont {Courier 9}
set findmergefiles 0 set findmergefiles 0
set gaudydiff 0


set colors {green red blue magenta darkgrey brown orange} set colors {green red blue magenta darkgrey brown orange}



Loading…
Cancel
Save