From ed444f9b1a912df3110a8a987975ae9176e01d12 Mon Sep 17 00:00:00 2001 From: Alexander Yakushev Date: Thu, 1 Mar 2012 19:01:23 +0200 Subject: [PATCH] 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 --- lib/awful/prompt.lua.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/awful/prompt.lua.in b/lib/awful/prompt.lua.in index 61f777b3..5d294ae5 100644 --- a/lib/awful/prompt.lua.in +++ b/lib/awful/prompt.lua.in @@ -202,6 +202,15 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his if done_callback then done_callback() 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( function (modifiers, key, event) if event ~= "press" then return end @@ -406,15 +415,6 @@ function run(args, textbox, exe_callback, completion_callback, history_path, his selectall = nil 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) while not success do -- TODO UGLY HACK TODO