{"thread":{"id":"28718","subject":"Re: git-gui: still smartcase (and pull into git.git)","startedAt":"2011-10-19T14:59:59Z","lastAt":"2011-10-21T21:41:02Z","messageCount":3,"participants":["Bert Wesarg","Pat Thoyts"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"177996","messageId":"CAKPyHN0KCwDu2-JXAEk4wAvfOqE3jHY63aG6R9YSOoLoKwWGgQ@mail.gmail.com","threadId":"28718","inReplyTo":null,"subject":"Re: git-gui: still smartcase (and pull into git.git)","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-19T14:59:59Z","receivedAt":"2011-10-19T14:59:59Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"[ Cc'ing git@vger, because its not that private anymore ;-) ]\n\nOn Wed, Oct 19, 2011 at 15:06, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n>\n> I've applied the last of your set of patches to the git-gui repository\n> now. The search series with the regexp and smartcase search. I added\n> themed entry fields using similar code to that I posted but also\n> handling xp/vista and dealing with non-themed Tk.\n>\n> I had to add a trap to deal with partial regexp's. If you tried to\n> enable regexp and then entered [Cc]opyrigth it would raise an error\n> after opening the brace as its not a valid regexp. Handled by catching\n> and returning {} which yields a pink background until the expression\n> becomes valid again which I think works well.\n\nThanks for catching this.\n\n>\n> As I don't like the smartcase mode I've added a commit to only enable it\n> if gui.search.smartcase is enabled. It looks like this was your\n> intention anyway but the mode was always enabled. What I don't like\n> about it is that you can't uncheck the Case checkbutton if there is a\n> capital letter in the search box.\n\nI checked my inspiration for this, it's a patch to the NEdit editor\nfor it's incremental searchbar, and you can't uncheck the Case\ncheckbutton there too, if an capital letter is entered. Other\nsmart-case implementation I know of, aren't incremental, for example\nless with it's -i option. So duno what should happen. It does\ndefinitive makes no sense to enter 'giT' and searching\ncase-insensitive, in my opinion.\n\nI also have incorporated Andrew's suggestion to reset the case flag\nwhen the user cleared the entry. Unfortunately, I can't send an\nupdated patch currently, maybe tomorrow, here is just the commit,\nbefore fixing up the patch, which is now in your master.\n\n commit af9e02860629f9da20a9434bfec74c115916f4e2\nAuthor: Bert Wesarg <bert.wesarg@googlemail.com>\nDate:   Tue Oct 18 19:43:44 2011 +0200\n\n    searchbar: reset case flag after the user cleared the text\n\ndiff --git a/lib/search.tcl b/lib/search.tcl\nindex 58e6852..3388eb9 100644 lib/search.tcl\n--- a/lib/search.tcl\n+++ b/lib/search.tcl\n@@ -155,10 +155,10 @@ method _incrsearch {} {\n \tif {[catch {$ctext index anchor}]} {\n \t\t$ctext mark set anchor [_get_new_anchor $this]\n \t}\n-\tif {[regexp {[[:upper:]]} $searchstring]} {\n-\t\tset casesensitive 1\n-\t}\n \tif {$searchstring ne {}} {\n+\t\tif {[regexp {[[:upper:]]} $searchstring]} {\n+\t\t\tset casesensitive 1\n+\t\t}\n \t\tset here [_do_search $this anchor mlen]\n \t\tif {$here ne {}} {\n \t\t\t$ctext see $here\n@@ -169,6 +169,9 @@ method _incrsearch {} {\n \t\t} else {\n \t\t\t$w.ent configure -background lightpink\n \t\t}\n+\t} else {\n+\t\t# reset case sensitivity, when the user cleared the entry field\n+\t\tset casesensitive $default_casesensitive\n \t}\n }\n\nThis should probably be now guarded by the new smartcase flag.\n\nOn the other hand, maybe we should change the 'gui.search.smartcase'\ninto 'gui.search.case' with 3 values case/nocase/smart?\n\n>\n> All pushed to master now at repo.or.cz. We should see it all end up in\n> 1.7.8 I reckon.\n\nBut I saw that Juno has already pulled your gitgui-0.15.0 tag, which\nwas at 843d6597 at that time, and now you moved the tag :(\n\nBert\n\n>\n> Thanks,\n> --\n> Pat Thoyts                            http://www.patthoyts.tk/\n> PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n>\n"},{"id":"178100","messageId":"9193677f1fef348d5b081653840e8a829ddd3e50.1319138692.git.bert.wesarg@googlemail.com","threadId":"28718","inReplyTo":"CAKPyHN0KCwDu2-JXAEk4wAvfOqE3jHY63aG6R9YSOoLoKwWGgQ@mail.gmail.com","subject":"[PATCH] git-gui: use a tristate to control the case mode in the searchbar","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-20T19:27:27Z","receivedAt":"2011-10-20T19:27:27Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"The config is now called gui.search.case and can have the three values:\nno/yes/smart. yes is the default.\n\nIt also resets the case detection in smart mode, when the entry field was\ncleared by the use.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/search.tcl |   24 +++++++++++++++++-------\n 1 files changed, 17 insertions(+), 7 deletions(-)\n\ndiff --git a/lib/search.tcl b/lib/search.tcl\nindex 04a316b..ef1e555 100644\n--- a/lib/search.tcl\n+++ b/lib/search.tcl\n@@ -26,11 +26,20 @@ constructor new {i_w i_text args} {\n \tset ctext  $i_text\n \n \tset default_regexpsearch [is_config_true gui.search.regexp]\n-\tset smartcase [is_config_true gui.search.smartcase]\n-\tif {$smartcase} {\n+\tswitch -- [get_config gui.search.case] {\n+\tno {\n \t\tset default_casesensitive 0\n-\t} else {\n+\t\tset smartcase 0\n+\t}\n+\tsmart {\n+\t\tset default_casesensitive 0\n+\t\tset smartcase 1\n+\t}\n+\tyes -\n+\tdefault {\n \t\tset default_casesensitive 1\n+\t\tset smartcase 0\n+\t}\n \t}\n \n \tset history [list]\n@@ -157,12 +166,10 @@ method _incrsearch {} {\n \tif {[catch {$ctext index anchor}]} {\n \t\t$ctext mark set anchor [_get_new_anchor $this]\n \t}\n-\tif {$smartcase} {\n-\t\tif {[regexp {[[:upper:]]} $searchstring]} {\n+\tif {$searchstring ne {}} {\n+\t\tif {$smartcase && [regexp {[[:upper:]]} $searchstring]} {\n \t\t\tset casesensitive 1\n \t\t}\n-\t}\n-\tif {$searchstring ne {}} {\n \t\tset here [_do_search $this anchor mlen]\n \t\tif {$here ne {}} {\n \t\t\t$ctext see $here\n@@ -175,6 +182,9 @@ method _incrsearch {} {\n \t\t\t#$w.ent configure -background lightpink\n \t\t\t$w.ent state pressed\n \t\t}\n+\t} elseif {$smartcase} {\n+\t\t# clearing the field resets the smart case detection\n+\t\tset casesensitive 0\n \t}\n }\n \n-- \n1.7.7.759.gfc8c6\n"},{"id":"178148","messageId":"87r5263tw1.fsf@fox.patthoyts.tk","threadId":"28718","inReplyTo":"9193677f1fef348d5b081653840e8a829ddd3e50.1319138692.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH] git-gui: use a tristate to control the case mode in the searchbar","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-10-21T21:41:02Z","receivedAt":"2011-10-21T21:41:02Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n>The config is now called gui.search.case and can have the three values:\n>no/yes/smart. yes is the default.\n>\n>It also resets the case detection in smart mode, when the entry field was\n>cleared by the use.\n>\n>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>---\n> lib/search.tcl |   24 +++++++++++++++++-------\n> 1 files changed, 17 insertions(+), 7 deletions(-)\n>\n>diff --git a/lib/search.tcl b/lib/search.tcl\n>index 04a316b..ef1e555 100644\n>--- a/lib/search.tcl\n>+++ b/lib/search.tcl\n>@@ -26,11 +26,20 @@ constructor new {i_w i_text args} {\n> \tset ctext  $i_text\n> \n> \tset default_regexpsearch [is_config_true gui.search.regexp]\n>-\tset smartcase [is_config_true gui.search.smartcase]\n>-\tif {$smartcase} {\n>+\tswitch -- [get_config gui.search.case] {\n>+\tno {\n> \t\tset default_casesensitive 0\n>-\t} else {\n>+\t\tset smartcase 0\n>+\t}\n>+\tsmart {\n>+\t\tset default_casesensitive 0\n>+\t\tset smartcase 1\n>+\t}\n>+\tyes -\n>+\tdefault {\n> \t\tset default_casesensitive 1\n>+\t\tset smartcase 0\n>+\t}\n> \t}\n> \n> \tset history [list]\n>@@ -157,12 +166,10 @@ method _incrsearch {} {\n> \tif {[catch {$ctext index anchor}]} {\n> \t\t$ctext mark set anchor [_get_new_anchor $this]\n> \t}\n>-\tif {$smartcase} {\n>-\t\tif {[regexp {[[:upper:]]} $searchstring]} {\n>+\tif {$searchstring ne {}} {\n>+\t\tif {$smartcase && [regexp {[[:upper:]]} $searchstring]} {\n> \t\t\tset casesensitive 1\n> \t\t}\n>-\t}\n>-\tif {$searchstring ne {}} {\n> \t\tset here [_do_search $this anchor mlen]\n> \t\tif {$here ne {}} {\n> \t\t\t$ctext see $here\n>@@ -175,6 +182,9 @@ method _incrsearch {} {\n> \t\t\t#$w.ent configure -background lightpink\n> \t\t\t$w.ent state pressed\n> \t\t}\n>+\t} elseif {$smartcase} {\n>+\t\t# clearing the field resets the smart case detection\n>+\t\tset casesensitive 0\n> \t}\n> }\n\nLook good to me. Applied.\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"}]}