Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
git-gui: use a tristate to control the case mode in the searchbar
author
Bert Wesarg
<bert.wesarg@googlemail.com>
Thu, 20 Oct 2011 19:27:27 +0000
(21:27 +0200)
committer
Pat Thoyts
<patthoyts@users.sourceforge.net>
Fri, 21 Oct 2011 21:28:23 +0000
(22:28 +0100)
The config is now called gui.search.case and can have the three values:
no/yes/smart. yes is the default.
It also resets the case detection in smart mode, when the entry field was
cleared by the use.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
lib/search.tcl
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
508dee3
)
diff --git
a/lib/search.tcl
b/lib/search.tcl
index 04a316bbb27897ebd2247934db03c978988d0487..ef1e55521d7cea10e280f720ad700a4cd4b71d65 100644
(file)
--- a/
lib/search.tcl
+++ b/
lib/search.tcl
@@
-26,11
+26,20
@@
constructor new {i_w i_text args} {
set ctext $i_text
set default_regexpsearch [is_config_true gui.search.regexp]
set ctext $i_text
set default_regexpsearch [is_config_true gui.search.regexp]
- s
et smartcase [is_config_true gui.search.smartcase]
-
if {$smartcase}
{
+ s
witch -- [get_config gui.search.case] {
+
no
{
set default_casesensitive 0
set default_casesensitive 0
- } else {
+ set smartcase 0
+ }
+ smart {
+ set default_casesensitive 0
+ set smartcase 1
+ }
+ yes -
+ default {
set default_casesensitive 1
set default_casesensitive 1
+ set smartcase 0
+ }
}
set history [list]
}
set history [list]
@@
-157,12
+166,10
@@
method _incrsearch {} {
if {[catch {$ctext index anchor}]} {
$ctext mark set anchor [_get_new_anchor $this]
}
if {[catch {$ctext index anchor}]} {
$ctext mark set anchor [_get_new_anchor $this]
}
- if {$s
martcase
} {
- if {[regexp {[[:upper:]]} $searchstring]} {
+ if {$s
earchstring ne {}
} {
+ if {
$smartcase &&
[regexp {[[:upper:]]} $searchstring]} {
set casesensitive 1
}
set casesensitive 1
}
- }
- if {$searchstring ne {}} {
set here [_do_search $this anchor mlen]
if {$here ne {}} {
$ctext see $here
set here [_do_search $this anchor mlen]
if {$here ne {}} {
$ctext see $here
@@
-175,6
+182,9
@@
method _incrsearch {} {
#$w.ent configure -background lightpink
$w.ent state pressed
}
#$w.ent configure -background lightpink
$w.ent state pressed
}
+ } elseif {$smartcase} {
+ # clearing the field resets the smart case detection
+ set casesensitive 0
}
}
}
}