From: "Jonathan del Strother" <maillist@steelskies.com>
To: "Git Mailing List" <git@vger.kernel.org>
Subject: [PATCH] git-gui: Add shortcut keys for Show More/Less Context
Date: Fri, 28 Mar 2008 13:22:47 +0000 [thread overview]
Message-ID: <57518fd10803280622v3a5f6ae8lcfd35270ab9ede1e@mail.gmail.com> (raw)
Bound to Ctrl/Cmd (depending on your platform) + left & right square brackets.
---
I'm not at all familiar with Tcl, so I apologise in advance for any
wrongness. I frequently find myself repeatedly right-clicking->Show
Less Context in order to stage a specific hunk, seems like a shortcut
for this would be useful. Thoughts?
git-gui/git-gui.sh | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index 5e97fbf..c476753 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -1845,7 +1845,21 @@ proc add_range_to_selection {w x y} {
}
$w tag add in_sel $begin.0 [expr {$end + 1}].0
}
+proc show_more_context {} {
+ global repo_config
+ if {$repo_config(gui.diffcontext) < 99} {
+ incr repo_config(gui.diffcontext)
+ reshow_diff
+ }
+}
+proc show_less_context {} {
+ global repo_config
+ if {$repo_config(gui.diffcontext) >= 1} {
+ incr repo_config(gui.diffcontext) -1
+ reshow_diff
+ }
+}
######################################################################
##
## ui construction
@@ -2593,17 +2607,11 @@ lappend diff_actions [list $ctxm entryconf
$ui_diff_applyhunk -state]
$ctxm add separator
$ctxm add command \
-label [mc "Show Less Context"] \
- -command {if {$repo_config(gui.diffcontext) >= 1} {
- incr repo_config(gui.diffcontext) -1
- reshow_diff
- }}
+ -command show_less_context
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add command \
-label [mc "Show More Context"] \
- -command {if {$repo_config(gui.diffcontext) < 99} {
- incr repo_config(gui.diffcontext)
- reshow_diff
- }}
+ -command show_more_context
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
$ctxm add separator
$ctxm add command \
@@ -2695,6 +2703,8 @@ bind $ui_comm <$M1B-Key-v> {tk_textPaste %W; %W
see insert; break}
bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}
bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}
bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}
+bind $ui_comm <$M1B-Key-\[> {show_less_context;break}
+bind $ui_comm <$M1B-Key-\]> {show_more_context;break}
bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
--
1.5.4.3.450.gb92176.dirty
next reply other threads:[~2008-03-28 13:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-28 13:22 Jonathan del Strother [this message]
2008-03-29 5:44 ` [PATCH] git-gui: Add shortcut keys for Show More/Less Context Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57518fd10803280622v3a5f6ae8lcfd35270ab9ede1e@mail.gmail.com \
--to=maillist@steelskies.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).