gitk: Highlight first search result immediately on incremental search
[gitweb.git] / gitk
diff --git a/gitk b/gitk
index e2c0f1cc653014705fb9574b59dfeb78cfceb068..39c40deb1fd9e0616d592e011bc881c34abe9ce8 100755 (executable)
--- 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
        }