Hi,

Attached are two patches that make shift+tab cycle backwards through completion-enabled awful prompt widgets. The first enables shift+tab to be caught by the keygrabber (it actually sends ISO_Left_Tab, so I have a special case that transforms that to a plain old tab), and the second uses this to add the cycling behavior to the prompt.

- Nathan
>From 5d205292b9d61d7243a1f85cfb70fd843446ec75 Mon Sep 17 00:00:00 2001
From: Nathan Weizenbaum <[EMAIL PROTECTED]>
Date: Tue, 23 Sep 2008 21:04:23 -0700
Subject: [PATCH] keygrabber: grab shift+tab

---
 keygrabber.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/keygrabber.c b/keygrabber.c
index 4fd0efd..399dced 100644
--- a/keygrabber.c
+++ b/keygrabber.c
@@ -486,6 +486,14 @@ key_press_lookup_string(xcb_key_press_event_t *e,
     if((*ksym & 0xffffff00) == 0xff00)
         return keysym_to_str(buf, buf_len, *ksym);
 
+    /* Handle Shift+Tab, which registers as ISO_Left_Tab */
+    if (*ksym == XK_ISO_Left_Tab)
+    {
+        buf[0] = (char)(XK_Tab & 0xff);
+        buf[1] = '\0';
+        return true;
+    }
+
     /* Handle other KeySym (like unicode...) */
     return keysym_to_utf8(buf, buf_len, *ksym);
 }
-- 
1.6.0.2.296.gfe33b

>From d7b32dfb53a07449f5d386f61e3963f49b9a6fc5 Mon Sep 17 00:00:00 2001
From: Nathan Weizenbaum <[EMAIL PROTECTED]>
Date: Tue, 23 Sep 2008 21:14:30 -0700
Subject: [PATCH] awful: shift+tab cycles backwards through prompts

---
 lib/awful.lua.in |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/lib/awful.lua.in b/lib/awful.lua.in
index 2ab0806..f4b8f21 100644
--- a/lib/awful.lua.in
+++ b/lib/awful.lua.in
@@ -1214,7 +1214,16 @@ function prompt.run(args, textbox, exe_callback, completion_callback, history_pa
             if completion_callback then
                 -- That's tab
                 if key:byte() == 9 then
-                    if ncomp == 1 then
+                    if mod.Shift then
+                        if ncomp == 1 then return true end
+                        if ncomp == 2 then
+                            command = command_before_comp
+                            textbox.text = prettyprompt .. prompt_text_with_cursor(command_before_comp, inv_col, cur_col, cur_pos)
+                            return true
+                        end
+
+                        ncomp = ncomp - 2
+                    elseif ncomp == 1 then
                         command_before_comp = command
                         cur_pos_before_comp = cur_pos
                     end
-- 
1.6.0.2.296.gfe33b

Reply via email to