diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Completion/Base/Core/_main_complete | 14 | ||||
-rw-r--r-- | Completion/Zsh/Context/_subscript | 4 | ||||
-rw-r--r-- | Functions/Chpwd/zsh_directory_name_cdr | 4 |
4 files changed, 23 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 4d4548e3f..2d69f05eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index 6b2cf2bcf..663f7557a 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -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 diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript index 0c9a89ad5..0d9632864 100644 --- a/Completion/Zsh/Context/_subscript +++ b/Completion/Zsh/Context/_subscript @@ -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 diff --git a/Functions/Chpwd/zsh_directory_name_cdr b/Functions/Chpwd/zsh_directory_name_cdr index cb72e4600..b653e7c38 100644 --- a/Functions/Chpwd/zsh_directory_name_cdr +++ b/Functions/Chpwd/zsh_directory_name_cdr @@ -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 |