summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert Wesarg <bert.wesarg@googlemail.com>2011-10-14 10:14:50 +0200
committerPat Thoyts <patthoyts@users.sourceforge.net>2011-10-18 09:27:28 +0100
commit0a0243d7333a5c0de107170d02f667c37fb4dc54 (patch)
treebe1f1d975b06a7654abb131266cb60d707c2e70f
parent12b219f7f95f2d089e49140dcb1c2dd6259ff5cf (diff)
downloadgit-0a0243d7333a5c0de107170d02f667c37fb4dc54.tar.gz
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>
-rw-r--r--lib/search.tcl13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/search.tcl b/lib/search.tcl
index ef3486f083..461c66d1a0 100644
--- a/lib/search.tcl
+++ b/lib/search.tcl
@@ -7,7 +7,8 @@ field w
field ctext
field searchstring {}
-field casesensitive 1
+field casesensitive
+field default_casesensitive
field searchdirn -forwards
field smarktop
@@ -18,6 +19,12 @@ constructor new {i_w i_text args} {
set w $i_w
set ctext $i_text
+ if {[is_config_true gui.search.smartcase]} {
+ set default_casesensitive 0
+ } else {
+ set default_casesensitive 1
+ }
+
${NS}::frame $w
${NS}::label $w.l -text [mc Find:]
entry $w.ent -textvariable ${__this}::searchstring -background lightgreen
@@ -45,6 +52,7 @@ constructor new {i_w i_text args} {
method show {} {
if {![visible $this]} {
grid $w
+ set casesensitive $default_casesensitive
}
focus -force $w.ent
}
@@ -125,6 +133,9 @@ method _incrsearch {} {
if {[catch {$ctext index anchor}]} {
$ctext mark set anchor [_get_new_anchor $this]
}
+ if {[regexp {[[:upper:]]} $searchstring]} {
+ set casesensitive 1
+ }
if {$searchstring ne {}} {
set here [_do_search $this anchor mlen]
if {$here ne {}} {