gitk: Add a help menu item to display key bindings
Suggested by Paul Schulz. I made it a separate entry under the Help menu rather than putting it in the About box, though. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
Apr 5, 2006 at 09:39 UTC
4e95e1f738720e2f768098f73e76109c15a4e1ff
1 file changed
+43
-1
gitk
+43
-1
@@ -353,6 +353,7 @@ proc makewindow {rargs} {
353
menu .bar.help
354
.bar add cascade -label "Help" -menu .bar.help
355
.bar.help add command -label "About gitk" -command about
356
+ .bar.help add command -label "Key bindings" -command keys
357
. configure -menu .bar
358
359
if {![info exists geometry(canv1)]} {
@@ -718,6 +719,47 @@ Use and redistribute under the terms of the GNU General Public License} \
719
pack $w.ok -side bottom
720
}
721
722
+proc keys {} {
723
+ set w .keys
724
+ if {[winfo exists $w]} {
725
+ raise $w
726
+ return
727
+ }
728
+ toplevel $w
729
+ wm title $w "Gitk key bindings"
730
+ message $w.m -text {
731
+Gitk key bindings:
732
+
733
+<Ctrl-Q> Quit
734
+<Up>, p, i Move up one commit
735
+<Down>, n, k Move down one commit
736
+<Left>, z, j Go back in history list
737
+<Right>, x, l Go forward in history list
738
+<Page up> Scroll commit list up one page
739
+<Page down> Scroll commit list down one page
740
+<Delete>, b Scroll diff view up one page
741
+<Backspace> Scroll diff view up one page
742
+<Space> Scroll diff view down one page
743
+u Scroll diff view up 18 lines
744
+d Scroll diff view down 18 lines
745
+<Ctrl-F> Find
746
+<Ctrl-G> Move to next find hit
747
+<Ctrl-R> Move to previous find hit
748
+<Return> Move to next find hit
749
+/ Move to next find hit, or redo find
750
+? Move to previous find hit
751
+f Scroll diff view to next file
752
+<Ctrl-KP+> Increase font size
753
+<Ctrl-plus> Increase font size
754
+<Ctrl-KP-> Decrease font size
755
+<Ctrl-minus> Decrease font size
756
+} \
757
+ -justify left -bg white -border 2 -relief sunken
758
+ pack $w.m -side top -fill both
759
+ button $w.ok -text Close -command "destroy $w"
760
+ pack $w.ok -side bottom
761
+}
762
+
763
proc shortids {ids} {
764
set res {}
765
foreach id $ids {
@@ -1763,7 +1805,7 @@ proc drawrest {} {
1805
showstuff $commitidx
1806
1807
set drawmsecs [expr {[clock clicks -milliseconds] - $startmsecs}]
1766
- puts "overall $drawmsecs ms for $numcommits commits"
1808
+ #puts "overall $drawmsecs ms for $numcommits commits"
1809
}
1810
1811
proc findmatches {f} {