git-gui: enable the smart case sensitive search only if gui.search.smartcase is true

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
This commit is contained in:
Pat Thoyts 2011-10-19 13:29:52 +01:00
parent b66f4f7aa7
commit 8eaf24b93b

View File

@ -11,6 +11,7 @@ field regexpsearch
field default_regexpsearch field default_regexpsearch
field casesensitive field casesensitive
field default_casesensitive field default_casesensitive
field smartcase
field searchdirn -forwards field searchdirn -forwards
field history field history
@ -25,7 +26,8 @@ constructor new {i_w i_text args} {
set ctext $i_text set ctext $i_text
set default_regexpsearch [is_config_true gui.search.regexp] set default_regexpsearch [is_config_true gui.search.regexp]
if {[is_config_true gui.search.smartcase]} { set smartcase [is_config_true gui.search.smartcase]
if {$smartcase} {
set default_casesensitive 0 set default_casesensitive 0
} else { } else {
set default_casesensitive 1 set default_casesensitive 1
@ -155,9 +157,11 @@ method _incrsearch {} {
if {[catch {$ctext index anchor}]} { if {[catch {$ctext index anchor}]} {
$ctext mark set anchor [_get_new_anchor $this] $ctext mark set anchor [_get_new_anchor $this]
} }
if {$smartcase} {
if {[regexp {[[:upper:]]} $searchstring]} { if {[regexp {[[:upper:]]} $searchstring]} {
set casesensitive 1 set casesensitive 1
} }
}
if {$searchstring ne {}} { if {$searchstring ne {}} {
set here [_do_search $this anchor mlen] set here [_do_search $this anchor mlen]
if {$here ne {}} { if {$here ne {}} {