Compare commits
5 Commits
f68589fde4
...
00abd48e5b
Author | SHA1 | Date |
---|---|---|
Ville Skyttä | 00abd48e5b | |
Ville Skyttä | cad3abfc7e | |
Ville Skyttä | 69cfaed89c | |
Ville Skyttä | 81acda727a | |
Ondrej Oprala | fa1ad7dff9 |
|
@ -320,8 +320,8 @@ __get_cword_at_cursor_by_ref()
|
|||
]]; do
|
||||
# Strip first character
|
||||
cur="${cur:1}"
|
||||
# Decrease cursor position
|
||||
((index--))
|
||||
# Decrease cursor position, staying >= 0
|
||||
[[ $index -gt 0 ]] && ((index--))
|
||||
done
|
||||
|
||||
# Does found word match cword?
|
||||
|
@ -450,8 +450,8 @@ _get_cword()
|
|||
]]; do
|
||||
# Strip first character
|
||||
cur="${cur:1}"
|
||||
# Decrease cursor position
|
||||
((index--))
|
||||
# Decrease cursor position, staying >= 0
|
||||
[[ $index -gt 0 ]] && ((index--))
|
||||
done
|
||||
|
||||
# Does found word matches cword?
|
||||
|
@ -1919,7 +1919,7 @@ _install_xspec '!*.@(mp3|ogg|pls|m3u)' gqmpeg freeamp
|
|||
_install_xspec '!*.fig' xfig
|
||||
_install_xspec '!*.@(mid?(i)|cmf)' playmidi
|
||||
_install_xspec '!*.@(mid?(i)|rmi|rcp|[gr]36|g18|mod|xm|it|x3m|s[3t]m|kar)' timidity
|
||||
_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|okta|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123
|
||||
_install_xspec '!*.@(669|abc|am[fs]|d[bs]m|dmf|far|it|mdl|m[eo]d|mid?(i)|mt[2m]|oct|okt?(a)|p[st]m|s[3t]m|ult|umx|wav|xm)' modplugplay modplug123
|
||||
_install_xspec '*.@([ao]|so|so.!(conf|*/*)|[rs]pm|gif|jp?(e)g|mp3|mp?(e)g|avi|asf|ogg|class)' vi vim gvim rvim view rview rgvim rgview gview emacs xemacs sxemacs kate kwrite
|
||||
_install_xspec '!*.@(zip|z|gz|tgz)' bzme
|
||||
# konqueror not here on purpose, it's more than a web/html browser
|
||||
|
@ -1956,21 +1956,30 @@ _minimal()
|
|||
complete -F _minimal ''
|
||||
|
||||
|
||||
# set up dynamic completion loading
|
||||
_completion_loader()
|
||||
__load_completion()
|
||||
{
|
||||
# $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier
|
||||
local cmd="${1:-_EmptycmD_}" compdir=./completions compfile dir
|
||||
local cmd="$1" compdir=./completions compfile dir
|
||||
[[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
|
||||
|
||||
for dir in ${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions $compdir; do
|
||||
for compfile in "${cmd##*/}" "${cmd##*/}".bash _"${cmd##*/}"; do
|
||||
compfile="$dir/$compfile"
|
||||
# Avoid trying to source dirs; https://bugzilla.redhat.com/903540
|
||||
[[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 124
|
||||
[[ -f "$compfile" ]] && . "$compfile" &>/dev/null && return 0
|
||||
done
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# set up dynamic completion loading
|
||||
_completion_loader()
|
||||
{
|
||||
# $1=_EmptycmD_ already for empty cmds in bash 4.3, set to it for earlier
|
||||
local cmd="${1:-_EmptycmD_}"
|
||||
|
||||
__load_completion "$cmd" && return 124
|
||||
|
||||
# Need to define *something*, otherwise there will be no completion at all.
|
||||
complete -F _minimal -- "$cmd" && return 124
|
||||
} &&
|
||||
|
@ -1986,9 +1995,7 @@ _xfunc()
|
|||
local srcfile=$1
|
||||
shift
|
||||
declare -F $1 &>/dev/null || {
|
||||
local compdir=./completions
|
||||
[[ $BASH_SOURCE == */* ]] && compdir="${BASH_SOURCE%/*}/completions"
|
||||
. "$compdir/$srcfile"
|
||||
__load_completion "$srcfile"
|
||||
}
|
||||
"$@"
|
||||
}
|
||||
|
|
|
@ -100,7 +100,6 @@ mkisofs
|
|||
mogrify
|
||||
montage
|
||||
mplayer2
|
||||
mpv
|
||||
msgsnarf
|
||||
muttng
|
||||
ncal
|
||||
|
|
|
@ -523,7 +523,6 @@ CLEANFILES = \
|
|||
mogrify \
|
||||
montage \
|
||||
mplayer2 \
|
||||
mpv \
|
||||
msgsnarf \
|
||||
muttng \
|
||||
ncal \
|
||||
|
|
|
@ -286,6 +286,6 @@ _mplayer()
|
|||
|
||||
return 0
|
||||
} &&
|
||||
complete -F _mplayer mplayer mplayer2 mencoder gmplayer kplayer mpv
|
||||
complete -F _mplayer mplayer mplayer2 mencoder gmplayer kplayer
|
||||
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
||||
|
|
|
@ -89,27 +89,24 @@ _rpm()
|
|||
_filedir spec
|
||||
return 0
|
||||
;;
|
||||
--whatprovides)
|
||||
--whatenchances|--whatprovides|--whatrecommends|--whatrequires|\
|
||||
--whatsuggests|--whatsupplements)
|
||||
if [[ "$cur" == */* ]]; then
|
||||
_filedir
|
||||
else
|
||||
# complete on capabilities
|
||||
local IFS=$'\n'
|
||||
local IFS=$'\n' fmt
|
||||
case $prev in
|
||||
*enhances) fmt=ENHANCENAME ;;
|
||||
*provides) fmt=PROVIDENAME ;;
|
||||
*recommends) fmt=RECOMMENDNAME ;;
|
||||
*requires) fmt=REQUIRENAME ;;
|
||||
*suggests) fmt=SUGGESTNAME ;;
|
||||
*supplements) fmt=SUPPLEMENTNAME ;;
|
||||
esac
|
||||
COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \
|
||||
--queryformat='%{PROVIDENAME}\n' 2>/dev/null )" \
|
||||
-- "$cur" ) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
--whatrequires)
|
||||
if [[ "$cur" == */* ]]; then
|
||||
_filedir
|
||||
else
|
||||
# complete on capabilities
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=( $( compgen -W "$( $1 -qa --nodigest --nosignature \
|
||||
--queryformat='%{REQUIRENAME}\n' 2>/dev/null )" \
|
||||
-- "$cur" ) )
|
||||
--queryformat=\"%{$fmt}\\n\" 2>/dev/null |
|
||||
command grep -vF '(none)' )" -- "$cur" ) )
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
|
@ -153,7 +150,8 @@ _rpm()
|
|||
--enhances --filesbypkg --filecaps --fileclass --filecolor
|
||||
--fileprovide --filerequire --filesbypkg --info --list
|
||||
--obsoletes --pipe --provides --queryformat= --requires
|
||||
--scripts --suggests --triggers --xml"
|
||||
--scripts --suggests --triggers --xml --recommends
|
||||
--supplements"
|
||||
|
||||
if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then
|
||||
# -qf completion
|
||||
|
@ -180,7 +178,9 @@ _rpm()
|
|||
COMPREPLY=( $( compgen -W "$opts --all --file --fileid
|
||||
--dbpath --fscontext --ftswalk --group --hdrid --last
|
||||
--package --pkgid --root= --specfile --state
|
||||
--triggeredby --whatprovides --whatrequires" \
|
||||
--triggeredby --whatenhances --whatprovides
|
||||
--whatrecommends --whatrequires --whatsuggests
|
||||
--whatsupplements" \
|
||||
-- "$cur" ) )
|
||||
elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then
|
||||
_rpm_installed_packages $1
|
||||
|
@ -200,7 +200,9 @@ _rpm()
|
|||
COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps
|
||||
--nogroup --nolinkto --nomode --nomtime --nordev --nouser
|
||||
--nofiles --noscripts --nomd5 --querytags --specfile
|
||||
--whatrequires --whatprovides" -- "$cur" ) )
|
||||
--whatenhances --whatprovides --whatrecommends
|
||||
--whatrequires --whatsuggests --whatsupplements" \
|
||||
-- "$cur" ) )
|
||||
# check whether we're doing file completion
|
||||
elif [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then
|
||||
_filedir
|
||||
|
|
|
@ -249,4 +249,18 @@ expect {
|
|||
sync_after_int
|
||||
|
||||
|
||||
set test "index shouldn't drop below 0"
|
||||
set dir $::srcdir/fixtures/_get_cword
|
||||
set cmd "scp"
|
||||
send "$cmd ääää§ se\t\r\n"
|
||||
expect {
|
||||
-re "index: substring expression < 0" { fail "$test" }
|
||||
-re /@ { pass "$test" }
|
||||
default { unresolved "$test" }
|
||||
}
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
|
Loading…
Reference in New Issue