summaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-06-16 11:51:08 (GMT)
committerPaul Mackerras <paulus@samba.org>2007-06-23 10:55:34 (GMT)
commite507fd4871acc52cc95934d3d5a6faa04d504ec9 (patch)
tree79e5fcc7205f971d1f10b18ffc7686a8b99c66a6 /gitk
parent3fc4279a144d0c477749fbe5318e570739f569e2 (diff)
downloadgit-e507fd4871acc52cc95934d3d5a6faa04d504ec9.zip
git-e507fd4871acc52cc95934d3d5a6faa04d504ec9.tar.gz
git-e507fd4871acc52cc95934d3d5a6faa04d504ec9.tar.bz2
gitk: Improve the behaviour of the initial selection
It used to be that if you clicked on a line while gitk was still drawing stuff, it would immediately re-select the first line of the display. This fixes that. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk38
1 files changed, 30 insertions, 8 deletions
diff --git a/gitk b/gitk
index a671374..b3df24d 100755
--- a/gitk
+++ b/gitk
@@ -1671,7 +1671,7 @@ proc showview {n} {
global pending_select phase
global commitidx rowlaidout rowoptim linesegends
global commfd nextupdate
- global selectedview
+ global selectedview selectfirst
global vparentlist vchildlist vdisporder vcmitlisted
global hlview selectedhlview
@@ -1689,6 +1689,9 @@ proc showview {n} {
} else {
set yscreen [expr {($ybot - $ytop) / 2}]
}
+ } elseif {[info exists pending_select]} {
+ set selid $pending_select
+ unset pending_select
}
unselectline
normalline
@@ -1723,7 +1726,9 @@ proc showview {n} {
.bar.view entryconf Delete* -state [expr {$n == 0? "disabled": "normal"}]
if {![info exists viewdata($n)]} {
- set pending_select $selid
+ if {$selid ne {}} {
+ set pending_select $selid
+ }
getcommits
return
}
@@ -1757,7 +1762,8 @@ proc showview {n} {
set row 0
setcanvscroll
set yf 0
- set row 0
+ set row {}
+ set selectfirst 0
if {$selid ne {} && [info exists commitrow($n,$selid)]} {
set row $commitrow($n,$selid)
# try to get the selected row in the same position on the screen
@@ -1770,7 +1776,17 @@ proc showview {n} {
}
allcanvs yview moveto $yf
drawvisible
- selectline $row 0
+ if {$row ne {}} {
+ selectline $row 0
+ } elseif {$selid ne {}} {
+ set pending_select $selid
+ } else {
+ if {$numcommits > 0} {
+ selectline 0 0
+ } else {
+ set selectfirst 1
+ }
+ }
if {$phase ne {}} {
if {$phase eq "getcommits"} {
show_status "Reading commits..."
@@ -2407,7 +2423,7 @@ proc initlayout {} {
global nextcolor
global parentlist childlist children
global colormap rowtextx
- global linesegends
+ global linesegends selectfirst
set numcommits 0
set displayorder {}
@@ -2427,6 +2443,7 @@ proc initlayout {} {
catch {unset rowtextx}
catch {unset idrowranges}
set linesegends {}
+ set selectfirst 1
}
proc setcanvscroll {} {
@@ -2495,6 +2512,7 @@ proc layoutmore {tmax} {
proc showstuff {canshow} {
global numcommits commitrow pending_select selectedline
global linesegends idrowranges idrangedrawn curview
+ global displayorder selectfirst
if {$numcommits == 0} {
global phase
@@ -2533,8 +2551,13 @@ proc showstuff {canshow} {
$commitrow($curview,$pending_select) < $numcommits} {
selectline $commitrow($curview,$pending_select) 1
}
- if {![info exists selectedline] && ![info exists pending_select]} {
- selectline 0 1
+ if {$selectfirst} {
+ if {[info exists selectedline] || [info exists pending_select]} {
+ set selectfirst 0
+ } else {
+ selectline 0 1
+ set selectfirst 0
+ }
}
}
@@ -3551,7 +3574,6 @@ proc drawrest {} {
global rowlaidout commitidx curview
global pending_select
- set row $rowlaidout
layoutrows $rowlaidout $commitidx($curview) 1
layouttail
optimize_rows $row 0 $commitidx($curview)