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

[PATCH 2/2] gitk: Highlight first search result immediately on incremental search

From
Stefan Haller <stefan@haller-berlin.de>
Date
Sep 22, 2012, 07:40 UTC
Message-ID
<1348299625-90207-3-git-send-email-stefan@haller-berlin.de>
In-Reply-To
<1348299625-90207-1-git-send-email-stefan@haller-berlin.de>

When typing in the "Search" field, select the current search result (so that it gets highlighted in orange). This makes it easier to understand what will happen if you then type Ctrl-S.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
---
 gitk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gitk b/gitk
index e2c0f1c..39c40de 100755
--- a/gitk
+++ b/gitk
@@ -8053,9 +8053,12 @@ proc incrsearch {name ix op} {
 	}
     }
     if {$searchstring ne {}} {
-	set here [$ctext search $searchdirn -- $searchstring anchor]
+	set here [$ctext search -count mlen $searchdirn -- $searchstring anchor]
 	if {$here ne {}} {
 	    $ctext see $here
+	    set mend "$here + $mlen c"
+	    $ctext tag remove sel 1.0 end
+	    $ctext tag add sel $here $mend
 	    suppress_highlighting_file_for_current_scrollpos
 	    highlightfile_for_scrollpos $here
 	}
-- 
1.7.12.1.399.gae20e0d
Previous: Stefan HallerNext: Paul Mackerras
Message 3 of 4 in “gitk: Better highlighting of search results”
  1. 0/2 gitk: Better highlighting of search resultsStefan Haller, Sep 22, 2012
  2. 1/2 gitk: Highlight current search hit in orangeStefan Haller, Sep 22, 2012
  3. 2/2 gitk: Highlight first search result immediately on incremental searchStefan Haller, Sep 22, 2012
  4. Paul MackerrasSep 23, 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.