[ Cc'ing git@vger, because its not that private anymore ;-) ]
On Wed, Oct 19, 2011 at 15:06, Pat Thoyts <patthoyts@users.sourceforge.net> wrote:
Show 11 quoted lines
>
> I've applied the last of your set of patches to the git-gui repository
> now. The search series with the regexp and smartcase search. I added
> themed entry fields using similar code to that I posted but also
> handling xp/vista and dealing with non-themed Tk.
>
> I had to add a trap to deal with partial regexp's. If you tried to
> enable regexp and then entered [Cc]opyrigth it would raise an error
> after opening the brace as its not a valid regexp. Handled by catching
> and returning {} which yields a pink background until the expression
> becomes valid again which I think works well.Thanks for catching this.
Show 6 quoted lines
> > As I don't like the smartcase mode I've added a commit to only enable it > if gui.search.smartcase is enabled. It looks like this was your > intention anyway but the mode was always enabled. What I don't like > about it is that you can't uncheck the Case checkbutton if there is a > capital letter in the search box.
I checked my inspiration for this, it's a patch to the NEdit editor for it's incremental searchbar, and you can't uncheck the Case checkbutton there too, if an capital letter is entered. Other smart-case implementation I know of, aren't incremental, for example less with it's -i option. So duno what should happen. It does definitive makes no sense to enter 'giT' and searching case-insensitive, in my opinion.
I also have incorporated Andrew's suggestion to reset the case flag when the user cleared the entry. Unfortunately, I can't send an updated patch currently, maybe tomorrow, here is just the commit, before fixing up the patch, which is now in your master.
commit af9e02860629f9da20a9434bfec74c115916f4e2 Author: Bert Wesarg <bert.wesarg@googlemail.com> Date: Tue Oct 18 19:43:44 2011 +0200
searchbar: reset case flag after the user cleared the text
diff --git a/lib/search.tcl b/lib/search.tcl index 58e6852..3388eb9 100644 lib/search.tcl --- a/lib/search.tcl +++ b/lib/search.tcl @@ -155,10 +155,10 @@ 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 {}} { + if {[regexp {[[:upper:]]} $searchstring]} { + set casesensitive 1 + } set here [_do_search $this anchor mlen] if {$here ne {}} { $ctext see $here @@ -169,6 +169,9 @@ method _incrsearch {} { } else { $w.ent configure -background lightpink } + } else { + # reset case sensitivity, when the user cleared the entry field + set casesensitive $default_casesensitive } } This should probably be now guarded by the new smartcase flag. On the other hand, maybe we should change the 'gui.search.smartcase' into 'gui.search.case' with 3 values case/nocase/smart? > > All pushed to master now at repo.or.cz. We should see it all end up in > 1.7.8 I reckon. But I saw that Juno has already pulled your gitgui-0.15.0 tag, which was at 843d6597 at that time, and now you moved the tag :( Bert > > Thanks, > -- > Pat Thoyts http://www.patthoyts.tk/ > PGP fingerprint 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD >