On Sun, Mar 4, 2012 at 4:55 AM, Uli Schlachter <psyc...@znc.in> wrote:
> However, the second patch doesn't convince me:
> Please don't remove any return statements, but replace them with "return"
> (unless at the end of the function). There are three such changes in the 
> patch.

I suck :'(.

-- 
Anurag Priyam
From 0fb20e67e9a9c1502c7d7cb15cbab4c62340f841 Mon Sep 17 00:00:00 2001
From: Anurag Priyam <anurag08pri...@gmail.com>
Date: Sun, 4 Mar 2012 15:53:49 -0500
Subject: [PATCH] awful.prompt: remove superfluous return true from
 keygrabber's callback

Returning true from the callback to `keygrabber` is no longer necessary to
continue grabbing the keyboard.

Signed-off-by: Anurag Priyam <anurag08pri...@gmail.com>
---
 lib/awful/prompt.lua.in |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in
index d552c1a..61f777b 100644
--- a/lib/awful/prompt.lua.in
+++ b/lib/awful/prompt.lua.in
@@ -204,7 +204,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
 
     capi.keygrabber.run(
     function (modifiers, key, event)
-        if event ~= "press" then return true end
+        if event ~= "press" then return end
         -- Convert index array to hash table
         local mod = {}
         for k, v in ipairs(modifiers) do mod[v] = true end
@@ -221,7 +221,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
             exec()
             -- We already unregistered ourselves so we don't want to return
             -- true, otherwise we may unregister someone else.
-            return true
+            return
         end
 
         -- Control cases
@@ -313,7 +313,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
             if completion_callback then
                 if key == "Tab" or key == "ISO_Left_Tab" then
                     if key == "ISO_Left_Tab" then
-                        if ncomp == 1 then return true end
+                        if ncomp == 1 then return end
                         if ncomp == 2 then
                             command = command_before_comp
                             textbox:set_font(font)
@@ -321,7 +321,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
                                 text = command_before_comp, text_color = inv_col, cursor_color = cur_col,
                                 cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
                                 prompt = prettyprompt })
-                            return true
+                            return
                         end
 
                         ncomp = ncomp - 2
@@ -336,7 +336,7 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
                     -- execute if only one match found and autoexec flag set
                     if matches and #matches == 1 and args.autoexec then
                         exec()
-                        return true
+                        return
                     end
                 else
                     ncomp = 1
@@ -430,8 +430,6 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
             cur_pos = cur_pos - 1
             success = pcall(update)
         end
-
-        return true
     end)
 end
 
-- 
1.7.5.4

Reply via email to