zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _redirect: add missing 'context' arg to _dispatch
@ 2022-07-22  9:16 Jun T
  0 siblings, 0 replies; only message in thread
From: Jun T @ 2022-07-22  9:16 UTC (permalink / raw)
  To: zsh-workers

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}




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-22  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-22  9:16 [PATCH] _redirect: add missing 'context' arg to _dispatch Jun T

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).