awful.prompt: merge some keys

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-13 14:06:22 +01:00
parent ccfb0b1935
commit b9398ad51e
1 changed files with 12 additions and 24 deletions

View File

@ -152,31 +152,19 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
capi.keygrabber.run( capi.keygrabber.run(
function (mod, key) function (mod, key)
-- Get out cases -- Get out cases
if mod.Control then if (mod.Control and (key == "c" or key == "g"))
if key == "c" or key == "g" then or (not mod.Control and key == "Escape") then
textbox.text = "" textbox.text = ""
if done_callback then done_callback() end if done_callback then done_callback() end
return false return false
elseif key == "j" or key == "m" then elseif (mod.Control and (key == "j" or key == "m"))
or (not mod.Control and key == "Return") then
textbox.text = "" textbox.text = ""
history_add(history_path, command) history_add(history_path, command)
exe_callback(command) exe_callback(command)
if done_callback then done_callback() end if done_callback then done_callback() end
return false return false
end end
else
if key == "Return" then
textbox.text = ""
history_add(history_path, command)
exe_callback(command)
if done_callback then done_callback() end
return false
elseif key == "Escape" then
textbox.text = ""
if done_callback then done_callback() end
return false
end
end
-- Control cases -- Control cases
if mod.Control then if mod.Control then