From d23d98d3ba21b2a7a1d30be049bfb5d9c0a4e943 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 19 Jul 2007 00:37:58 -0400 Subject: [PATCH] [PATCH] gitk: Bind keyboard actions to the command key on Mac OS git-gui already uses the command key for accelerators, but gitk has never done so. I'm actually finding it very hard to move back and forth between the two applications as git-gui is following the Mac OS X conventions and gitk is not. This trick is the same one that git-gui uses to determine which key to bind actions to. Signed-off-by: Shawn O. Pearce Signed-off-by: Paul Mackerras --- gitk | 75 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 32 deletions(-) diff --git a/gitk b/gitk index d6f62b2a0..66e4a643d 100755 --- a/gitk +++ b/gitk @@ -809,6 +809,12 @@ proc makewindow {} { wm geometry . "$geometry(main)" } + if {[tk windowingsystem] eq {aqua}} { + set M1B M1 + } else { + set M1B Control + } + bind .pwbottom {resizecdetpanes %W %w} pack .ctop -fill both -expand 1 bindall <1> {selcanvline %W %x %y} @@ -827,12 +833,12 @@ proc makewindow {} { bindkey "goback" bind . "selnextpage -1" bind . "selnextpage 1" - bind . "allcanvs yview moveto 0.0" - bind . "allcanvs yview moveto 1.0" - bind . "allcanvs yview scroll -1 units" - bind . "allcanvs yview scroll 1 units" - bind . "allcanvs yview scroll -1 pages" - bind . "allcanvs yview scroll 1 pages" + bind . <$M1B-Home> "allcanvs yview moveto 0.0" + bind . <$M1B-End> "allcanvs yview moveto 1.0" + bind . <$M1B-Key-Up> "allcanvs yview scroll -1 units" + bind . <$M1B-Key-Down> "allcanvs yview scroll 1 units" + bind . <$M1B-Key-Prior> "allcanvs yview scroll -1 pages" + bind . <$M1B-Key-Next> "allcanvs yview scroll 1 pages" bindkey "$ctext yview scroll -1 pages" bindkey "$ctext yview scroll -1 pages" bindkey "$ctext yview scroll 1 pages" @@ -852,15 +858,15 @@ proc makewindow {} { bindkey ? findprev bindkey f nextfile bindkey updatecommits - bind . doquit - bind . dofind - bind . {findnext 0} - bind . dosearchback - bind . dosearch - bind . {incrfont 1} - bind . {incrfont 1} - bind . {incrfont -1} - bind . {incrfont -1} + bind . <$M1B-q> doquit + bind . <$M1B-f> dofind + bind . <$M1B-g> {findnext 0} + bind . <$M1B-r> dosearchback + bind . <$M1B-s> dosearch + bind . <$M1B-equal> {incrfont 1} + bind . <$M1B-KP_Add> {incrfont 1} + bind . <$M1B-minus> {incrfont -1} + bind . <$M1B-KP_Subtract> {incrfont -1} wm protocol . WM_DELETE_WINDOW doquit bind . "click %W" bind $fstring dofind @@ -1101,12 +1107,17 @@ proc keys {} { raise $w return } + if {[tk windowingsystem] eq {aqua}} { + set M1T Cmd + } else { + set M1T Ctrl + } toplevel $w wm title $w "Gitk key bindings" - message $w.m -text { + message $w.m -text " Gitk key bindings: - Quit +<$M1T-Q> Quit Move to first commit Move to last commit , p, i Move up one commit @@ -1115,12 +1126,12 @@ Gitk key bindings: , x, l Go forward in history list Move up one page in commit list Move down one page in commit list - Scroll to top of commit list - Scroll to bottom of commit list - Scroll commit list up one line - Scroll commit list down one line - Scroll commit list up one page - Scroll commit list down one page +<$M1T-Home> Scroll to top of commit list +<$M1T-End> Scroll to bottom of commit list +<$M1T-Up> Scroll commit list up one line +<$M1T-Down> Scroll commit list down one line +<$M1T-PageUp> Scroll commit list up one page +<$M1T-PageDown> Scroll commit list down one page Move to previous highlighted line Move to next highlighted line , b Scroll diff view up one page @@ -1128,20 +1139,20 @@ Gitk key bindings: Scroll diff view down one page u Scroll diff view up 18 lines d Scroll diff view down 18 lines - Find - Move to next find hit +<$M1T-F> Find +<$M1T-G> Move to next find hit Move to next find hit / Move to next find hit, or redo find ? Move to previous find hit f Scroll diff view to next file - Search for next hit in diff view - Search for previous hit in diff view - Increase font size - Increase font size - Decrease font size - Decrease font size +<$M1T-S> Search for next hit in diff view +<$M1T-R> Search for previous hit in diff view +<$M1T-KP+> Increase font size +<$M1T-plus> Increase font size +<$M1T-KP-> Decrease font size +<$M1T-minus> Decrease font size Update -} \ +" \ -justify left -bg white -border 2 -relief groove pack $w.m -side top -fill both -padx 2 -pady 2 $w.m configure -font $uifont -- 2.26.2