From 61d27120769594268ffb3e27a758cfc1aff5cea9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 22 Sep 2009 17:15:49 +0200 Subject: [PATCH] awful.completion: use sort -u to sort (FS#621) Signed-off-by: Julien Danjou --- lib/awful/completion.lua.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/awful/completion.lua.in b/lib/awful/completion.lua.in index c1966956..db0391d7 100644 --- a/lib/awful/completion.lua.in +++ b/lib/awful/completion.lua.in @@ -110,12 +110,12 @@ function shell(command, cur_pos, ncomp, shell) "__print_completions() { for ((i=0;i<${#COMPREPLY[*]};i++)); do echo ${COMPREPLY[i]}; done }; " .. "COMP_WORDS=(" .. command .."); COMP_LINE=\"" .. command .. "\"; " .. "COMP_COUNT=" .. cur_pos .. "; COMP_CWORD=" .. cword_index-1 .. "; " .. - bashcomp_funcs[words[1]] .. "; __print_completions | sort -u'" + bashcomp_funcs[words[1]] .. "; __print_completions'" else shell_cmd = "/usr/bin/env bash -c 'compgen -A " .. comptype .. " " .. words[cword_index] .. "'" end end - local c, err = io.popen(shell_cmd) + local c, err = io.popen(shell_cmd .. " | sort -u") local output = {} i = 0 if c then @@ -138,8 +138,7 @@ function shell(command, cur_pos, ncomp, shell) return command, cur_pos end - -- sort and cycle - table.sort(output) + -- cycle while ncomp > #output do ncomp = ncomp - #output end