gitk: When searching, only highlight files when in Patch mode

This fixes another regression that was introduced in b967135 ("gitk: Synchronize highlighting in file view when scrolling diff"): when searching for a string in tree mode, jumping to the next search hit would highlight the "Comments" entry in the file list. Signed-off-by: Stefan Haller <stefan@haller-berlin.de> Signed-off-by: Paul Mackerras <paulus@samba.org>

Stefan Haller committed Oct 4, 2012 at 22:50 UTC 978904bf16600dd21888964f3d5cabf02ba39f22
1 file changed +6 -7
gitk
+6 -7
@@ -7979,8 +7979,9 @@ proc highlightfile {cline} {
7979 }
7980
7981 proc highlightfile_for_scrollpos {topidx} {
7982 - global difffilestart
7982 + global cmitmode difffilestart
7983
7984 + if {$cmitmode eq "tree"} return
7985 if {![info exists difffilestart]} return
7986
7987 set top [lindex [split $topidx .] 0]
@@ -8204,12 +8205,10 @@ proc scrolltext {f0 f1} {
8205 global searchstring cmitmode ctext
8206 global suppress_highlighting_file_for_this_scrollpos
8207
8207 - if {$cmitmode ne "tree"} {
8208 - set topidx [$ctext index @0,0]
8209 - if {![info exists suppress_highlighting_file_for_this_scrollpos]
8210 - || $topidx ne $suppress_highlighting_file_for_this_scrollpos} {
8211 - highlightfile_for_scrollpos $topidx
8212 - }
8208 + set topidx [$ctext index @0,0]
8209 + if {![info exists suppress_highlighting_file_for_this_scrollpos]
8210 + || $topidx ne $suppress_highlighting_file_for_this_scrollpos} {
8211 + highlightfile_for_scrollpos $topidx
8212 }
8213
8214 catch {unset suppress_highlighting_file_for_this_scrollpos}