{"thread":{"id":"28731","subject":"[PATCH] git-gui: delegate selection from gutter columns to text output","startedAt":"2011-10-20T19:45:09Z","lastAt":"2011-10-22T19:38:49Z","messageCount":4,"participants":["Bert Wesarg","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"178104","messageId":"5fc6f5d088e37508f1911f89b4d82932071045e0.1319139888.git.bert.wesarg@googlemail.com","threadId":"28731","inReplyTo":null,"subject":"[PATCH] git-gui: delegate selection from gutter columns to text output","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-20T19:45:09Z","receivedAt":"2011-10-20T19:45:09Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Selecting in the gutter columns of the blame view should make no sense,\nso delegate any selection action in these columns to the text output\nby selecting whole lines there.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n git-gui.sh    |   20 ++++++++++++++++++++\n lib/blame.tcl |    4 +++-\n 2 files changed, 23 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 21033cb..cf5ed79 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2077,6 +2077,26 @@ proc many2scrollbar {list mode sb top bottom} {\n \tforeach w $list {$w $mode moveto $top}\n }\n \n+proc delegate_sel_to {w from} {\n+\tset bind_list [list \\\n+\t\t<Button-1> \\\n+\t\t<B1-Motion> \\\n+\t\t<Double-Button-1> \\\n+\t\t<Triple-Button-1> \\\n+\t\t<Shift-Button-1> \\\n+\t\t<Double-Shift-Button-1> \\\n+\t\t<Triple-Shift-Button-1> \\\n+\t]\n+\n+\tforeach seq $bind_list {\n+\t\tset script [bind Text $seq]\n+\t\tset new_script [string map [list %W $w %x 0 word line] $script]\n+\t\tforeach f $from {\n+\t\t\tbind $f $seq \"$new_script; break\"\n+\t\t}\n+\t}\n+}\n+\n proc incr_font_size {font {amt 1}} {\n \tset sz [font configure $font -size]\n \tincr sz $amt\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex 49eae19..9ab0da5 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {\n \n \tset w_columns [list $w_amov $w_asim $w_line $w_file]\n \n+\tdelegate_sel_to $w_file [list $w_amov $w_asim $w_line]\n+\n \t${NS}::scrollbar $w.file_pane.out.sbx \\\n \t\t-orient h \\\n \t\t-command [list $w_file xview]\n@@ -315,7 +317,7 @@ constructor new {i_commit i_path i_jump} {\n \t\t$i conf -yscrollcommand \\\n \t\t\t\"[list ::searchbar::scrolled $finder]\n \t\t\t [list many2scrollbar $w_columns yview $w.file_pane.out.sby]\"\n-\t\tbind $i <Button-1> \"\n+\t\tbind $i <Button-1> \"+\n \t\t\t[cb _hide_tooltip]\n \t\t\t[cb _click $i @%x,%y]\n \t\t\tfocus $i\n-- \n1.7.7.759.gfc8c6\n"},{"id":"178151","messageId":"87ehy63rvx.fsf@fox.patthoyts.tk","threadId":"28731","inReplyTo":"5fc6f5d088e37508f1911f89b4d82932071045e0.1319139888.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH] git-gui: delegate selection from gutter columns to text output","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2011-10-21T22:24:18Z","receivedAt":"2011-10-21T22:24:18Z","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>Selecting in the gutter columns of the blame view should make no sense,\n>so delegate any selection action in these columns to the text output\n>by selecting whole lines there.\n>\n>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>---\n> git-gui.sh    |   20 ++++++++++++++++++++\n> lib/blame.tcl |    4 +++-\n> 2 files changed, 23 insertions(+), 1 deletions(-)\n>\n>diff --git a/git-gui.sh b/git-gui.sh\n>index 21033cb..cf5ed79 100755\n>--- a/git-gui.sh\n>+++ b/git-gui.sh\n>@@ -2077,6 +2077,26 @@ proc many2scrollbar {list mode sb top bottom} {\n> \tforeach w $list {$w $mode moveto $top}\n> }\n> \n>+proc delegate_sel_to {w from} {\n>+\tset bind_list [list \\\n>+\t\t<Button-1> \\\n>+\t\t<B1-Motion> \\\n>+\t\t<Double-Button-1> \\\n>+\t\t<Triple-Button-1> \\\n>+\t\t<Shift-Button-1> \\\n>+\t\t<Double-Shift-Button-1> \\\n>+\t\t<Triple-Shift-Button-1> \\\n>+\t]\n>+\n>+\tforeach seq $bind_list {\n>+\t\tset script [bind Text $seq]\n>+\t\tset new_script [string map [list %W $w %x 0 word line] $script]\n>+\t\tforeach f $from {\n>+\t\t\tbind $f $seq \"$new_script; break\"\n>+\t\t}\n>+\t}\n>+}\n>+\n> proc incr_font_size {font {amt 1}} {\n> \tset sz [font configure $font -size]\n> \tincr sz $amt\n>diff --git a/lib/blame.tcl b/lib/blame.tcl\n>index 49eae19..9ab0da5 100644\n>--- a/lib/blame.tcl\n>+++ b/lib/blame.tcl\n>@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {\n> \n> \tset w_columns [list $w_amov $w_asim $w_line $w_file]\n> \n>+\tdelegate_sel_to $w_file [list $w_amov $w_asim $w_line]\n>+\n> \t${NS}::scrollbar $w.file_pane.out.sbx \\\n> \t\t-orient h \\\n> \t\t-command [list $w_file xview]\n>@@ -315,7 +317,7 @@ constructor new {i_commit i_path i_jump} {\n> \t\t$i conf -yscrollcommand \\\n> \t\t\t\"[list ::searchbar::scrolled $finder]\n> \t\t\t [list many2scrollbar $w_columns yview $w.file_pane.out.sby]\"\n>-\t\tbind $i <Button-1> \"\n>+\t\tbind $i <Button-1> \"+\n> \t\t\t[cb _hide_tooltip]\n> \t\t\t[cb _click $i @%x,%y]\n> \t\t\tfocus $i\n\nThe patch seems to be fine but I don't think I agree with the intention\nhere. Currently clicking anywhere that is not marked as a link (blue\nunderlined text) selects a commit and shows information in the lower\npane. With this change, the left hand columns become inactive in regards\nto selecting a commit. I don't see why that is desirable.\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":"178162","messageId":"CAKPyHN1zTJsE5-T5LdN=86iKdQ7=SGxuVacw8aE4DvmbX4srHw@mail.gmail.com","threadId":"28731","inReplyTo":"87ehy63rvx.fsf@fox.patthoyts.tk","subject":"Re: [PATCH] git-gui: delegate selection from gutter columns to text output","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-22T15:41:51Z","receivedAt":"2011-10-22T15:41:51Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Sat, Oct 22, 2011 at 00:24, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>>Selecting in the gutter columns of the blame view should make no sense,\n>>so delegate any selection action in these columns to the text output\n>>by selecting whole lines there.\n>>\n>>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>---\n>> git-gui.sh    |   20 ++++++++++++++++++++\n>> lib/blame.tcl |    4 +++-\n>> 2 files changed, 23 insertions(+), 1 deletions(-)\n>>\n>>diff --git a/git-gui.sh b/git-gui.sh\n>>index 21033cb..cf5ed79 100755\n>>--- a/git-gui.sh\n>>+++ b/git-gui.sh\n>>@@ -2077,6 +2077,26 @@ proc many2scrollbar {list mode sb top bottom} {\n>>       foreach w $list {$w $mode moveto $top}\n>> }\n>>\n>>+proc delegate_sel_to {w from} {\n>>+      set bind_list [list \\\n>>+              <Button-1> \\\n>>+              <B1-Motion> \\\n>>+              <Double-Button-1> \\\n>>+              <Triple-Button-1> \\\n>>+              <Shift-Button-1> \\\n>>+              <Double-Shift-Button-1> \\\n>>+              <Triple-Shift-Button-1> \\\n>>+      ]\n>>+\n>>+      foreach seq $bind_list {\n>>+              set script [bind Text $seq]\n>>+              set new_script [string map [list %W $w %x 0 word line] $script]\n>>+              foreach f $from {\n>>+                      bind $f $seq \"$new_script; break\"\n>>+              }\n>>+      }\n>>+}\n>>+\n>> proc incr_font_size {font {amt 1}} {\n>>       set sz [font configure $font -size]\n>>       incr sz $amt\n>>diff --git a/lib/blame.tcl b/lib/blame.tcl\n>>index 49eae19..9ab0da5 100644\n>>--- a/lib/blame.tcl\n>>+++ b/lib/blame.tcl\n>>@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {\n>>\n>>       set w_columns [list $w_amov $w_asim $w_line $w_file]\n>>\n>>+      delegate_sel_to $w_file [list $w_amov $w_asim $w_line]\n>>+\n>>       ${NS}::scrollbar $w.file_pane.out.sbx \\\n>>               -orient h \\\n>>               -command [list $w_file xview]\n>>@@ -315,7 +317,7 @@ constructor new {i_commit i_path i_jump} {\n>>               $i conf -yscrollcommand \\\n>>                       \"[list ::searchbar::scrolled $finder]\n>>                        [list many2scrollbar $w_columns yview $w.file_pane.out.sby]\"\n>>-              bind $i <Button-1> \"\n>>+              bind $i <Button-1> \"+\n>>                       [cb _hide_tooltip]\n>>                       [cb _click $i @%x,%y]\n>>                       focus $i\n>\n> The patch seems to be fine but I don't think I agree with the intention\n> here. Currently clicking anywhere that is not marked as a link (blue\n> underlined text) selects a commit and shows information in the lower\n> pane. With this change, the left hand columns become inactive in regards\n> to selecting a commit. I don't see why that is desirable.\n\nSorry, this was not intended. And I thought I took care for it with\nthe last hunk. I have a look at it again.\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":"178181","messageId":"4494a44b6755080915176a3f726fa8b754deee8d.1319312109.git.bert.wesarg@googlemail.com","threadId":"28731","inReplyTo":"CAKPyHN1zTJsE5-T5LdN=86iKdQ7=SGxuVacw8aE4DvmbX4srHw@mail.gmail.com","subject":"[PATCHv2] git-gui: delegate selection from gutter columns to text output","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-10-22T19:38:49Z","receivedAt":"2011-10-22T19:38:49Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Selecting in the gutter columns of the blame view should make no sense,\nso delegate any selection action in these columns to the text output\nby selecting whole lines there.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n\n git-gui.sh    |   29 +++++++++++++++++++++++++++++\n lib/blame.tcl |   20 +++++++++++++++-----\n 2 files changed, 44 insertions(+), 5 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 21033cb..53d6b43 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2077,6 +2077,35 @@ proc many2scrollbar {list mode sb top bottom} {\n \tforeach w $list {$w $mode moveto $top}\n }\n \n+# delegates mouse selection actions from gutter columns to the main text\n+# widget\n+# use delegator_bind, if you need to bind more actions\n+proc delegate_sel_to {w from} {\n+\tset bind_list [list \\\n+\t\t<Button-1> \\\n+\t\t<B1-Motion> \\\n+\t\t<Double-Button-1> \\\n+\t\t<Triple-Button-1> \\\n+\t\t<Shift-Button-1> \\\n+\t\t<Double-Shift-Button-1> \\\n+\t\t<Triple-Shift-Button-1> \\\n+\t]\n+\n+\tforeach seq $bind_list {\n+\t\tset script [bind Text $seq]\n+\t\tset new_script [string map [list %W $w %x 0 word line] $script]\n+\t\tforeach f $from {\n+\t\t\tbind $f $seq \"$new_script; focus $w; break\"\n+\t\t}\n+\t}\n+}\n+\n+# use this for binding any of the mouse actions from a delegator\n+# see bind_list in delegate_sel_to\n+proc delegator_bind {tag seq script} {\n+\tbind $tag $seq \"$script; [bind $tag $seq]\"\n+}\n+\n proc incr_font_size {font {amt 1}} {\n \tset sz [font configure $font -size]\n \tincr sz $amt\ndiff --git a/lib/blame.tcl b/lib/blame.tcl\nindex b031e66..b7eb18a 100644\n--- a/lib/blame.tcl\n+++ b/lib/blame.tcl\n@@ -210,6 +210,8 @@ constructor new {i_commit i_path i_jump} {\n \n \tset w_columns [list $w_amov $w_asim $w_line $w_file]\n \n+\tdelegate_sel_to $w_file [list $w_amov $w_asim $w_line]\n+\n \t${NS}::scrollbar $w.file_pane.out.sbx \\\n \t\t-orient h \\\n \t\t-command [list $w_file xview]\n@@ -318,11 +320,19 @@ constructor new {i_commit i_path i_jump} {\n \t\t$i conf -yscrollcommand \\\n \t\t\t\"[list ::searchbar::scrolled $finder]\n \t\t\t [list many2scrollbar $w_columns yview $w.file_pane.out.sby]\"\n-\t\tbind $i <Button-1> \"\n-\t\t\t[cb _hide_tooltip]\n-\t\t\t[cb _click $i @%x,%y]\n-\t\t\tfocus $i\n-\t\t\"\n+\t\tif {$i eq $w_file} {\n+\t\t\tbind $i <Button-1> \"\n+\t\t\t\t[cb _hide_tooltip]\n+\t\t\t\t[cb _click $i @%x,%y]\n+\t\t\t\tfocus $i\n+\t\t\t\"\n+\t\t} else {\n+\t\t\tdelegator_bind $i <Button-1> \"\n+\t\t\t\t[cb _hide_tooltip]\n+\t\t\t\t[cb _click $i @%x,%y]\n+\t\t\t\tfocus $i\n+\t\t\t\"\n+\t\t}\n \t\tbind $i <Any-Motion>  [cb _show_tooltip $i @%x,%y]\n \t\tbind $i <Any-Enter>   [cb _hide_tooltip]\n \t\tbind $i <Any-Leave>   [cb _hide_tooltip]\n-- \n1.7.7.908.g383b5\n"}]}