git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Ardill <andrew.ardill@gmail.com>
To: Bert Wesarg <bert.wesarg@googlemail.com>
Cc: Pat Thoyts <patthoyts@users.sourceforge.net>, git@vger.kernel.org
Subject: Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar
Date: Mon, 17 Oct 2011 09:32:00 +1100	[thread overview]
Message-ID: <CAH5451=jUS5PpMddwML36F-mH=pxxh8FsP2ZiRH2_NFBBy+Q5g@mail.gmail.com> (raw)
In-Reply-To: <9350c86dc58e6345b237de5af186718d97fdd19b.1318579823.git.bert.wesarg@googlemail.com>

On 14 October 2011 19:14, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> 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>
> ---
>  lib/search.tcl |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/lib/search.tcl b/lib/search.tcl
> index ef3486f..461c66d 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 {}} {
> --
> 1.7.6.789.gb4599
>

I don't really know tcl so I'm not certain, but it looks like you
never reset the case sensitive flag once it has been set by entering
an upper case letter. If I accidentally enter an upper case letter and
have set smartcase true, I would expect that deleting that character
would turn case sensitivity off again.

Regards,

Andrew Ardill

  parent reply	other threads:[~2011-10-16 22:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-14  8:14 [PATCH 1/4] git-gui: handle config booleans without value Bert Wesarg
2011-10-14  8:14 ` [PATCH 2/4] git-gui: add smart case search mode in searchbar Bert Wesarg
2011-10-14  8:14   ` [PATCH 3/4] git-gui: add regexp search mode to the searchbar Bert Wesarg
2011-10-14  8:14     ` [PATCH 4/4] git-gui: add search history to searchbar Bert Wesarg
2011-10-16 22:32   ` Andrew Ardill [this message]
2011-10-17  5:32     ` [PATCH 2/4] git-gui: add smart case search mode in searchbar Bert Wesarg
2011-10-17 23:29       ` Pat Thoyts
2011-10-18  3:33         ` Andrew Ardill
2011-10-17 23:13 ` [PATCH 1/4] git-gui: handle config booleans without value Pat Thoyts
2011-10-18  6:39   ` Bert Wesarg
2011-10-18  8:25     ` Pat Thoyts

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='CAH5451=jUS5PpMddwML36F-mH=pxxh8FsP2ZiRH2_NFBBy+Q5g@mail.gmail.com' \
    --to=andrew.ardill@gmail.com \
    --cc=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=patthoyts@users.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).