Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Don't complete escaped words as aliases
- X-seq: zsh-workers 49577
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] Don't complete escaped words as aliases
- Date: Fri, 12 Nov 2021 23:34:47 +0200
- Archived-at: <https://zsh.org/workers/49577>
- List-id: <zsh-workers.zsh.org>
It doesn't make sense to complete \escaped 'words' as aliases, since
they won't be expanded as aliases either.
From 9c8f1b6e5e3a8f60b151bccd1eea8438a40d6b23 Mon Sep 17 00:00:00 2001
From: Marlon Richert <marlonrichert@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Nov 2021 23:24:58 +0200
Subject: [PATCH] Don't complete escaped words as aliases
---
Completion/Zsh/Type/_command_names | 10 +++++++---
Test/Y01completion.ztst | 6 ++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names
index b1c35f013..3ed39141d 100644
--- a/Completion/Zsh/Type/_command_names
+++ b/Completion/Zsh/Type/_command_names
@@ -26,11 +26,15 @@ elif (( ${#precommands:|builtin_precommands} )); then
else
[[ "$1" = - ]] && shift
- defs=( "$defs[@]"
+ [[ $words[CURRENT] == ${(Q)words[CURRENT]} ]] &&
+ defs+=(
+ 'aliases:alias:compadd -Qk aliases'
+ 'suffix-aliases:suffix alias:_suffix_alias_files'
+ )
+
+ defs+=(
'builtins:builtin command:compadd -Qk builtins'
"functions:shell function:compadd -k 'functions$ffilt'"
- 'aliases:alias:compadd -Qk aliases'
- 'suffix-aliases:suffix alias:_suffix_alias_files'
'reserved-words:reserved word:compadd -Qk reswords'
'jobs:: _jobs -t'
'parameters:: _parameters -g "^*(readonly|association)*" -qS= -r "\n\t\- =[+"'
diff --git a/Test/Y01completion.ztst b/Test/Y01completion.ztst
index 882a0adc4..97886b30c 100644
--- a/Test/Y01completion.ztst
+++ b/Test/Y01completion.ztst
@@ -97,6 +97,12 @@
>FI:{file2}
F:regression test workers/42164
+ comptesteval 'alias while='
+ comptest '\while'$'\C-D'
+0:escaped words should not be completed as aliases
+>DESCRIPTION:{reserved word}
+>NO:{while}
+
# Depends on path assignment in comptestinit
comptesteval "path=( $ZTST_srcdir:A )"
comptest $'zt\t'
--
2.30.1 (Apple Git-130)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author