git-gui: Improve keyboard traversal in dialogs.
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>
Shawn O. Pearce committed
Jan 21, 2007 at 16:37 UTC
f250091b77949766724ffb67beb7a6adadc6b5b4
1 file changed
+6
-5
git-gui.sh
+6
-5
@@ -1810,8 +1810,8 @@ proc do_create_branch {} {
1810
-font font_ui
1811
$w.desc.name_t insert 0.0 $repo_config(gui.newbranchtemplate)
1812
grid $w.desc.name_l $w.desc.name_t -stick we -padx {0 5}
1813
- bind $w.desc.name_t <Shift-Key-Tab> "focus $w.postActions.checkout;break"
1814
- bind $w.desc.name_t <Key-Tab> "focus $w.from.exp_t;break"
1813
+ bind $w.desc.name_t <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
1814
+ bind $w.desc.name_t <Key-Tab> {focus [tk_focusNext %W];break}
1815
bind $w.desc.name_t <Key-Return> "do_create_branch_action $w;break"
1816
bind $w.desc.name_t <Key> {
1817
if {{%K} ne {BackSpace}
@@ -1860,8 +1860,8 @@ proc do_create_branch {} {
1860
-width 50 \
1861
-font font_ui
1862
grid $w.from.exp_r $w.from.exp_t -stick we -padx {0 5}
1863
- bind $w.from.exp_t <Shift-Key-Tab> "focus $w.desc.name_t;break"
1864
- bind $w.from.exp_t <Key-Tab> "focus $w.postActions.checkout;break"
1863
+ bind $w.from.exp_t <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
1864
+ bind $w.from.exp_t <Key-Tab> {focus [tk_focusNext %W];break}
1865
bind $w.from.exp_t <Key-Return> "do_create_branch_action $w;break"
1866
grid columnconfigure $w.from 1 -weight 1
1867
pack $w.from -anchor nw -fill x -pady 5 -padx 5
@@ -3049,7 +3049,8 @@ proc do_options {} {
3049
-width 20 \
3050
-font font_ui
3051
$w.$f.$name.v insert 0.0 [set ${f}_config_new(gui.$name)]
3052
- bind $w.$f.$name.v <Key-Tab> break
3052
+ bind $w.$f.$name.v <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
3053
+ bind $w.$f.$name.v <Key-Tab> {focus [tk_focusNext %W];break}
3054
bind $w.$f.$name.v <Key-Return> break
3055
bind $w.$f.$name.v <FocusOut> "
3056
set ${f}_config_new(gui.$name) \