gitk: Allow user to choose whether to see the diff, old file, or new file
This adds a set of radiobuttons that select between displaying the full diff (both - and + lines), the old file (suppressing the + lines) and the new file (suppressing the - lines) in the diff display window. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Apr 19, 2007 at 11:39 UTC
a8d610a2a39496a83108d95e7899e6b373e80940
1 file changed
+17
gitk
+17
@@ -593,6 +593,7 @@ proc makewindow {} {
593
frame .bleft -width $geometry(botwidth) -height $geometry(botheight)
594
}
595
frame .bleft.top
596
+ frame .bleft.mid
597
598
button .bleft.top.search -text "Search" -command dosearch \
599
-font $uifont
@@ -602,12 +603,20 @@ proc makewindow {} {
603
lappend entries $sstring
604
trace add variable searchstring write incrsearch
605
pack $sstring -side left -expand 1 -fill x
606
+ radiobutton .bleft.mid.diff -text "Diff" \
607
+ -command changediffdisp -variable diffelide -value {0 0}
608
+ radiobutton .bleft.mid.old -text "Old version" \
609
+ -command changediffdisp -variable diffelide -value {0 1}
610
+ radiobutton .bleft.mid.new -text "New version" \
611
+ -command changediffdisp -variable diffelide -value {1 0}
612
+ pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
613
set ctext .bleft.ctext
614
text $ctext -background $bgcolor -foreground $fgcolor \
615
-state disabled -font $textfont \
616
-yscrollcommand scrolltext -wrap none
617
scrollbar .bleft.sb -command "$ctext yview"
618
pack .bleft.top -side top -fill x
619
+ pack .bleft.mid -side top -fill x
620
pack .bleft.sb -side right -fill y
621
pack $ctext -side left -fill both -expand 1
622
lappend bglist $ctext
@@ -4486,6 +4495,13 @@ proc getblobdiffline {bdf ids} {
4495
}
4496
}
4497
4498
+proc changediffdisp {} {
4499
+ global ctext diffelide
4500
+
4501
+ $ctext tag conf d0 -elide [lindex $diffelide 0]
4502
+ $ctext tag conf d1 -elide [lindex $diffelide 1]
4503
+}
4504
+
4505
proc prevfile {} {
4506
global difffilestart ctext
4507
set prev [lindex $difffilestart 0]
@@ -6330,6 +6346,7 @@ set highlight_paths {}
6346
set searchdirn -forwards
6347
set boldrows {}
6348
set boldnamerows {}
6349
+set diffelide {0 0}
6350
6351
set optim_delay 16
6352