Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14 October 2011 19:14, Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx>
> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]