gitk: Remember the view in the history list
When moving backwards or forwards through the history list, this automatically switches the view so that each point that we jump to is shown in the same view that it was originally displayed in. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Apr 21, 2006 at 10:35 UTC
2516dae2f63b6e6c4f7dbe2eb1322ba32da092c5
1 file changed
+29
-9
gitk
+29
-9
@@ -959,7 +959,8 @@ proc showview {n} {
959
$commitidx $rowlaidout $rowoptim $numcommits \
960
$linesegends $leftover $commfd]
961
fileevent $commfd readable {}
962
- } elseif {![info exists viewdata($curview)]} {
962
+ } elseif {![info exists viewdata($curview)]
963
+ || [lindex $viewdata($curview) 0] ne {}} {
964
set viewdata($curview) \
965
[list {} $displayorder $parentlist $childlist $rowidlist \
966
$rowoffsets $rowrangelist $commitlisted]
@@ -1035,6 +1036,14 @@ proc showview {n} {
1036
allcanvs yview moveto $yf
1037
drawvisible
1038
selectline $row 0
1039
+ if {$phase eq {}} {
1040
+ global maincursor textcursor
1041
+ . config -cursor $maincursor
1042
+ settextcursor $textcursor
1043
+ } else {
1044
+ . config -cursor watch
1045
+ settextcursor watch
1046
+ }
1047
}
1048
1049
proc shortids {ids} {
@@ -2301,7 +2310,7 @@ proc stopfindproc {{done 0}} {
2310
}
2311
if {[info exists findinprogress]} {
2312
unset findinprogress
2304
- if {$phase != "incrdraw"} {
2313
+ if {$phase eq {}} {
2314
. config -cursor $maincursor
2315
settextcursor $textcursor
2316
}
@@ -2840,17 +2849,18 @@ proc unselectline {} {
2849
}
2850
2851
proc addtohistory {cmd} {
2843
- global history historyindex
2852
+ global history historyindex curview
2853
2854
+ set elt [list $curview $cmd]
2855
if {$historyindex > 0
2846
- && [lindex $history [expr {$historyindex - 1}]] == $cmd} {
2856
+ && [lindex $history [expr {$historyindex - 1}]] == $elt} {
2857
return
2858
}
2859
2860
if {$historyindex < [llength $history]} {
2851
- set history [lreplace $history $historyindex end $cmd]
2861
+ set history [lreplace $history $historyindex end $elt]
2862
} else {
2853
- lappend history $cmd
2863
+ lappend history $elt
2864
}
2865
incr historyindex
2866
if {$historyindex > 1} {
@@ -2861,13 +2871,23 @@ proc addtohistory {cmd} {
2871
.ctop.top.bar.rightbut conf -state disabled
2872
}
2873
2874
+proc godo {elt} {
2875
+ global curview
2876
+
2877
+ set view [lindex $elt 0]
2878
+ set cmd [lindex $elt 1]
2879
+ if {$curview != $view} {
2880
+ showview $view
2881
+ }
2882
+ eval $cmd
2883
+}
2884
+
2885
proc goback {} {
2886
global history historyindex
2887
2888
if {$historyindex > 1} {
2889
incr historyindex -1
2869
- set cmd [lindex $history [expr {$historyindex - 1}]]
2870
- eval $cmd
2890
+ godo [lindex $history [expr {$historyindex - 1}]]
2891
.ctop.top.bar.rightbut conf -state normal
2892
}
2893
if {$historyindex <= 1} {
@@ -2881,7 +2901,7 @@ proc goforw {} {
2901
if {$historyindex < [llength $history]} {
2902
set cmd [lindex $history $historyindex]
2903
incr historyindex
2884
- eval $cmd
2904
+ godo $cmd
2905
.ctop.top.bar.leftbut conf -state normal
2906
}
2907
if {$historyindex >= [llength $history]} {