1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-18 05:56:03 +02:00

47873: Improve completion within dynamic directory names

This commit is contained in:
Peter Stephenson 2021-01-27 11:16:55 +00:00
parent 5d14b6eb71
commit 8f42ecd8ee
4 changed files with 23 additions and 4 deletions

View File

@ -1,5 +1,10 @@
2021-01-27 Peter Stephenson <p.stephenson@samsung.com>
* 47873: Completion/Base/Core/_main_complete,
Completion/Zsh/Context/_subscript,
Functions/Chpwd/zsh_directory_name_cdr: Improve completion
within dynamic directory names ~[<here>].
* GammaFunction@vivaldi.net via Roman: 47744:
Src/Zle/zle_main.c: Fix vi-repeat-change when hooks are in use.

View File

@ -94,8 +94,18 @@ if [[ -z "$compstate[quote]" ]]; then
if [[ -o equals ]] && compset -P 1 '='; then
compstate[context]=equal
elif [[ "$PREFIX" != */* && "$PREFIX[1]" = '~' ]]; then
compset -p 1
compstate[context]=tilde
if [[ "$PREFIX" = '~['[^\]]# ]]; then
# Inside ~[...] should be treated as a subscript.
compset -p 2
# To be consistent, we ignore all but the contents of the square
# brackets.
compset -S '\]*'
compstate[context]=subscript
[[ -n $_comps[-subscript-] ]] && $_comps[-subscript-] && return
else
compset -p 1
compstate[context]=tilde
fi
fi
fi

View File

@ -1,6 +1,8 @@
#compdef -subscript-
local expl ind osuf=']' flags sep
local expl ind osuf flags sep
[[ $ISUFFIX = *\]* ]] || osuf=\]
if [[ "$1" = -q ]]; then
compquote osuf

View File

@ -16,8 +16,10 @@ elif [[ $1 = c ]]; then
typeset -a keys values
values=(${${(f)"$(cdr -l)"}/ ##/:})
keys=(${values%%:*})
local addsuffix
[[ $ISUFFIX = *\]* ]] || addsuffix='-S]'
_describe -t dir-index 'recent directory index' \
values -V unsorted -S']'
values -V unsorted $addsuffix
return
fi
fi