git-gui: Fully select a field when entering into it.
If the user is tabbing through fields in the options dialog they are likely to want to just enter a new value for the field, rather than edit the value in-place. This is easier if we select the entire value upon focusing into the field. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Jan 21, 2007 at 16:43 UTC
b36ffe800d830556e8df7eda8743c15dfac70e27
1 file changed
+3
git-gui.sh
+3
@@ -3036,6 +3036,7 @@ proc do_options {} {
3036
-from 1 -to 99 -increment 1 \
3037
-width 3 \
3038
-font font_ui
3039
+ bind $w.$f.$name.v <FocusIn> {%W selection range 0 end}
3040
pack $w.$f.$name.v -side right -anchor e -padx 5
3041
pack $w.$f.$name -side top -anchor w -fill x
3042
}
@@ -3052,6 +3053,7 @@ proc do_options {} {
3053
bind $w.$f.$name.v <Shift-Key-Tab> {focus [tk_focusPrev %W];break}
3054
bind $w.$f.$name.v <Key-Tab> {focus [tk_focusNext %W];break}
3055
bind $w.$f.$name.v <Key-Return> break
3056
+ bind $w.$f.$name.v <FocusIn> "$w.$f.$name.v tag add sel 0.0 end"
3057
bind $w.$f.$name.v <FocusOut> "
3058
set ${f}_config_new(gui.$name) \
3059
\[string trim \[$w.$f.$name.v get 0.0 end\]\]
@@ -3088,6 +3090,7 @@ proc do_options {} {
3090
-from 2 -to 80 -increment 1 \
3091
-width 3 \
3092
-font font_ui
3093
+ bind $w.global.$name.size <FocusIn> {%W selection range 0 end}
3094
pack $w.global.$name.size -side right -anchor e
3095
pack $w.global.$name.family -side right -anchor e
3096
pack $w.global.$name -side top -anchor w -fill x