{"thread":{"id":"28672","subject":"[PATCH 1/4] git-gui: handle config booleans without value","startedAt":"2011-10-14T08:14:49Z","lastAt":"2011-10-18T08:25:04Z","messageCount":11,"participants":["Bert Wesarg","Andrew Ardill","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"177623","messageId":"94b050c4cf7ae8df8d79112e13613244ebff4037.1318579823.git.bert.wesarg@googlemail.com","threadId":"28672","inReplyTo":null,"subject":"[PATCH 1/4] git-gui: handle config booleans without value","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-14T08:14:49Z","receivedAt":"2011-10-14T08:14:49Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"When git interprets a config variable without a value as bool it is considered\nas true. But git-gui doesn't so until yet.\n\nThe value for boolean configs are also case-insensitive.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n git-gui.sh |   16 ++++++++++++++--\n 1 files changed, 14 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex f897160..d687871 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -299,7 +299,9 @@ proc is_config_true {name} {\n \tglobal repo_config\n \tif {[catch {set v $repo_config($name)}]} {\n \t\treturn 0\n-\t} elseif {$v eq {true} || $v eq {1} || $v eq {yes}} {\n+\t}\n+\tset v [string tolower $v]\n+\tif {$v eq {} || $v eq {true} || $v eq {1} || $v eq {yes} || $v eq {on}} {\n \t\treturn 1\n \t} else {\n \t\treturn 0\n@@ -310,7 +312,9 @@ proc is_config_false {name} {\n \tglobal repo_config\n \tif {[catch {set v $repo_config($name)}]} {\n \t\treturn 0\n-\t} elseif {$v eq {false} || $v eq {0} || $v eq {no}} {\n+\t}\n+\tset v [string tolower $v]\n+\tif {$v eq {false} || $v eq {0} || $v eq {no} || $v eq {off}} {\n \t\treturn 1\n \t} else {\n \t\treturn 0\n@@ -1060,6 +1064,10 @@ git-version proc _parse_config {arr_name args} {\n \t\t\t\t} else {\n \t\t\t\t\tset arr($name) $value\n \t\t\t\t}\n+\t\t\t} elseif {[regexp {^([^\\n]+)$} $line line name]} {\n+\t\t\t\t# no value given, but interpreting them as\n+\t\t\t\t# boolean will be handled as true\n+\t\t\t\tset arr($name) {}\n \t\t\t}\n \t\t}\n \t}\n@@ -1075,6 +1083,10 @@ git-version proc _parse_config {arr_name args} {\n \t\t\t\t\t} else {\n \t\t\t\t\t\tset arr($name) $value\n \t\t\t\t\t}\n+\t\t\t\t} elseif {[regexp {^([^=]+)$} $line line name]} {\n+\t\t\t\t\t# no value given, but interpreting them as\n+\t\t\t\t\t# boolean will be handled as true\n+\t\t\t\t\tset arr($name) {}\n \t\t\t\t}\n \t\t\t}\n \t\t\tclose $fd_rc\n-- \n1.7.6.789.gb4599\n"},{"id":"177624","messageId":"9350c86dc58e6345b237de5af186718d97fdd19b.1318579823.git.bert.wesarg@googlemail.com","threadId":"28672","inReplyTo":"94b050c4cf7ae8df8d79112e13613244ebff4037.1318579823.git.bert.wesarg@googlemail.com","subject":"[PATCH 2/4] git-gui: add smart case search mode in searchbar","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-14T08:14:50Z","receivedAt":"2011-10-14T08:14:50Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Setting config gui.search.smartcase to true, the search mode in the\nsearchbar (from the blame view) is by default case-insensitive. But\nentering an upper case letter into the search field activates the case-\nsensitive search mode.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/search.tcl |   13 ++++++++++++-\n 1 files changed, 12 insertions(+), 1 deletions(-)\n\ndiff --git a/lib/search.tcl b/lib/search.tcl\nindex ef3486f..461c66d 100644\n--- a/lib/search.tcl\n+++ b/lib/search.tcl\n@@ -7,7 +7,8 @@ field w\n field ctext\n \n field searchstring   {}\n-field casesensitive  1\n+field casesensitive\n+field default_casesensitive\n field searchdirn     -forwards\n \n field smarktop\n@@ -18,6 +19,12 @@ constructor new {i_w i_text args} {\n \tset w      $i_w\n \tset ctext  $i_text\n \n+\tif {[is_config_true gui.search.smartcase]} {\n+\t\tset default_casesensitive 0\n+\t} else {\n+\t\tset default_casesensitive 1\n+\t}\n+\n \t${NS}::frame  $w\n \t${NS}::label  $w.l       -text [mc Find:]\n \tentry  $w.ent -textvariable ${__this}::searchstring -background lightgreen\n@@ -45,6 +52,7 @@ constructor new {i_w i_text args} {\n method show {} {\n \tif {![visible $this]} {\n \t\tgrid $w\n+\t\tset casesensitive $default_casesensitive\n \t}\n \tfocus -force $w.ent\n }\n@@ -125,6 +133,9 @@ 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\tset here [_do_search $this anchor mlen]\n \t\tif {$here ne {}} {\n-- \n1.7.6.789.gb4599\n"},{"id":"177625","messageId":"a93e3d17587afbaef299b2d497ec3c3a037f4101.1318579823.git.bert.wesarg@googlemail.com","threadId":"28672","inReplyTo":"9350c86dc58e6345b237de5af186718d97fdd19b.1318579823.git.bert.wesarg@googlemail.com","subject":"[PATCH 3/4] git-gui: add regexp search mode to the searchbar","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-14T08:14:51Z","receivedAt":"2011-10-14T08:14:51Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"It's off by default, but can be enabled via the config gui.search.regexp.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/search.tcl |   12 +++++++++++-\n 1 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/lib/search.tcl b/lib/search.tcl\nindex 461c66d..9268ec3 100644\n--- a/lib/search.tcl\n+++ b/lib/search.tcl\n@@ -7,6 +7,8 @@ field w\n field ctext\n \n field searchstring   {}\n+field regexpsearch\n+field default_regexpsearch\n field casesensitive\n field default_casesensitive\n field searchdirn     -forwards\n@@ -19,6 +21,7 @@ constructor new {i_w i_text args} {\n \tset w      $i_w\n \tset ctext  $i_text\n \n+\tset default_regexpsearch [is_config_true gui.search.regexp]\n \tif {[is_config_true gui.search.smartcase]} {\n \t\tset default_casesensitive 0\n \t} else {\n@@ -30,10 +33,13 @@ constructor new {i_w i_text args} {\n \tentry  $w.ent -textvariable ${__this}::searchstring -background lightgreen\n \t${NS}::button $w.bn      -text [mc Next] -command [cb find_next]\n \t${NS}::button $w.bp      -text [mc Prev] -command [cb find_prev]\n-\t${NS}::checkbutton $w.cs -text [mc Case-Sensitive] \\\n+\t${NS}::checkbutton $w.re -text [mc RegExp] \\\n+\t\t-variable ${__this}::regexpsearch -command [cb _incrsearch]\n+\t${NS}::checkbutton $w.cs -text [mc Case] \\\n \t\t-variable ${__this}::casesensitive -command [cb _incrsearch]\n \tpack   $w.l   -side left\n \tpack   $w.cs  -side right\n+\tpack   $w.re  -side right\n \tpack   $w.bp  -side right\n \tpack   $w.bn  -side right\n \tpack   $w.ent -side left -expand 1 -fill x\n@@ -52,6 +58,7 @@ constructor new {i_w i_text args} {\n method show {} {\n \tif {![visible $this]} {\n \t\tgrid $w\n+\t\tset regexpsearch  $default_regexpsearch\n \t\tset casesensitive $default_casesensitive\n \t}\n \tfocus -force $w.ent\n@@ -106,6 +113,9 @@ method _do_search {start {mlenvar {}} {dir {}} {endbound {}}} {\n \t\tupvar $mlenvar mlen\n \t\tlappend cmd -count mlen\n \t}\n+\tif {$regexpsearch} {\n+\t\tlappend cmd -regexp\n+\t}\n \tif {!$casesensitive} {\n \t\tlappend cmd -nocase\n \t}\n-- \n1.7.6.789.gb4599\n"},{"id":"177626","messageId":"7c2c9ba170f22b6693c33ae888b14f4065b6e3d7.1318579823.git.bert.wesarg@googlemail.com","threadId":"28672","inReplyTo":"a93e3d17587afbaef299b2d497ec3c3a037f4101.1318579823.git.bert.wesarg@googlemail.com","subject":"[PATCH 4/4] git-gui: add search history to searchbar","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-14T08:14:52Z","receivedAt":"2011-10-14T08:14:52Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Use the up/down keys to browse the history.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n lib/search.tcl |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 60 insertions(+), 0 deletions(-)\n\ndiff --git a/lib/search.tcl b/lib/search.tcl\nindex 9268ec3..15f99d8 100644\n--- a/lib/search.tcl\n+++ b/lib/search.tcl\n@@ -13,6 +13,9 @@ field casesensitive\n field default_casesensitive\n field searchdirn     -forwards\n \n+field history\n+field history_index\n+\n field smarktop\n field smarkbot\n \n@@ -28,6 +31,8 @@ constructor new {i_w i_text args} {\n \t\tset default_casesensitive 1\n \t}\n \n+\tset history [list]\n+\n \t${NS}::frame  $w\n \t${NS}::label  $w.l       -text [mc Find:]\n \tentry  $w.ent -textvariable ${__this}::searchstring -background lightgreen\n@@ -50,6 +55,8 @@ constructor new {i_w i_text args} {\n \ttrace add variable searchstring write [cb _incrsearch_cb]\n \tbind $w.ent <Return> [cb find_next]\n \tbind $w.ent <Shift-Return> [cb find_prev]\n+\tbind $w.ent <Key-Up>   [cb _prev_search]\n+\tbind $w.ent <Key-Down> [cb _next_search]\n \t\n \tbind $w <Destroy> [list delete_this $this]\n \treturn $this\n@@ -58,8 +65,10 @@ constructor new {i_w i_text args} {\n method show {} {\n \tif {![visible $this]} {\n \t\tgrid $w\n+\t\t$w.ent delete 0 end\n \t\tset regexpsearch  $default_regexpsearch\n \t\tset casesensitive $default_casesensitive\n+\t\tset history_index [llength $history]\n \t}\n \tfocus -force $w.ent\n }\n@@ -68,6 +77,7 @@ method hide {} {\n \tif {[visible $this]} {\n \t\tfocus $ctext\n \t\tgrid remove $w\n+\t\t_save_search $this\n \t}\n }\n \n@@ -160,6 +170,55 @@ method _incrsearch {} {\n \t}\n }\n \n+method _save_search {} {\n+\tif {$searchstring eq {}} {\n+\t\treturn\n+\t}\n+\tif {[llength $history] > 0} {\n+\t\tforeach {s_regexp s_case s_expr} [lindex $history end] break\n+\t} else {\n+\t\tset s_regexp $regexpsearch\n+\t\tset s_case   $casesensitive\n+\t\tset s_expr   \"\"\n+\t}\n+\tif {$searchstring eq $s_expr} {\n+\t\t# update modes\n+\t\tset history [lreplace $history end end \\\n+\t\t\t\t[list $regexpsearch $casesensitive $searchstring]]\n+\t} else {\n+\t\tlappend history [list $regexpsearch $casesensitive $searchstring]\n+\t}\n+\tset history_index [llength $history]\n+}\n+\n+method _prev_search {} {\n+\tif {$history_index > 0} {\n+\t\tincr history_index -1\n+\t\tforeach {s_regexp s_case s_expr} [lindex $history $history_index] break\n+\t\t$w.ent delete 0 end\n+\t\t$w.ent insert 0 $s_expr\n+\t\tset regexpsearch $s_regexp\n+\t\tset casesensitive $s_case\n+\t}\n+}\n+\n+method _next_search {} {\n+\tif {$history_index < [llength $history]} {\n+\t\tincr history_index\n+\t}\n+\tif {$history_index < [llength $history]} {\n+\t\tforeach {s_regexp s_case s_expr} [lindex $history $history_index] break\n+\t} else {\n+\t\tset s_regexp $default_regexpsearch\n+\t\tset s_case   $default_casesensitive\n+\t\tset s_expr   \"\"\n+\t}\n+\t$w.ent delete 0 end\n+\t$w.ent insert 0 $s_expr\n+\tset regexpsearch $s_regexp\n+\tset casesensitive $s_case\n+}\n+\n method find_prev {} {\n \tfind_next $this -backwards\n }\n@@ -170,6 +229,7 @@ method find_next {{dir -forwards}} {\n \tset searchdirn $dir\n \t$ctext mark unset anchor\n \tif {$searchstring ne {}} {\n+\t\t_save_search $this\n \t\tset start [_get_new_anchor $this]\n \t\tif {$dir eq \"-forwards\"} {\n \t\t\tset start \"$start + 1c\"\n-- \n1.7.6.789.gb4599\n"},{"id":"177807","messageId":"CAH5451=jUS5PpMddwML36F-mH=pxxh8FsP2ZiRH2_NFBBy+Q5g@mail.gmail.com","threadId":"28672","inReplyTo":"9350c86dc58e6345b237de5af186718d97fdd19b.1318579823.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2011-10-16T22:32:00Z","receivedAt":"2011-10-16T22:32:00Z","isPatch":true,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"On 14 October 2011 19:14, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> Setting config gui.search.smartcase to true, the search mode in the\n> searchbar (from the blame view) is by default case-insensitive. But\n> entering an upper case letter into the search field activates the case-\n> sensitive search mode.\n>\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> ---\n>  lib/search.tcl |   13 ++++++++++++-\n>  1 files changed, 12 insertions(+), 1 deletions(-)\n>\n> diff --git a/lib/search.tcl b/lib/search.tcl\n> index ef3486f..461c66d 100644\n> --- a/lib/search.tcl\n> +++ b/lib/search.tcl\n> @@ -7,7 +7,8 @@ field w\n>  field ctext\n>\n>  field searchstring   {}\n> -field casesensitive  1\n> +field casesensitive\n> +field default_casesensitive\n>  field searchdirn     -forwards\n>\n>  field smarktop\n> @@ -18,6 +19,12 @@ constructor new {i_w i_text args} {\n>        set w      $i_w\n>        set ctext  $i_text\n>\n> +       if {[is_config_true gui.search.smartcase]} {\n> +               set default_casesensitive 0\n> +       } else {\n> +               set default_casesensitive 1\n> +       }\n> +\n>        ${NS}::frame  $w\n>        ${NS}::label  $w.l       -text [mc Find:]\n>        entry  $w.ent -textvariable ${__this}::searchstring -background lightgreen\n> @@ -45,6 +52,7 @@ constructor new {i_w i_text args} {\n>  method show {} {\n>        if {![visible $this]} {\n>                grid $w\n> +               set casesensitive $default_casesensitive\n>        }\n>        focus -force $w.ent\n>  }\n> @@ -125,6 +133,9 @@ method _incrsearch {} {\n>        if {[catch {$ctext index anchor}]} {\n>                $ctext mark set anchor [_get_new_anchor $this]\n>        }\n> +       if {[regexp {[[:upper:]]} $searchstring]} {\n> +               set casesensitive 1\n> +       }\n>        if {$searchstring ne {}} {\n>                set here [_do_search $this anchor mlen]\n>                if {$here ne {}} {\n> --\n> 1.7.6.789.gb4599\n>\n\nI don't really know tcl so I'm not certain, but it looks like you\nnever reset the case sensitive flag once it has been set by entering\nan upper case letter. If I accidentally enter an upper case letter and\nhave set smartcase true, I would expect that deleting that character\nwould turn case sensitivity off again.\n\nRegards,\n\nAndrew Ardill\n"},{"id":"177833","messageId":"CAKPyHN2XQYrGDhfjX4G12Ggw6DuJasuYbLQvfbmikBbMezp4=g@mail.gmail.com","threadId":"28672","inReplyTo":"CAH5451=jUS5PpMddwML36F-mH=pxxh8FsP2ZiRH2_NFBBy+Q5g@mail.gmail.com","subject":"Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-17T05:32:29Z","receivedAt":"2011-10-17T05:32:29Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Mon, Oct 17, 2011 at 00:32, Andrew Ardill <andrew.ardill@gmail.com> wrote:\n> I don't really know tcl so I'm not certain, but it looks like you\n> never reset the case sensitive flag once it has been set by entering\n> an upper case letter. If I accidentally enter an upper case letter and\n> have set smartcase true, I would expect that deleting that character\n> would turn case sensitivity off again.\n>\n\nI never reset it, because your case is a way to search case-sensitive\nfor an expression in all lower-case. For example, if you would like to\nsearch for 'git' case-sensitively, you would type: 'gitA^H'. A direct\nshortcut to toggle the case flag could also be of use. The other idea\nwhich come to mind, is to reset the case flag, if you clear the input\nfield. I.e. type 'G^Hgit' would still seach case-insensitive.\n\nBert\n\n> Regards,\n>\n> Andrew Ardill\n>\n"},{"id":"177907","messageId":"87mxczgqiw.fsf@fox.patthoyts.tk","threadId":"28672","inReplyTo":"94b050c4cf7ae8df8d79112e13613244ebff4037.1318579823.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH 1/4] git-gui: handle config booleans without value","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-10-17T23:13:59Z","receivedAt":"2011-10-17T23:13:59Z","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>When git interprets a config variable without a value as bool it is considered\n>as true. But git-gui doesn't so until yet.\n>\n>The value for boolean configs are also case-insensitive.\n>\n>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>---\n> git-gui.sh |   16 ++++++++++++++--\n> 1 files changed, 14 insertions(+), 2 deletions(-)\n>\n>diff --git a/git-gui.sh b/git-gui.sh\n>index f897160..d687871 100755\n>--- a/git-gui.sh\n>+++ b/git-gui.sh\n>@@ -299,7 +299,9 @@ proc is_config_true {name} {\n> \tglobal repo_config\n> \tif {[catch {set v $repo_config($name)}]} {\n> \t\treturn 0\n>-\t} elseif {$v eq {true} || $v eq {1} || $v eq {yes}} {\n>+\t}\n>+\tset v [string tolower $v]\n>+\tif {$v eq {} || $v eq {true} || $v eq {1} || $v eq {yes} || $v eq {on}} {\n> \t\treturn 1\n> \t} else {\n> \t\treturn 0\n\nThis looks ok - we actually have a [string is boolean $v] test we could\nuse eg:\n  if {[string is boolean $v]} {\n    return [expr {$v eq {} ? 1 : !!$v}]\n  }\nalthough I'm not sure it gains us much. This would match everything Tcl\nbelieves to be a boolean - yes/no, on/off, true/false and 1/0. Without\n-strict the [string is] test will consider {} to be a boolean.\n\n\n>@@ -310,7 +312,9 @@ proc is_config_false {name} {\n> \tglobal repo_config\n> \tif {[catch {set v $repo_config($name)}]} {\n> \t\treturn 0\n>-\t} elseif {$v eq {false} || $v eq {0} || $v eq {no}} {\n>+\t}\n>+\tset v [string tolower $v]\n>+\tif {$v eq {false} || $v eq {0} || $v eq {no} || $v eq {off}} {\n> \t\treturn 1\n> \t} else {\n> \t\treturn 0\n>@@ -1060,6 +1064,10 @@ git-version proc _parse_config {arr_name args} {\n> \t\t\t\t} else {\n> \t\t\t\t\tset arr($name) $value\n> \t\t\t\t}\n>+\t\t\t} elseif {[regexp {^([^\\n]+)$} $line line name]} {\n>+\t\t\t\t# no value given, but interpreting them as\n>+\t\t\t\t# boolean will be handled as true\n>+\t\t\t\tset arr($name) {}\n> \t\t\t}\n> \t\t}\n> \t}\n>@@ -1075,6 +1083,10 @@ git-version proc _parse_config {arr_name args} {\n> \t\t\t\t\t} else {\n> \t\t\t\t\t\tset arr($name) $value\n> \t\t\t\t\t}\n>+\t\t\t\t} elseif {[regexp {^([^=]+)$} $line line name]} {\n>+\t\t\t\t\t# no value given, but interpreting them as\n>+\t\t\t\t\t# boolean will be handled as true\n>+\t\t\t\t\tset arr($name) {}\n> \t\t\t\t}\n> \t\t\t}\n> \t\t\tclose $fd_rc\n\nIs this really how git treats boolean config values? I can't seem to\ndemonstrate that to myself:\npat@frog:/opt/src/git-gui$ git config --unset core.xyzzy\npat@frog:/opt/src/git-gui$ git config --bool --get core.xyzzy\npat@frog:/opt/src/git-gui$ git config --bool core.xyzzy 1\npat@frog:/opt/src/git-gui$ git config --bool --get core.xyzzy\ntrue\n\nI assume I'm using the wrong test for this.\n\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"},{"id":"177911","messageId":"87ipnngpsj.fsf@fox.patthoyts.tk","threadId":"28672","inReplyTo":"CAKPyHN2XQYrGDhfjX4G12Ggw6DuJasuYbLQvfbmikBbMezp4=g@mail.gmail.com","subject":"Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-10-17T23:29:48Z","receivedAt":"2011-10-17T23:29:48Z","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>On Mon, Oct 17, 2011 at 00:32, Andrew Ardill <andrew.ardill@gmail.com> wrote:\n>> I don't really know tcl so I'm not certain, but it looks like you\n>> never reset the case sensitive flag once it has been set by entering\n>> an upper case letter. If I accidentally enter an upper case letter and\n>> have set smartcase true, I would expect that deleting that character\n>> would turn case sensitivity off again.\n>>\n>\n>I never reset it, because your case is a way to search case-sensitive\n>for an expression in all lower-case. For example, if you would like to\n>search for 'git' case-sensitively, you would type: 'gitA^H'. A direct\n>shortcut to toggle the case flag could also be of use. The other idea\n>which come to mind, is to reset the case flag, if you clear the input\n>field. I.e. type 'G^Hgit' would still seach case-insensitive.\n>\n>Bert\n\nI don't really like the way it works at the moment. It seems very keen\nto enable the case sensitive mode and you must use the mouse to disable\nthat. I see why you chose to make it work that way though. I think\nresetting it in clearing the field makes sense.\n\nThe rest of the series looks good. The history recording is nice to have.\n\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"},{"id":"177914","messageId":"CAH5451n6pj9ybHSo=OLAw0wMLwqT_bCB76L8Jw3Cz6MP99y59A@mail.gmail.com","threadId":"28672","inReplyTo":"87ipnngpsj.fsf@fox.patthoyts.tk","subject":"Re: [PATCH 2/4] git-gui: add smart case search mode in searchbar","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2011-10-18T03:33:04Z","receivedAt":"2011-10-18T03:33:04Z","isPatch":true,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"I agree that clearing the field to reset case sensitivity is a nice\ncompromise between easily turning smartcase off (by typing a capital)\nand easily turning it on again if you accidentally turned it off, or\ndecided you don't want it on.\n\nIn most cases you would think an accidental capital would be the first\nletter typed anyhow.\n\nRegards,\n\nAndrew Ardill\n"},{"id":"177929","messageId":"CAKPyHN3dQ+qWeJtGzigEm=fZe62ZeRW-QGq0jnycKEBVaWn=mA@mail.gmail.com","threadId":"28672","inReplyTo":"87mxczgqiw.fsf@fox.patthoyts.tk","subject":"Re: [PATCH 1/4] git-gui: handle config booleans without value","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-18T06:39:26Z","receivedAt":"2011-10-18T06:39:26Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Tue, Oct 18, 2011 at 01:13, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>>When git interprets a config variable without a value as bool it is considered\n>>as true. But git-gui doesn't so until yet.\n>>\n>>The value for boolean configs are also case-insensitive.\n>>\n>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>---\n>> git-gui.sh |   16 ++++++++++++++--\n>> 1 files changed, 14 insertions(+), 2 deletions(-)\n>>\n>>diff --git a/git-gui.sh b/git-gui.sh\n>>index f897160..d687871 100755\n>>--- a/git-gui.sh\n>>+++ b/git-gui.sh\n>>@@ -299,7 +299,9 @@ proc is_config_true {name} {\n>>       global repo_config\n>>       if {[catch {set v $repo_config($name)}]} {\n>>               return 0\n>>-      } elseif {$v eq {true} || $v eq {1} || $v eq {yes}} {\n>>+      }\n>>+      set v [string tolower $v]\n>>+      if {$v eq {} || $v eq {true} || $v eq {1} || $v eq {yes} || $v eq {on}} {\n>>               return 1\n>>       } else {\n>>               return 0\n>\n> This looks ok - we actually have a [string is boolean $v] test we could\n> use eg:\n>  if {[string is boolean $v]} {\n>    return [expr {$v eq {} ? 1 : !!$v}]\n>  }\n> although I'm not sure it gains us much. This would match everything Tcl\n> believes to be a boolean - yes/no, on/off, true/false and 1/0. Without\n> -strict the [string is] test will consider {} to be a boolean.\n>\n>\n>>@@ -310,7 +312,9 @@ proc is_config_false {name} {\n>>       global repo_config\n>>       if {[catch {set v $repo_config($name)}]} {\n>>               return 0\n>>-      } elseif {$v eq {false} || $v eq {0} || $v eq {no}} {\n>>+      }\n>>+      set v [string tolower $v]\n>>+      if {$v eq {false} || $v eq {0} || $v eq {no} || $v eq {off}} {\n>>               return 1\n>>       } else {\n>>               return 0\n>>@@ -1060,6 +1064,10 @@ git-version proc _parse_config {arr_name args} {\n>>                               } else {\n>>                                       set arr($name) $value\n>>                               }\n>>+                      } elseif {[regexp {^([^\\n]+)$} $line line name]} {\n>>+                              # no value given, but interpreting them as\n>>+                              # boolean will be handled as true\n>>+                              set arr($name) {}\n>>                       }\n>>               }\n>>       }\n>>@@ -1075,6 +1083,10 @@ git-version proc _parse_config {arr_name args} {\n>>                                       } else {\n>>                                               set arr($name) $value\n>>                                       }\n>>+                              } elseif {[regexp {^([^=]+)$} $line line name]} {\n>>+                                      # no value given, but interpreting them as\n>>+                                      # boolean will be handled as true\n>>+                                      set arr($name) {}\n>>                               }\n>>                       }\n>>                       close $fd_rc\n>\n> Is this really how git treats boolean config values? I can't seem to\n> demonstrate that to myself:\n> pat@frog:/opt/src/git-gui$ git config --unset core.xyzzy\n> pat@frog:/opt/src/git-gui$ git config --bool --get core.xyzzy\n> pat@frog:/opt/src/git-gui$ git config --bool core.xyzzy 1\n> pat@frog:/opt/src/git-gui$ git config --bool --get core.xyzzy\n> true\n>\n> I assume I'm using the wrong test for this.\n\nIt looks like you can't set it with git-config. But I know, that writing:\n\n[core]\n        xyyzy\n\ninto the git config file and than calling git config --bool --get\ncore.xyzzy, will give you true.\n\nBert\n\n>\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":"177940","messageId":"87ehyan1un.fsf@fox.patthoyts.tk","threadId":"28672","inReplyTo":"CAKPyHN3dQ+qWeJtGzigEm=fZe62ZeRW-QGq0jnycKEBVaWn=mA@mail.gmail.com","subject":"Re: [PATCH 1/4] git-gui: handle config booleans without value","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-10-18T08:25:04Z","receivedAt":"2011-10-18T08:25:04Z","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>On Tue, Oct 18, 2011 at 01:13, Pat Thoyts\n><patthoyts@users.sourceforge.net> wrote:\n>> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>>\n>>>When git interprets a config variable without a value as bool it is considered\n>>>as true. But git-gui doesn't so until yet.\n>>>\n>>>The value for boolean configs are also case-insensitive.\n>>>\n>>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>>---\n>>> git-gui.sh |   16 ++++++++++++++--\n>>> 1 files changed, 14 insertions(+), 2 deletions(-)\n>>>\n>>>diff --git a/git-gui.sh b/git-gui.sh\n>>>index f897160..d687871 100755\n>>>--- a/git-gui.sh\n>>>+++ b/git-gui.sh\n>>>@@ -299,7 +299,9 @@ proc is_config_true {name} {\n>>>       global repo_config\n>>>       if {[catch {set v $repo_config($name)}]} {\n>>>               return 0\n>>>-      } elseif {$v eq {true} || $v eq {1} || $v eq {yes}} {\n>>>+      }\n>>>+      set v [string tolower $v]\n>>>+      if {$v eq {} || $v eq {true} || $v eq {1} || $v eq {yes} || $v eq {on}} {\n>>>               return 1\n>>>       } else {\n>>>               return 0\n>>\n>> This looks ok - we actually have a [string is boolean $v] test we could\n>> use eg:\n>>  if {[string is boolean $v]} {\n>>    return [expr {$v eq {} ? 1 : !!$v}]\n>>  }\n>> although I'm not sure it gains us much. This would match everything Tcl\n>> believes to be a boolean - yes/no, on/off, true/false and 1/0. Without\n>> -strict the [string is] test will consider {} to be a boolean.\n>>\n>>\n>>>@@ -310,7 +312,9 @@ proc is_config_false {name} {\n>>>       global repo_config\n>>>       if {[catch {set v $repo_config($name)}]} {\n>>>               return 0\n>>>-      } elseif {$v eq {false} || $v eq {0} || $v eq {no}} {\n>>>+      }\n>>>+      set v [string tolower $v]\n>>>+      if {$v eq {false} || $v eq {0} || $v eq {no} || $v eq {off}} {\n>>>               return 1\n>>>       } else {\n>>>               return 0\n>>>@@ -1060,6 +1064,10 @@ git-version proc _parse_config {arr_name args} {\n>>>                               } else {\n>>>                                       set arr($name) $value\n>>>                               }\n>>>+                      } elseif {[regexp {^([^\\n]+)$} $line line name]} {\n>>>+                              # no value given, but interpreting them as\n>>>+                              # boolean will be handled as true\n>>>+                              set arr($name) {}\n>>>                       }\n>>>               }\n>>>       }\n>>>@@ -1075,6 +1083,10 @@ git-version proc _parse_config {arr_name args} {\n>>>                                       } else {\n>>>                                               set arr($name) $value\n>>>                                       }\n>>>+                              } elseif {[regexp {^([^=]+)$} $line line name]} {\n>>>+                                      # no value given, but interpreting them as\n>>>+                                      # boolean will be handled as true\n>>>+                                      set arr($name) {}\n>>>                               }\n>>>                       }\n>>>                       close $fd_rc\n>>\n>> Is this really how git treats boolean config values? I can't seem to\n>> demonstrate that to myself:\n>> pat@frog:/opt/src/git-gui$ git config --unset core.xyzzy\n>> pat@frog:/opt/src/git-gui$ git config --bool --get core.xyzzy\n>> pat@frog:/opt/src/git-gui$ git config --bool core.xyzzy 1\n>> pat@frog:/opt/src/git-gui$ git config --bool --get core.xyzzy\n>> true\n>>\n>> I assume I'm using the wrong test for this.\n>\n>It looks like you can't set it with git-config. But I know, that writing:\n>\n>[core]\n>        xyyzy\n>\n>into the git config file and than calling git config --bool --get\n>core.xyzzy, will give you true.\n>\n>Bert\n\nOK thanks for explaining.\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"}]}