From: Mark Wooding Date: Sat, 20 Mar 2010 17:37:27 +0000 (+0000) Subject: xgetline.in: Turn on mnemonics in the prompt label. X-Git-Tag: 1.4.2~1 X-Git-Url: https://git.distorted.org.uk/~mdw/xtoys/commitdiff_plain/583efdd398e53f1c84dd6591b73d044a10bd6a85 xgetline.in: Turn on mnemonics in the prompt label. Now if your prompt contains an underscore, it'll look weird. Nobody's doing that, right? --- diff --git a/debian/changelog b/debian/changelog index f8e13e2..960db9f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xtoys (1.4.2) experimental; urgency=low + + * xgetline: Mnemonic for the main entry box. + + -- Mark Wooding Sun, 21 Mar 2010 11:27:56 +0000 + xtoys (1.4.1) experimental; urgency=low * xcatch: don't destroy contents of window when it's closed. diff --git a/xgetline.1 b/xgetline.1 index 22757db..99a4db4 100644 --- a/xgetline.1 +++ b/xgetline.1 @@ -44,7 +44,7 @@ shell command attached to a hotkey: .RS 5 .ft B .nf -cmd=$(xgetline -t "Shell command in window" -p "Command:") && +cmd=$(xgetline -t "Shell command in window" -p "_Command:") && xterm -T "$cmd" -e sh -c "$cmd" .ft R .fi @@ -92,7 +92,12 @@ not type an entry in directly. .BI "\-p, \-\-prompt " prompt Sets the prompt string in the dialogue box to .IR prompt . -The default is to have no prompt string. +If the prompt string contains an underscore character +.RB ` _ ', +then the following character appears underlined; pressing Alt and the +leftmost underlined character (the `mnemonic') moves the input focus to +the entry widget. If you want a literal underscore, type two +consecutive underscores. The default is to have no prompt string. .TP 5 .BI "\-t, \-\-title " title Sets the title of the dialogue box to diff --git a/xgetline.in b/xgetline.in index 8f649d5..d21c678 100644 --- a/xgetline.in +++ b/xgetline.in @@ -215,10 +215,6 @@ def make_window(opts): box.set_border_width(4) win.add(box) - ## If we have a prompt, insert it. - if opts.prompt is not None: - box.pack_start(GTK.Label(opts.prompt), False) - ## Choose the appropriate widget. if opts.file is None: entry = SimpleEntry() @@ -238,6 +234,13 @@ def make_window(opts): else: raise + ## If we have a prompt, insert it. + if opts.prompt is not None: + label = GTK.Label(opts.prompt) + label.set_properties(mnemonic_widget = entry, + use_underline = True) + box.pack_start(label, False) + ## Insert the widget and configure it. box.pack_start(entry, True) if opts.default == '@':