git-gui: add hotkey to toggle "Amend Last Commit"

Selecting whether to "Amend Last Commit" or not does not have a hotkey. With this patch, the user may toggle between the two options with CTRL/CMD+e. Signed-off-by: Birger Skogeng Pedersen <birger.sp@gmail.com> Rebased-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Birger Skogeng Pedersen committed Sep 14, 2019 at 11:18 UTC ec7424e1a634ba4a509227f003bd9cf31f12b4c2
1 file changed +9
git-gui.sh
+9
@@ -2664,6 +2664,12 @@ proc focus_widget {widget} {
2664 }
2665 }
2666
2667 +proc toggle_commit_type {} {
2668 + global commit_type_is_amend
2669 + set commit_type_is_amend [expr !$commit_type_is_amend]
2670 + do_select_commit_type
2671 +}
2672 +
2673 ######################################################################
2674 ##
2675 ## ui construction
@@ -2854,6 +2860,7 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
2860 if {![is_enabled nocommit]} {
2861 .mbar.commit add checkbutton \
2862 -label [mc "Amend Last Commit"] \
2863 + -accelerator $M1T-E \
2864 -variable commit_type_is_amend \
2865 -command do_select_commit_type
2866 lappend disable_on_lock \
@@ -3892,6 +3899,8 @@ bind . <$M1B-Key-j> do_revert_selection
3899 bind . <$M1B-Key-J> do_revert_selection
3900 bind . <$M1B-Key-i> do_add_all
3901 bind . <$M1B-Key-I> do_add_all
3902 +bind . <$M1B-Key-e> toggle_commit_type
3903 +bind . <$M1B-Key-E> toggle_commit_type
3904 bind . <$M1B-Key-minus> {show_less_context;break}
3905 bind . <$M1B-Key-KP_Subtract> {show_less_context;break}
3906 bind . <$M1B-Key-equal> {show_more_context;break}