summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f806f0f)
raw | patch | inline | side by side (parent: f806f0f)
author | Paul Mackerras <paulus@samba.org> | |
Sun, 2 Mar 2008 23:11:08 +0000 (10:11 +1100) | ||
committer | Paul Mackerras <paulus@samba.org> | |
Sun, 2 Mar 2008 23:11:08 +0000 (10:11 +1100) |
Occasionally the target row stuff would scroll the display to some
uninteresting commit while reading. There were two problems: one
was that drawvisible would set targetrow even if there was no target
previously and no row selected, and the other was that it was possible
for the target row to get pushed down past numcommits, if drawvisible
was called after rows were added but before layoutmore got run.
The first problem is fixed by just not setting targetrow/id unless
there is a selected row or they were set previously.
The second problem is fixed by updating numcommits immediately new
rows are added. This leads to a simplification of layoutmore and
chewcommits but also means that some of the things that were done in
layoutmore now need to be done elsewhere, since layoutmore can no
longer use numcommits to know how much it has seen previously.
Hence the changes to getcommits, initlayout and setcanvscroll.
Signed-off-by: Paul Mackerras <paulus@samba.org>
uninteresting commit while reading. There were two problems: one
was that drawvisible would set targetrow even if there was no target
previously and no row selected, and the other was that it was possible
for the target row to get pushed down past numcommits, if drawvisible
was called after rows were added but before layoutmore got run.
The first problem is fixed by just not setting targetrow/id unless
there is a selected row or they were set previously.
The second problem is fixed by updating numcommits immediately new
rows are added. This leads to a simplification of layoutmore and
chewcommits but also means that some of the things that were done in
layoutmore now need to be done elsewhere, since layoutmore can no
longer use numcommits to know how much it has seen previously.
Hence the changes to getcommits, initlayout and setcanvscroll.
Signed-off-by: Paul Mackerras <paulus@samba.org>
gitk | patch | blob | history |
index 5925ced55b54886e512a65cab9f1399c36a9ff44..47e1a58d63ec4c5773906293b444f6c3db58df0e 100755 (executable)
--- a/gitk
+++ b/gitk
}
proc getcommits {} {
- global canv curview
+ global canv curview need_redisplay
initlayout
start_rev_list $curview
show_status [mc "Reading commits..."]
+ set need_redisplay 1
}
proc updatecommits {} {
adjustprogress
}
if {$view == $curview} {
- run chewcommits $view
+ run chewcommits
}
return 0
}
set gotsome 1
}
if {$gotsome} {
- run chewcommits $view
+ global numcommits hlview
+
+ if {$view == $curview} {
+ set numcommits $commitidx($view)
+ run chewcommits
+ }
+ if {[info exists hlview] && $view == $hlview} {
+ # we never actually get here...
+ run vhighlightmore
+ }
foreach s $scripts {
eval $s
}
return 2
}
-proc chewcommits {view} {
+proc chewcommits {} {
global curview hlview viewcomplete
global pending_select
- if {$view == $curview} {
- layoutmore
- if {$viewcomplete($view)} {
- global commitidx varctok
- global numcommits startmsecs
- global mainheadid commitinfo nullid
-
- if {[info exists pending_select]} {
- set row [first_real_row]
- selectline $row 1
- }
- if {$commitidx($curview) > 0} {
- #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
- #puts "overall $ms ms for $numcommits commits"
- #puts "[llength $varctok($view)] arcs, $commitidx($view) commits"
- } else {
- show_status [mc "No commits selected"]
- }
- notbusy layout
+ layoutmore
+ if {$viewcomplete($curview)} {
+ global commitidx varctok
+ global numcommits startmsecs
+ global mainheadid commitinfo nullid
+
+ if {[info exists pending_select]} {
+ set row [first_real_row]
+ selectline $row 1
}
- }
- if {[info exists hlview] && $view == $hlview} {
- vhighlightmore
+ if {$commitidx($curview) > 0} {
+ #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
+ #puts "overall $ms ms for $numcommits commits"
+ #puts "[llength $varctok($view)] arcs, $commitidx($view) commits"
+ } else {
+ show_status [mc "No commits selected"]
+ }
+ notbusy layout
}
return 0
}
}
}
set vhl_done $max
+ return 0
}
proc askvhighlight {row id} {
set canvxmax [$canv cget -width]
catch {unset colormap}
catch {unset rowtextx}
+ setcanvscroll
}
proc setcanvscroll {} {
global canv canv2 canv3 numcommits linespc canvxmax canvy0
+ global lastscrollset lastscrollrows
set ymax [expr {$canvy0 + ($numcommits - 0.5) * $linespc + 2}]
$canv conf -scrollregion [list 0 0 $canvxmax $ymax]
$canv2 conf -scrollregion [list 0 0 0 $ymax]
$canv3 conf -scrollregion [list 0 0 0 $ymax]
+ set lastscrollset [clock clicks -milliseconds]
+ set lastscrollrows $numcommits
}
proc visiblerows {} {
proc layoutmore {} {
global commitidx viewcomplete curview
global numcommits pending_select selectedline curview
- global lastscrollset commitinterest
-
- set canshow $commitidx($curview)
- if {$canshow <= $numcommits && !$viewcomplete($curview)} return
- if {$numcommits == 0} {
- allcanvs delete all
- }
- set r0 $numcommits
- set prev $numcommits
- set numcommits $canshow
- set t [clock clicks -milliseconds]
- if {$prev < 100 || $viewcomplete($curview) || $t - $lastscrollset > 500} {
- set lastscrollset $t
+ global lastscrollset lastscrollrows commitinterest
+
+ if {$lastscrollrows < 100 || $viewcomplete($curview) ||
+ [clock clicks -milliseconds] - $lastscrollset > 500} {
setcanvscroll
}
- set rows [visiblerows]
- set r1 [lindex $rows 1]
- if {$r1 >= $canshow} {
- set r1 [expr {$canshow - 1}]
- }
- if {$r0 <= $r1} {
- drawcommits $r0 $r1
- }
if {[info exists pending_select] &&
[commitinview $pending_select $curview]} {
selectline [rowofcommit $pending_select] 1
}
+ drawvisible
}
proc doshowlocalchanges {} {
if {[info exists selectedline] &&
$row <= $selectedline && $selectedline <= $endrow} {
set targetrow $selectedline
- } else {
+ } elseif {[info exists targetid]} {
set targetrow [expr {int(($row + $endrow) / 2)}]
}
- if {$targetrow >= $numcommits} {
- set targetrow [expr {$numcommits - 1}]
+ if {[info exists targetrow]} {
+ if {$targetrow >= $numcommits} {
+ set targetrow [expr {$numcommits - 1}]
+ }
+ set targetid [commitonrow $targetrow]
}
- set targetid [commitonrow $targetrow]
drawcommits $row $endrow
}
unsel_reflist
stopfinding
if {$l < 0 || $l >= $numcommits} return
+ set id [commitonrow $l]
+ set targetid $id
+ set targetrow $l
+
set y [expr {$canvy0 + $l * $linespc}]
set ymax [lindex [$canv cget -scrollregion] 3]
set ytop [expr {$y - $linespc - 1}]
make_secsel $l
- set id [commitonrow $l]
if {$isnew} {
addtohistory [list selbyid $id]
}
set selectedline $l
set currentid $id
- set targetid $id
- set targetrow $l
$sha1entry delete 0 end
$sha1entry insert 0 $id
$sha1entry selection from 0