awful.prompt: Fix for the new textbox

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2010-10-06 21:27:42 +02:00
parent 6b972ffde0
commit bb975a2464
1 changed files with 8 additions and 8 deletions

View File

@ -173,10 +173,10 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
if not textbox or not exe_callback then if not textbox or not exe_callback then
return return
end end
textbox.text = prompt_text_with_cursor{ textbox:set_markup(prompt_text_with_cursor{
text = text, text_color = inv_col, cursor_color = cur_col, text = text, text_color = inv_col, cursor_color = cur_col,
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall, cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
font = font, prompt = prettyprompt } font = font, prompt = prettyprompt })
capi.keygrabber.run( capi.keygrabber.run(
function (modifiers, key, event) function (modifiers, key, event)
@ -187,13 +187,13 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
-- Get out cases -- Get out cases
if (mod.Control and (key == "c" or key == "g")) if (mod.Control and (key == "c" or key == "g"))
or (not mod.Control and key == "Escape") then or (not mod.Control and key == "Escape") then
textbox.text = "" textbox:set_markup("")
if done_callback then done_callback() end if done_callback then done_callback() end
return false return false
elseif (mod.Control and (key == "j" or key == "m")) elseif (mod.Control and (key == "j" or key == "m"))
or (not mod.Control and key == "Return") or (not mod.Control and key == "Return")
or (not mod.Control and key == "KP_Enter") then or (not mod.Control and key == "KP_Enter") then
textbox.text = "" textbox:set_markup("")
history_add(history_path, command) history_add(history_path, command)
capi.keygrabber.stop() capi.keygrabber.stop()
exe_callback(command) exe_callback(command)
@ -257,10 +257,10 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
if ncomp == 1 then return true end if ncomp == 1 then return true end
if ncomp == 2 then if ncomp == 2 then
command = command_before_comp command = command_before_comp
textbox.text = prompt_text_with_cursor{ textbox:set_markup(prompt_text_with_cursor{
text = command_before_comp, text_color = inv_col, cursor_color = cur_col, text = command_before_comp, text_color = inv_col, cursor_color = cur_col,
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall, cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
font = font, prompt = prettyprompt } font = font, prompt = prettyprompt })
return true return true
end end
@ -342,10 +342,10 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
-- Update textbox -- Update textbox
local function update() local function update()
textbox.text = prompt_text_with_cursor{ textbox:set_markup(prompt_text_with_cursor{
text = command, text_color = inv_col, cursor_color = cur_col, text = command, text_color = inv_col, cursor_color = cur_col,
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall, cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
font = font, prompt = prettyprompt } font = font, prompt = prettyprompt })
end end
local success = pcall(update) local success = pcall(update)