From: Pat Thoyts <patthoyts@users.sourceforge.net>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: Andrew Ardill <andrew.ardill@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] git-gui: use a tristate to control the case mode in the searchbar
Date: Fri, 21 Oct 2011 22:41:02 +0100 [thread overview]
Message-ID: <87r5263tw1.fsf@fox.patthoyts.tk> (raw)
In-Reply-To: <9193677f1fef348d5b081653840e8a829ddd3e50.1319138692.git.bert.wesarg@googlemail.com> (Bert Wesarg's message of "Thu, 20 Oct 2011 21:27:27 +0200")
Bert Wesarg <bert.wesarg@googlemail.com> writes:
>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>
>---
> lib/search.tcl | 24 +++++++++++++++++-------
> 1 files changed, 17 insertions(+), 7 deletions(-)
>
>diff --git a/lib/search.tcl b/lib/search.tcl
>index 04a316b..ef1e555 100644
>--- 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 smartcase [is_config_true gui.search.smartcase]
>- if {$smartcase} {
>+ switch -- [get_config gui.search.case] {
>+ no {
> set default_casesensitive 0
>- } else {
>+ set smartcase 0
>+ }
>+ smart {
>+ set default_casesensitive 0
>+ set smartcase 1
>+ }
>+ yes -
>+ default {
> set default_casesensitive 1
>+ set smartcase 0
>+ }
> }
>
> set history [list]
>@@ -157,12 +166,10 @@ method _incrsearch {} {
> if {[catch {$ctext index anchor}]} {
> $ctext mark set anchor [_get_new_anchor $this]
> }
>- if {$smartcase} {
>- if {[regexp {[[:upper:]]} $searchstring]} {
>+ if {$searchstring ne {}} {
>+ if {$smartcase && [regexp {[[:upper:]]} $searchstring]} {
> set casesensitive 1
> }
>- }
>- if {$searchstring ne {}} {
> 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
> }
>+ } elseif {$smartcase} {
>+ # clearing the field resets the smart case detection
>+ set casesensitive 0
> }
> }
Look good to me. Applied.
--
Pat Thoyts http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
prev parent reply other threads:[~2011-10-21 21:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-19 14:59 git-gui: still smartcase (and pull into git.git) Bert Wesarg
2011-10-20 19:27 ` [PATCH] git-gui: use a tristate to control the case mode in the searchbar Bert Wesarg
2011-10-21 21:41 ` Pat Thoyts [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r5263tw1.fsf@fox.patthoyts.tk \
--to=patthoyts@users.sourceforge.net \
--cc=andrew.ardill@gmail.com \
--cc=bert.wesarg@googlemail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox