if {$showlocalchanges && [commitinview $mainheadid $curview]} {
dodiffindex
}
+ rereadrefs
set view $curview
set commits [exec git rev-parse --default HEAD --revs-only \
$viewargs($view)]
incr viewactive($view)
set viewcomplete($view) 0
nowbusy $view "Reading"
- readrefs
- changedrefs
if {$showneartags} {
getallcommits
}
proc removerow {id v} {
global varcid varccommits parents children commitidx
- global varctok vtokmod cmitlisted
+ global varctok vtokmod cmitlisted currentid selectedline
if {[llength $parents($v,$id)] != 1} {
puts "oops: removerow [shortids $id] has [llength $parents($v,$id)] parents"
if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] < 0} {
modify_arc $v $a $i
}
+ if {[info exist currentid] && $id eq $currentid} {
+ unset currentid
+ unset selectedline
+ }
drawvisible
}
return {}
}
set a $varcid($v,$id)
- if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] > 0} {
+ if {[string compare [lindex $varctok($v) $a] $vtokmod($v)] >= 0} {
update_arcrows $v
}
set i [lsearch -exact $varccommits($v,$a) $id]
}
proc readdiffindex {fd serial} {
- global mainheadid nullid2 curview commitinfo commitdata lserial
+ global mainheadid nullid nullid2 curview commitinfo commitdata lserial
set isdiff 1
if {[gets $fd line] < 0} {
set hl [mc "Local changes checked in to index but not committed"]
set commitinfo($nullid2) [list $hl {} {} {} {} " $hl\n"]
set commitdata($nullid2) "\n $hl\n"
+ if {[commitinview $nullid $curview]} {
+ removerow $nullid $curview
+ }
insertrow $nullid2 $mainheadid $curview
} elseif {!$isdiff && [commitinview $nullid2 $curview]} {
removerow $nullid2 $curview
set l 0
}
if {$w eq $canv} {
- if {![info exists rowtextx($l)] || $x < $rowtextx($l)} return
+ set xmax [lindex [$canv cget -scrollregion] 2]
+ set xleft [expr {[lindex [$canv xview] 0] * $xmax}]
+ if {![info exists rowtextx($l)] || $xleft + $x < $rowtextx($l)} return
}
unmarkmatches
selectline $l 1
make_secsel $l
+ set id [commitonrow $l]
if {$isnew} {
- addtohistory [list selectline $l 0]
+ addtohistory [list selbyid $id]
}
set selectedline $l
-
- set id [commitonrow $l]
set currentid $id
$sha1entry delete 0 end
$sha1entry insert 0 $id
}
proc redrawtags {id} {
- global canv linehtag idpos selectedline curview
+ global canv linehtag idpos currentid curview
global canvxmax iddrawn
if {![commitinview $id $curview]} return
if {![info exists iddrawn($id)]} return
- drawcommits [rowofcommit $id]
+ set row [rowofcommit $id]
$canv delete tag.$id
set xt [eval drawtags $id $idpos($id)]
- $canv coords $linehtag([rowofcommit $id]) $xt [lindex $idpos($id) 2]
- set text [$canv itemcget $linehtag([rowofcommit $id]) -text]
- set xr [expr {$xt + [font measure mainfont $text]}]
+ $canv coords $linehtag($row) $xt [lindex $idpos($id) 2]
+ set text [$canv itemcget $linehtag($row) -text]
+ set font [$canv itemcget $linehtag($row) -font]
+ set xr [expr {$xt + [font measure $font $text]}]
if {$xr > $canvxmax} {
set canvxmax $xr
setcanvscroll
}
- if {[info exists selectedline]
- && $selectedline == [rowofcommit $id]} {
- selectline $selectedline 0
+ if {[info exists currentid] && $currentid == $id} {
+ make_secsel $row
}
}
}
proc rereadrefs {} {
- global idtags idheads idotherrefs mainhead
+ global idtags idheads idotherrefs mainheadid
set refids [concat [array names idtags] \
[array names idheads] [array names idotherrefs]]
set ref($id) [listrefs $id]
}
}
- set oldmainhead $mainhead
+ set oldmainhead $mainheadid
readrefs
changedrefs
set refids [lsort -unique [concat $refids [array names idtags] \
foreach id $refids {
set v [listrefs $id]
if {![info exists ref($id)] || $ref($id) != $v ||
- ($id eq $oldmainhead && $id ne $mainhead) ||
- ($id eq $mainhead && $id ne $oldmainhead)} {
+ ($id eq $oldmainhead && $id ne $mainheadid) ||
+ ($id eq $mainheadid && $id ne $oldmainhead)} {
redrawtags $id
}
}