aboutsummaryrefslogtreecommitdiff
path: root/gitk
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-09-27 10:35:05 +1000
committerPaul Mackerras <paulus@samba.org>2007-09-27 10:35:05 +1000
commitc73adce219ce52a662d90af1e1762c77ea5c4cb0 (patch)
tree3b4e7ba164e7abf825c357c4abd5d3ead823b529 /gitk
parent687c8765ec996225a01cadc7d91354ae3cfbdf8a (diff)
downloadgit-c73adce219ce52a662d90af1e1762c77ea5c4cb0.tar.gz
git-c73adce219ce52a662d90af1e1762c77ea5c4cb0.tar.xz
gitk: Fix a couple of bugs
insertrow and removerow were trying to adjust rowidlist, rowisopt and rowfinal even if the row where we're inserting/deleting stuff hasn't been laid out yet, which resulted in Tcl errors. This fixes that. Also we weren't deleting the link$linknum tag in appendwithlinks, which resulted in SHA1 IDs in the body of a commit message sometimes getting shown in blue with underlining when they shouldn't. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'gitk')
-rwxr-xr-xgitk33
1 files changed, 20 insertions, 13 deletions
diff --git a/gitk b/gitk
index a5d0d66e6..34fe33771 100755
--- a/gitk
+++ b/gitk
@@ -4027,17 +4027,21 @@ proc insertrow {row newcmit} {
incr commitidx($curview)
set ordertok($curview,$newcmit) $ordertok($curview,$p)
- set idlist [lindex $rowidlist $row]
- if {[llength $kids] == 1} {
- set col [lsearch -exact $idlist $p]
- lset idlist $col $newcmit
- } else {
- set col [llength $idlist]
- lappend idlist $newcmit
+ if {$row < [llength $rowidlist]} {
+ set idlist [lindex $rowidlist $row]
+ if {$idlist ne {}} {
+ if {[llength $kids] == 1} {
+ set col [lsearch -exact $idlist $p]
+ lset idlist $col $newcmit
+ } else {
+ set col [llength $idlist]
+ lappend idlist $newcmit
+ }
+ }
+ set rowidlist [linsert $rowidlist $row $idlist]
+ set rowisopt [linsert $rowisopt $row 0]
+ set rowfinal [linsert $rowfinal $row [lindex $rowfinal $row]]
}
- set rowidlist [linsert $rowidlist $row $idlist]
- set rowisopt [linsert $rowisopt $row 0]
- set rowfinal [linsert $rowfinal $row [lindex $rowfinal $row]]
incr numcommits
@@ -4077,9 +4081,11 @@ proc removerow {row} {
}
incr commitidx($curview) -1
- set rowidlist [lreplace $rowidlist $row $row]
- set rowisopt [lreplace $rowisopt $row $row]
- set rowfinal [lreplace $rowfinal $row $row]
+ if {$row < [llength $rowidlist]} {
+ set rowidlist [lreplace $rowidlist $row $row]
+ set rowisopt [lreplace $rowisopt $row $row]
+ set rowfinal [lreplace $rowfinal $row $row]
+ }
incr numcommits -1
@@ -4443,6 +4449,7 @@ proc appendwithlinks {text tags} {
set e [lindex $l 1]
set linkid [string range $text $s $e]
incr e
+ $ctext tag delete link$linknum
$ctext tag add link$linknum "$start + $s c" "$start + $e c"
setlink $linkid link$linknum
incr linknum