Skip to content

Commit 39c1269

Browse files
committed
gitk: Improve behaviour of drop-down lists
The drop-down lists used for things like the criteria for finding commits (containing/touching paths/etc.) use a combobox if we are using the ttk widgets. By default the combobox exports its value as the selection when it is changed, which is unnecessary, and sometimes the combobox wouldn't release the selection, which is annoying. To fix this, we make these comboboxes not export their selection, and also clear their selection whenever they are changed. This makes them more like a simple selection of alternatives, improving the look and feel of gitk. Signed-off-by: Paul Mackerras <[email protected]>
1 parent 252c52d commit 39c1269

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gitk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1998,6 +1998,9 @@ proc mca {str} {
19981998
return [string map {&& & & {}} [mc $str]]
19991999
}
20002000

2001+
proc cleardropsel {w} {
2002+
$w selection clear
2003+
}
20012004
proc makedroplist {w varname args} {
20022005
global use_ttk
20032006
if {$use_ttk} {
@@ -2007,7 +2010,9 @@ proc makedroplist {w varname args} {
20072010
if {$cx > $width} {set width $cx}
20082011
}
20092012
set gm [ttk::combobox $w -width $width -state readonly\
2010-
-textvariable $varname -values $args]
2013+
-textvariable $varname -values $args \
2014+
-exportselection false]
2015+
bind $gm <<ComboboxSelected>> [list $gm selection clear]
20112016
} else {
20122017
set gm [eval [linsert $args 0 tk_optionMenu $w $varname]]
20132018
}

0 commit comments

Comments
 (0)