aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-03-11 22:11:19 +1100
committerPaul Mackerras <paulus@samba.org>2008-03-11 22:11:19 +1100
commit494d3b8a6c93d88daf4a52dbcc6ab07903f8ed4e (patch)
tree9f1aa0e61f13c52d3dfe62a4f9c7db80e8676475
parentcb8329aa9a6cc2e009d552b1180ce107cec4eb9d (diff)
downloadgit-494d3b8a6c93d88daf4a52dbcc6ab07903f8ed4e.tar.gz
git-494d3b8a6c93d88daf4a52dbcc6ab07903f8ed4e.tar.xz
gitk: Avoid Tcl error when switching views
Michele Ballabio <barra_cuda@katamail.com> pointed out that gitk sometimes throws a Tcl error (can't read "yscreen") when switching views, and proposed a patch. This is a different way of fixing it which is a bit neater. Basically, in showview we only set yscreen if the selected commit is on screen to start with, and then we only scroll the canvas to bring it onscreen if yscreen is set and the same commit exists in the new view. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk4
1 files changed, 1 insertions, 3 deletions
diff --git a/gitk b/gitk
index 5d9f589f0..84ab02e15 100755
--- a/gitk
+++ b/gitk
@@ -2102,8 +2102,6 @@ proc showview {n} {
set ybot [expr {[lindex $span 1] * $ymax}]
if {$ytop < $y && $y < $ybot} {
set yscreen [expr {$y - $ytop}]
- } else {
- set yscreen [expr {($ybot - $ytop) / 2}]
}
} elseif {[info exists pending_select]} {
set selid $pending_select
@@ -2164,7 +2162,7 @@ proc showview {n} {
set yf 0
set row {}
set selectfirst 0
- if {$selid ne {} && [info exists commitrow($n,$selid)]} {
+ if {[info exists yscreen] && [info exists commitrow($n,$selid)]} {
set row $commitrow($n,$selid)
# try to get the selected row in the same position on the screen
set ymax [lindex [$canv cget -scrollregion] 3]