chiark / gitweb /
xgetline.in: Turn on mnemonics in the prompt label.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 20 Mar 2010 17:37:27 +0000 (17:37 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 21 Mar 2010 11:28:03 +0000 (11:28 +0000)
Now if your prompt contains an underscore, it'll look weird.  Nobody's
doing that, right?

debian/changelog
xgetline.1
xgetline.in

index f8e13e2cebcacc3fd6aa9f6b0840ec9fc56da387..960db9fd0c73e39a5539c1e997a49e68ae76afc8 100644 (file)
@@ -1,3 +1,9 @@
+xtoys (1.4.2) experimental; urgency=low
+
+  * xgetline: Mnemonic for the main entry box.
+
+ -- Mark Wooding <mdw@distorted.org.uk>  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.
index 22757db5bac7b065a737df84905feac32f30e575..99a4db427cbd0b696525c360052b117404b9efc7 100644 (file)
@@ -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
index 8f649d575be9a338007522b0e3c66cb6a1c05772..d21c6782cf925373d52d88cbe9aad64a5d2189ff 100644 (file)
@@ -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 == '@':