awful.prompt: Move update() out of the keygrabber.run callback

It is required to be able to call the update() function from any point
of the keygrabber.run callback.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Alexander Yakushev 2012-03-01 19:01:23 +02:00 committed by Uli Schlachter
parent 3a44fa578e
commit ed444f9b1a
1 changed files with 9 additions and 9 deletions

View File

@ -202,6 +202,15 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
if done_callback then done_callback() end if done_callback then done_callback() end
end end
-- Update textbox
local function update()
textbox:set_font(font)
textbox:set_markup(prompt_text_with_cursor{
text = command, text_color = inv_col, cursor_color = cur_col,
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
prompt = prettyprompt })
end
capi.keygrabber.run( capi.keygrabber.run(
function (modifiers, key, event) function (modifiers, key, event)
if event ~= "press" then return end if event ~= "press" then return end
@ -406,15 +415,6 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his
selectall = nil selectall = nil
end end
-- Update textbox
local function update()
textbox:set_font(font)
textbox:set_markup(prompt_text_with_cursor{
text = command, text_color = inv_col, cursor_color = cur_col,
cursor_pos = cur_pos, cursor_ul = cur_ul, selectall = selectall,
prompt = prettyprompt })
end
local success = pcall(update) local success = pcall(update)
while not success do while not success do
-- TODO UGLY HACK TODO -- TODO UGLY HACK TODO