git-gui: add smart case search mode in searchbar

Setting config gui.search.smartcase to true, the search mode in the searchbar (from the blame view) is by default case-insensitive. But entering an upper case letter into the search field activates the case- sensitive search mode. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Bert Wesarg committed Oct 14, 2011 at 10:14 UTC 0a0243d7333a5c0de107170d02f667c37fb4dc54
1 file changed +12 -1
lib/search.tcl
+12 -1
@@ -7,7 +7,8 @@ field w
7 field ctext
8
9 field searchstring {}
10 -field casesensitive 1
10 +field casesensitive
11 +field default_casesensitive
12 field searchdirn -forwards
13
14 field smarktop
@@ -18,6 +19,12 @@ constructor new {i_w i_text args} {
19 set w $i_w
20 set ctext $i_text
21
22 + if {[is_config_true gui.search.smartcase]} {
23 + set default_casesensitive 0
24 + } else {
25 + set default_casesensitive 1
26 + }
27 +
28 ${NS}::frame $w
29 ${NS}::label $w.l -text [mc Find:]
30 entry $w.ent -textvariable ${__this}::searchstring -background lightgreen
@@ -45,6 +52,7 @@ constructor new {i_w i_text args} {
52 method show {} {
53 if {![visible $this]} {
54 grid $w
55 + set casesensitive $default_casesensitive
56 }
57 focus -force $w.ent
58 }
@@ -125,6 +133,9 @@ method _incrsearch {} {
133 if {[catch {$ctext index anchor}]} {
134 $ctext mark set anchor [_get_new_anchor $this]
135 }
136 + if {[regexp {[[:upper:]]} $searchstring]} {
137 + set casesensitive 1
138 + }
139 if {$searchstring ne {}} {
140 set here [_do_search $this anchor mlen]
141 if {$here ne {}} {