awful.completion: remove keywords global variable

* move keywords global variable to generic() last parameter.
  This prevents from having table clash.

  Please udate you configuration according this feature in your
  awful.prompt.run() calls.
  If keywords parameter is missing then no completion would be
  done.

  Before:
   awful.completion.keywords = kw
   awful.prompt.run( [ ... ],
     function(t, p, n) return awful.completion.generic(t, p, n) end,
     [ ... ] )

  Now:
   awful.prompt.run( [ ... ],
     function(t, p, n) return awful.completion.generic(t, p, n, kw) end,
     [ ... ] )

Signed-off-by: Sébastien Gross <seb-awesome@chezwam.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Sébastien Gross 2008-12-18 12:18:07 +00:00 committed by Julien Danjou
parent d3a4506a43
commit 8fb0ba2417
1 changed files with 2 additions and 5 deletions

View File

@ -18,10 +18,6 @@ module("awful.completion")
local bashcomp_funcs = {} local bashcomp_funcs = {}
local bashcomp_src = "/etc/bash_completion" local bashcomp_src = "/etc/bash_completion"
--- keywords table use for the generic completion
-- should not be local
keywords = {}
--- Enable programmable bash completion in awful.completion.bash at the price of --- Enable programmable bash completion in awful.completion.bash at the price of
-- a slight overhead -- a slight overhead
-- @param src The bash completion source file, /etc/bash_completion by default. -- @param src The bash completion source file, /etc/bash_completion by default.
@ -130,8 +126,9 @@ end
-- @param text The current text the user had typed yet. -- @param text The current text the user had typed yet.
-- @param cur_pos The current cursor position. -- @param cur_pos The current cursor position.
-- @param ncomp The number of yet requested completion using current text. -- @param ncomp The number of yet requested completion using current text.
-- @param keywords The keywords table uised for completion.
-- @return The new match and the new cursor position. -- @return The new match and the new cursor position.
function generic(text, cur_pos, ncomp) function generic(text, cur_pos, ncomp, keywords)
-- The keywords table may be empty -- The keywords table may be empty
if #keywords == 0 then if #keywords == 0 then
return text, #text + 1 return text, #text + 1