{"thread":{"id":"12947","subject":"[PATCH v2] git-gui: Add shortcut keys for Show More/Less Context","startedAt":"2008-04-01T10:54:03Z","lastAt":"2008-04-02T05:34:23Z","messageCount":3,"participants":["Jonathan del Strother","Shawn O. Pearce"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"73493","messageId":"1207047243-27738-1-git-send-email-maillist@steelskies.com","threadId":"12947","inReplyTo":null,"subject":"[PATCH v2] git-gui: Add shortcut keys for Show More/Less Context","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2008-04-01T10:54:03Z","receivedAt":"2008-04-01T10:54:03Z","isPatch":true,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"Bound to Ctrl/Cmd + left & right square brackets, depending on your platform.\n\nSigned-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>\n---\n\nSecond attempt to add Show Context shortcuts to git gui.  This new version also adds the items to the Commit menu, complete with accelerator keys to make the shortcut more visible.\n\n git-gui/git-gui.sh |   36 ++++++++++++++++++++++++++++--------\n 1 files changed, 28 insertions(+), 8 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 5e97fbf..9ee2d32 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -1845,7 +1845,21 @@ proc add_range_to_selection {w x y} {\n \t}\n \t$w tag add in_sel $begin.0 [expr {$end + 1}].0\n }\n+proc show_more_context {} {\n+\tglobal repo_config\n+\tif {$repo_config(gui.diffcontext) < 99} {\n+\t\tincr repo_config(gui.diffcontext)\n+\t\treshow_diff\n+\t}\n+}\n \n+proc show_less_context {} {\n+\tglobal repo_config\n+\tif {$repo_config(gui.diffcontext) >= 1} {\n+\t\tincr repo_config(gui.diffcontext) -1\n+\t\treshow_diff\n+\t}\n+}\n ######################################################################\n ##\n ## ui construction\n@@ -2046,6 +2060,16 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {\n \n \t.mbar.commit add separator\n \n+\t.mbar.commit add command -label [mc \"Show Less Context\"] \\\n+\t\t-command show_less_context \\\n+\t\t-accelerator $M1T-\\[\n+\n+\t.mbar.commit add command -label [mc \"Show More Context\"] \\\n+\t\t-command show_more_context \\\n+\t\t-accelerator $M1T-\\]\n+\n+\t.mbar.commit add separator\n+\n \t.mbar.commit add command -label [mc \"Sign Off\"] \\\n \t\t-command do_signoff \\\n \t\t-accelerator $M1T-S\n@@ -2593,17 +2617,11 @@ lappend diff_actions [list $ctxm entryconf $ui_diff_applyhunk -state]\n $ctxm add separator\n $ctxm add command \\\n \t-label [mc \"Show Less Context\"] \\\n-\t-command {if {$repo_config(gui.diffcontext) >= 1} {\n-\t\tincr repo_config(gui.diffcontext) -1\n-\t\treshow_diff\n-\t}}\n+\t-command show_less_context\n lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n $ctxm add command \\\n \t-label [mc \"Show More Context\"] \\\n-\t-command {if {$repo_config(gui.diffcontext) < 99} {\n-\t\tincr repo_config(gui.diffcontext)\n-\t\treshow_diff\n-\t}}\n+\t-command show_more_context\n lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]\n $ctxm add separator\n $ctxm add command \\\n@@ -2695,6 +2713,8 @@ bind $ui_comm <$M1B-Key-v> {tk_textPaste %W; %W see insert; break}\n bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}\n bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}\n bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}\n+bind $ui_comm <$M1B-Key-\\[> {show_less_context;break}\n+bind $ui_comm <$M1B-Key-\\]> {show_more_context;break}\n \n bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}\n bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}\n-- \n1.5.5.rc2.1.g107f.dirty\n"},{"id":"73507","messageId":"57518fd10804010659t42569632u906f994519d527c6@mail.gmail.com","threadId":"12947","inReplyTo":"1207047243-27738-1-git-send-email-maillist@steelskies.com","subject":"Re: [PATCH v2] git-gui: Add shortcut keys for Show More/Less Context","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2008-04-01T13:59:01Z","receivedAt":"2008-04-01T13:59:01Z","isPatch":true,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"On Tue, Apr 1, 2008 at 11:54 AM, Jonathan del Strother\n<maillist@steelskies.com> wrote:\n> Bound to Ctrl/Cmd + left & right square brackets, depending on your platform.\n>\n>  Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>\n>  ---\n>\n>  Second attempt to add Show Context shortcuts to git gui.  This new version also adds the items to the Commit menu, complete with accelerator keys to make the shortcut more visible.\n>\n\n\n... I've just noticed that the shortcut keys don't apply while the\ndiff view has keyboard focus.  Shall I replace \"bind $ui_comm ... \"\nwith \"bind all ...\"  ?\n"},{"id":"73532","messageId":"20080402053423.GW10274@spearce.org","threadId":"12947","inReplyTo":"57518fd10804010659t42569632u906f994519d527c6@mail.gmail.com","subject":"Re: [PATCH v2] git-gui: Add shortcut keys for Show More/Less Context","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-04-02T05:34:23Z","receivedAt":"2008-04-02T05:34:23Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Jonathan del Strother <maillist@steelskies.com> wrote:\n> On Tue, Apr 1, 2008 at 11:54 AM, Jonathan del Strother\n> <maillist@steelskies.com> wrote:\n> > Bound to Ctrl/Cmd + left & right square brackets, depending on your platform.\n\nThanks.\n \n> ... I've just noticed that the shortcut keys don't apply while the\n> diff view has keyboard focus.  Shall I replace \"bind $ui_comm ... \"\n> with \"bind all ...\"  ?\n\nNo, \"bind .\".  I squashed this into your patch:\n\n@@ -2758,6 +2760,8 @@ bind .   <$M1B-Key-t> do_add_selection\n bind .   <$M1B-Key-T> do_add_selection\n bind .   <$M1B-Key-i> do_add_all\n bind .   <$M1B-Key-I> do_add_all\n+bind .   <$M1B-Key-\\[> {show_less_context;break}\n+bind .   <$M1B-Key-\\]> {show_more_context;break}\n bind .   <$M1B-Key-Return> do_commit\n foreach i [list $ui_index $ui_workdir] {\n        bind $i <Button-1>       \"toggle_or_diff         $i %x %y; break\"\n\n\n-- \nShawn.\n"}]}