git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] gitk: When searching, only highlight files when in Patch mode

From
Stefan Haller <stefan@haller-berlin.de>
Date
Oct 4, 2012, 20:50 UTC
Message-ID
<1349383817-14457-3-git-send-email-stefan@haller-berlin.de>
In-Reply-To
<1349383817-14457-1-git-send-email-stefan@haller-berlin.de>

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>
---
 gitk | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/gitk b/gitk
index 8935284..0ee5585 100755
--- a/gitk
+++ b/gitk
@@ -7967,8 +7967,9 @@ proc highlightfile {cline} {
 }
 
 proc highlightfile_for_scrollpos {topidx} {
-    global difffilestart
+    global cmitmode difffilestart
 
+    if {$cmitmode eq "tree"} return
     if {![info exists difffilestart]} return
 
     set top [lindex [split $topidx .] 0]
@@ -8192,12 +8193,10 @@ proc scrolltext {f0 f1} {
     global searchstring cmitmode ctext
     global suppress_highlighting_file_for_this_scrollpos
 
-    if {$cmitmode ne "tree"} {
-	set topidx [$ctext index @0,0]
-	if {![info exists suppress_highlighting_file_for_this_scrollpos]
-	    || $topidx ne $suppress_highlighting_file_for_this_scrollpos} {
-	    highlightfile_for_scrollpos $topidx
-	}
+    set topidx [$ctext index @0,0]
+    if {![info exists suppress_highlighting_file_for_this_scrollpos]
+	|| $topidx ne $suppress_highlighting_file_for_this_scrollpos} {
+	highlightfile_for_scrollpos $topidx
     }
 
     catch {unset suppress_highlighting_file_for_this_scrollpos}
-- 
1.8.0.rc0.36.gef0f079
Previous: Stefan HallerNext: Paul Mackerras
Message 4 of 5 in “[BUG] gitk: clicking on a connecting line produces can't read "cflist_top"”
  1. Johannes SixtOct 1, 2012
  2. Stefan HallerOct 4, 2012
  3. 1/2 gitk: Fix error message when clicking on a connecting lineStefan Haller, Oct 4, 2012
  4. 2/2 gitk: When searching, only highlight files when in Patch modeStefan Haller, Oct 4, 2012
  5. Paul MackerrasOct 21, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.