awful.completion: escape spaces
This patch add a bash_escape function for bash completion, at the moment it only escape spaces, other escaping may easily be added Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
3cc60e84dc
commit
74188a07df
|
@ -39,6 +39,11 @@ function bashcomp_load(src)
|
|||
end
|
||||
end
|
||||
|
||||
local function bash_escape(str)
|
||||
res = str:gsub(" ", "\\ ")
|
||||
return res
|
||||
end
|
||||
|
||||
--- Use bash completion system to complete command and filename.
|
||||
-- @param command The command line.
|
||||
-- @param cur_pos The cursor position.
|
||||
|
@ -96,7 +101,7 @@ function bash(command, cur_pos, ncomp)
|
|||
while true do
|
||||
local line = c:read("*line")
|
||||
if not line then break end
|
||||
table.insert(output, line)
|
||||
table.insert(output, bash_escape(line))
|
||||
end
|
||||
|
||||
c:close()
|
||||
|
|
Loading…
Reference in New Issue