Skip to content

Commit 7ae512b

Browse files
committed
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: git-gui 0.10 git-gui: Add shortcut keys for Show More/Less Context
2 parents 5fbd0a4 + 3d654be commit 7ae512b

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

git-gui/GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=0.9.GITGUI
4+
DEF_VER=0.10.GITGUI
55

66
LF='
77
'

git-gui/git-gui.sh

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,22 @@ proc add_range_to_selection {w x y} {
18461846
$w tag add in_sel $begin.0 [expr {$end + 1}].0
18471847
}
18481848
1849+
proc show_more_context {} {
1850+
global repo_config
1851+
if {$repo_config(gui.diffcontext) < 99} {
1852+
incr repo_config(gui.diffcontext)
1853+
reshow_diff
1854+
}
1855+
}
1856+
1857+
proc show_less_context {} {
1858+
global repo_config
1859+
if {$repo_config(gui.diffcontext) >= 1} {
1860+
incr repo_config(gui.diffcontext) -1
1861+
reshow_diff
1862+
}
1863+
}
1864+
18491865
######################################################################
18501866
##
18511867
## ui construction
@@ -2046,6 +2062,16 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
20462062
20472063
.mbar.commit add separator
20482064
2065+
.mbar.commit add command -label [mc "Show Less Context"] \
2066+
-command show_less_context \
2067+
-accelerator $M1T-\[
2068+
2069+
.mbar.commit add command -label [mc "Show More Context"] \
2070+
-command show_more_context \
2071+
-accelerator $M1T-\]
2072+
2073+
.mbar.commit add separator
2074+
20492075
.mbar.commit add command -label [mc "Sign Off"] \
20502076
-command do_signoff \
20512077
-accelerator $M1T-S
@@ -2593,17 +2619,11 @@ lappend diff_actions [list $ctxm entryconf $ui_diff_applyhunk -state]
25932619
$ctxm add separator
25942620
$ctxm add command \
25952621
-label [mc "Show Less Context"] \
2596-
-command {if {$repo_config(gui.diffcontext) >= 1} {
2597-
incr repo_config(gui.diffcontext) -1
2598-
reshow_diff
2599-
}}
2622+
-command show_less_context
26002623
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
26012624
$ctxm add command \
26022625
-label [mc "Show More Context"] \
2603-
-command {if {$repo_config(gui.diffcontext) < 99} {
2604-
incr repo_config(gui.diffcontext)
2605-
reshow_diff
2606-
}}
2626+
-command show_more_context
26072627
lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state]
26082628
$ctxm add separator
26092629
$ctxm add command \
@@ -2695,6 +2715,8 @@ bind $ui_comm <$M1B-Key-v> {tk_textPaste %W; %W see insert; break}
26952715
bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break}
26962716
bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break}
26972717
bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break}
2718+
bind $ui_comm <$M1B-Key-\[> {show_less_context;break}
2719+
bind $ui_comm <$M1B-Key-\]> {show_more_context;break}
26982720
26992721
bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break}
27002722
bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break}
@@ -2738,6 +2760,8 @@ bind . <$M1B-Key-t> do_add_selection
27382760
bind . <$M1B-Key-T> do_add_selection
27392761
bind . <$M1B-Key-i> do_add_all
27402762
bind . <$M1B-Key-I> do_add_all
2763+
bind . <$M1B-Key-\[> {show_less_context;break}
2764+
bind . <$M1B-Key-\]> {show_more_context;break}
27412765
bind . <$M1B-Key-Return> do_commit
27422766
foreach i [list $ui_index $ui_workdir] {
27432767
bind $i <Button-1> "toggle_or_diff $i %x %y; break"

0 commit comments

Comments
 (0)