Simplify _screen_sessions(), use compgen -W, fixes partial completion.

This commit is contained in:
Ville Skyttä 2010-11-05 21:28:27 +02:00
parent d68b471905
commit b7937bf2f0

View File

@ -3,16 +3,9 @@
have screen &&
_screen_sessions()
{
local pattern
if [ -n "$1" ]; then
pattern=".*$1.*"
else
pattern=".*"
fi
COMPREPLY=( $( command screen -ls | sed -ne \
's|^['$'\t'']\{1,\}\('"$cur"'[0-9]\{1,\}\.[^'$'\t'']\{1,\}\)'"$pattern"'$|\1|p' ) )
COMPREPLY=( $( compgen -W "$( command screen -ls | sed -ne \
's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' )" \
-- "$cur" ) )
} &&
_screen()
{