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,30 +152,18 @@ 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"))
textbox.text = "" or (not mod.Control and key == "Return") then
history_add(history_path, command) textbox.text = ""
exe_callback(command) history_add(history_path, command)
if done_callback then done_callback() end exe_callback(command)
return false if done_callback then done_callback() end
end return false
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 end
-- Control cases -- Control cases