git-gui: Improve keyboard traversal in dialogs.
authorShawn O. Pearce <spearce@spearce.org>
Sun, 21 Jan 2007 21:37:05 +0000 (16:37 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 22 Jan 2007 03:47:58 +0000 (22:47 -0500)
When we are in a dialog such as the new branch dialog or our options
dialog we should permit the user to traverse around through the available
widgets with their Tab/Shift-Tab key combinations.  So in any single
line text field where we don't want tab characters to actually be
inserted into the value rebind Tab and Shift-Tab to honor what the
tk_focusPrev and tk_focusNext scripts recommend.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh

index 1a7c4d6b153afff2a065b6926861e8ce43b97c3b..d59e720408645d275c20c91e0d88063e0063edd6 100755 (executable)
@@ -1810,8 +1810,8 @@ proc do_create_branch {} {
                -font font_ui
        $w.desc.name_t insert 0.0 $repo_config(gui.newbranchtemplate)
        grid $w.desc.name_l $w.desc.name_t -stick we -padx {0 5}
-       bind $w.desc.name_t <Shift-Key-Tab> "focus $w.postActions.checkout;break"
-       bind $w.desc.name_t <Key-Tab> "focus $w.from.exp_t;break"
+       bind $w.desc.name_t <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
+       bind $w.desc.name_t <Key-Tab> {focus [tk_focusNext %W];break}
        bind $w.desc.name_t <Key-Return> "do_create_branch_action $w;break"
        bind $w.desc.name_t <Key> {
                if {{%K} ne {BackSpace}
@@ -1860,8 +1860,8 @@ proc do_create_branch {} {
                -width 50 \
                -font font_ui
        grid $w.from.exp_r $w.from.exp_t -stick we -padx {0 5}
-       bind $w.from.exp_t <Shift-Key-Tab> "focus $w.desc.name_t;break"
-       bind $w.from.exp_t <Key-Tab> "focus $w.postActions.checkout;break"
+       bind $w.from.exp_t <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
+       bind $w.from.exp_t <Key-Tab> {focus [tk_focusNext %W];break}
        bind $w.from.exp_t <Key-Return> "do_create_branch_action $w;break"
        grid columnconfigure $w.from 1 -weight 1
        pack $w.from -anchor nw -fill x -pady 5 -padx 5
@@ -3049,7 +3049,8 @@ proc do_options {} {
                                        -width 20 \
                                        -font font_ui
                                $w.$f.$name.v insert 0.0 [set ${f}_config_new(gui.$name)]
-                               bind $w.$f.$name.v <Key-Tab> break
+                               bind $w.$f.$name.v <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
+                               bind $w.$f.$name.v <Key-Tab> {focus [tk_focusNext %W];break}
                                bind $w.$f.$name.v <Key-Return> break
                                bind $w.$f.$name.v <FocusOut> "
                                        set ${f}_config_new(gui.$name) \