Weed out look completions not starting with current word.

Some versions of the default word list for look may return
non-completable entries (e.g. due to sort order mismatch -- dictionary
vs non-dictionary one, case sensitivity etc -- between sort order in
default word list and look's defaults).  As a side effect, fixes also
the test case when a lot of words are returned.
This commit is contained in:
Ville Skyttä 2010-01-16 16:06:48 +02:00
parent f0c717b2be
commit f8eec776e2
3 changed files with 5 additions and 3 deletions

View File

@ -25,7 +25,7 @@ bash-completion (2.x)
* Apply cardctl completion to pccardctl too. * Apply cardctl completion to pccardctl too.
* Apply pine completion to alpine too. * Apply pine completion to alpine too.
* Remove many unnecessary short option completions where long ones exist. * Remove many unnecessary short option completions where long ones exist.
* Improve chsh, configure, cvs, gkrellm, lftp, mdadm, modprobe, mplayer, * Improve chsh, configure, cvs, gkrellm, lftp, look, mdadm, modprobe, mplayer,
mysqladmin, rsync, screen, service, scp, ssh, sshfs, update-alternatives, mysqladmin, rsync, screen, service, scp, ssh, sshfs, update-alternatives,
vncviewer, yp-tools, and general hostname completions. vncviewer, yp-tools, and general hostname completions.
* Add abook and wtf completion, based on work by Raphaël Droz. * Add abook and wtf completion, based on work by Raphaël Droz.

View File

@ -1622,7 +1622,7 @@ _look()
cur=`_get_cword` cur=`_get_cword`
if [ $COMP_CWORD = 1 ]; then if [ $COMP_CWORD = 1 ]; then
COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' ) ) COMPREPLY=( $( compgen -W '$(look "$cur" 2>/dev/null)' -- "$cur" ) )
fi fi
} && } &&
complete -F _look -o default look complete -F _look -o default look

View File

@ -11,7 +11,9 @@ proc teardown {} {
setup setup
assert_complete_any "look foo" if {[assert_exec {look foo | grep ^foo} words]} {
assert_complete $words "look foo"
}; # if
sync_after_int sync_after_int