@matheusbsbs / matheus-bagliano / commits / cd2bcae798
Fork 0

gitk: Fix a couple of bugs in the find function

First, findmore would sometimes get a Tcl error due to relying on varcorder and vrownum having valid values for the rows being searched, but they may not be valid unless update_arcrows is called, so this makes findmore call update_arcrows if necessary. Secondly, in the "touching paths" and "adding/removing string" modes, findmore was treating fhighlights($row) == -1 as meaning the row matches, whereas it only means that we haven't received an answer from the external git diff-tree process about it yet. This fixes it. Signed-off-by: Paul Mackerras <paulus@samba.org>

Paul Mackerras committed Jan 2, 2008 at 21:44 UTC cd2bcae798ac2194f18374dc7dc10de404fd01d0
1 file changed +11 -4
gitk
+11 -4
@@ -4950,7 +4950,7 @@ proc findmore {} {
4950 global commitdata commitinfo numcommits findpattern findloc
4951 global findstartline findcurline findallowwrap
4952 global find_dirn gdttype fhighlights fprogcoord
4953 - global curview varcorder vrownum varccommits
4953 + global curview varcorder vrownum varccommits vrowmod
4954
4955 if {![info exists find_dirn]} {
4956 return 0
@@ -4986,6 +4986,9 @@ proc findmore {} {
4986 set n 500
4987 set moretodo 1
4988 }
4989 + if {$l + ($find_dirn > 0? $n: 1) > $vrowmod($curview)} {
4990 + update_arcrows $curview
4991 + }
4992 set found 0
4993 set domore 1
4994 set ai [bsearch $vrownum($curview) $l]
@@ -5032,14 +5035,18 @@ proc findmore {} {
5035 }
5036 set id [lindex $ids [expr {$l - $arow}]]
5037 if {![info exists fhighlights($l)]} {
5038 + # this sets fhighlights($l) to -1
5039 askfilehighlight $l $id
5040 + }
5041 + if {$fhighlights($l) > 0} {
5042 + set found $domore
5043 + break
5044 + }
5045 + if {$fhighlights($l) < 0} {
5046 if {$domore} {
5047 set domore 0
5048 set findcurline [expr {$l - $find_dirn}]
5049 }
5040 - } elseif {$fhighlights($l)} {
5041 - set found $domore
5042 - break
5050 }
5051 }
5052 }