Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] _redirect: add missing 'context' arg to _dispatch
- X-seq: zsh-workers 50421
- From: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] _redirect: add missing 'context' arg to _dispatch
- Date: Fri, 22 Jul 2022 18:16:41 +0900
- Archived-at: <https://zsh.org/workers/50421>
- List-id: <zsh-workers.zsh.org>
In zshcompsys(1), in the description of the special context
-redirect-,
zstyle ':completion:*:*:-redirect-,2>,*:*' file-patterns '*.log'
is another way to make completion after `2> <TAB>' complete files
matching `*.log'.
This works fine. But if I try the following to restrict this
to a specific command, say make,
zstyle ':completion:*:*:-redirect-,2>,make:*' file-patterns '*.log'
it does not work; 'make 2> <TAB>' offers all the files.
'make 2> ^Xh' shows:
tags in context :completion::complete:-redirect-,2>,/usr/bin/make::
globbed-files (_files _redirect)
so the context includes not 'make' but '/usr/bin/make'.
I think the problem is in the last line of _redirect:
_dispatch -redirect-,{${compstate[redirect]},-default-},${^strs}
The 'context' argument to _dispatch is missing, so the 1st
word of the results of the brace expansion (with RC_EXPAND_PARAM)
is used as the 'context'.
_value has a similar use of _dispatch with explicit 'context' arg.
diff --git a/Completion/Zsh/Context/_redirect b/Completion/Zsh/Context/_redirect
index e6da5d115..520a7666e 100644
--- a/Completion/Zsh/Context/_redirect
+++ b/Completion/Zsh/Context/_redirect
@@ -15,4 +15,5 @@ if [[ "$CURRENT" != "1" ]]; then
fi
fi
-_dispatch -redirect-,{${compstate[redirect]},-default-},${^strs}
+_dispatch -redirect-,${compstate[redirect]},$_comp_command \
+ -redirect-,{${compstate[redirect]},-default-},${^strs}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author