From 9aa52f7b0ff370207da0f0c6c4b114f8d06fb17e Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 18 Jun 2008 08:41:45 +0200 Subject: [PATCH] awful: fix a bug with backspace in menu Signed-off-by: Julien Danjou --- awful.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/awful.lua b/awful.lua index 85011e9f0..f3cb324b5 100644 --- a/awful.lua +++ b/awful.lua @@ -501,8 +501,10 @@ local function menu(args, textbox, exe_callback) else -- Typin cases if key == "BackSpace" then - command = command:sub(1, cur_pos - 2) .. command:sub(cur_pos) - cur_pos = cur_pos - 1 + if cur_pos > 1 then + command = command:sub(1, cur_pos - 2) .. command:sub(cur_pos) + cur_pos = cur_pos - 1 + end -- That's DEL elseif key:byte() == 127 then command = command:sub(1, cur_pos - 1) .. command:sub(cur_pos + 1)