{"thread":{"id":"16343","subject":"[PATCH] gitk: Highlight found text only for when search type is \"containing\".","startedAt":"2008-11-15T23:12:49Z","lastAt":"2008-11-16T00:05:53Z","messageCount":2,"participants":["Mark Burton"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"95908","messageId":"1226790769-25019-1-git-send-email-markb@ordern.com","threadId":"16343","inReplyTo":null,"subject":"[PATCH] gitk: Highlight found text only for when search type is \"containing\".","fromName":"Mark Burton","fromEmail":"markb@ordern.com","sentAt":"2008-11-15T23:12:49Z","receivedAt":"2008-11-15T23:12:49Z","isPatch":true,"sender":{"key":"markb@ordern.com","avatar":null},"body":"Highlighting the text in the commit list and comments that match the find\nstring is useful but only really when the search type is \"containing\".\n\nThis patch suppresses the highlighting for the other search types.\n\n\nSigned-off-by: Mark Burton <markb@ordern.com>\n---\n gitk-git/gitk |    9 ++++++---\n 1 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 3353f4a..dea8bc8 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -4302,6 +4302,7 @@ proc askfindhighlight {row id} {\n     global nhighlights commitinfo iddrawn\n     global findloc\n     global markingmatches\n+    global gdttype\n \n     if {![info exists commitinfo($id)]} {\n \tgetcommit $id\n@@ -4326,7 +4327,7 @@ proc askfindhighlight {row id} {\n \t\tbolden_name $row mainfontbold\n \t    }\n \t}\n-\tif {$markingmatches} {\n+\tif {$markingmatches && $gdttype eq [mc \"containing:\"]} {\n \t    markrowmatches $row $id\n \t}\n     }\n@@ -5565,6 +5566,7 @@ proc drawcmitrow {row} {\n     global filehighlight fhighlights findpattern nhighlights\n     global hlview vhighlights\n     global highlight_related rhighlights\n+    global gdttype\n \n     if {$row >= $numcommits} return\n \n@@ -5595,7 +5597,7 @@ proc drawcmitrow {row} {\n \tset iddrawn($id) 1\n \tincr nrows_drawn\n     }\n-    if {$markingmatches} {\n+    if {$markingmatches && $gdttype eq [mc \"containing:\"]} {\n \tmarkrowmatches $row $id\n     }\n }\n@@ -6227,7 +6229,8 @@ proc findselectline {l} {\n     set markingmatches 1\n     set findcurline $l\n     selectline $l 1\n-    if {$findloc == [mc \"All fields\"] || $findloc == [mc \"Comments\"]} {\n+    if {$gdttype eq [mc \"containing:\"] &&\n+\t($findloc == [mc \"All fields\"] || $findloc == [mc \"Comments\"])} {\n \t# highlight the matches in the comments\n \tset f [$ctext get 1.0 $commentend]\n \tset matches [findmatches $f]\n-- \n1.6.0.4\n"},{"id":"95914","messageId":"20081116000553.3d04b513@crow","threadId":"16343","inReplyTo":"1226790769-25019-1-git-send-email-markb@ordern.com","subject":"Re: [PATCH] gitk: Highlight found text only for when search type is \"containing\".","fromName":"Mark Burton","fromEmail":"markb@ordern.com","sentAt":"2008-11-16T00:05:53Z","receivedAt":"2008-11-16T00:05:53Z","isPatch":true,"sender":{"key":"markb@ordern.com","avatar":null},"body":"\nHi,\n\nThe patch got sent without this blurb (not really sure how to send\npatches to the list with leading blurb).\n\nAnyway, I thought I would try and stop gitk from always highlighting\nthe text in the commit and comment panes that matches the text in the\nsearch field. To me, it only makes sense to highlight the text when the\nsearch type is \"containing\". For the other search types (definitely\nfor the touching paths type), I don't really see how having occurrences\nof the search text highlighted helps.\n\nI don't really understand how gitk operates but the patch does what I\nwant. I'm sure those in the know can improve on it if what it does is\nuseful.\n\nCheers,\n\nMark\n"}]}