@@ -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
26002623lappend 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
26072627lappend 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}
26952715bind $ui_comm <$M1B -Key-V> {tk_textPaste %W; %W see insert; break}
26962716bind $ui_comm <$M1B -Key-a> {%W tag add sel 0.0 end;break}
26972717bind $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
26992721bind $ui_diff <$M1B -Key-x> {tk_textCopy %W;break}
27002722bind $ui_diff <$M1B -Key-X> {tk_textCopy %W;break}
@@ -2738,6 +2760,8 @@ bind . <$M1B-Key-t> do_add_selection
27382760bind . <$M1B -Key-T> do_add_selection
27392761bind . <$M1B -Key-i> do_add_all
27402762bind . <$M1B -Key-I> do_add_all
2763+ bind . <$M1B -Key-\[ > {show_less_context;break}
2764+ bind . <$M1B -Key-\] > {show_more_context;break}
27412765bind . <$M1B -Key-Return> do_commit
27422766foreach i [ list $ui_index $ui_workdir ] {
27432767 bind $i <Button-1> " toggle_or_diff $i %x %y; break "
0 commit comments