Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Compctl completion tweaking



Bart Schaefer wrote:

> ...
> 
> This brings up a general question, then.  Suppose for the moment that we
> do choose ++ to mean inclusive-or.  Suppose I have:
> 
>     compctl -x 'c[-1,-m]' -P '%' -u ++ -P '+' -f -W ~/Mail -- zmail
> 
> I.e., "user names prefixed with % or files in ~/Mail prefixed with +".  
> What does the list of completions look like before any + or % is present
> on the command line?  If there's both a file and a user named "schaefer",
> which prefix gets inserted?
> 

This is one of the things I am worrying about (and which kept me from
trying to implement it...).

First, I would try to change the behaviour of -P (and -S) so that they 
are not inserted straight away, but instead saved together with the
corresponding matches (one of the reasons to store prefixes and
suffixes with the matches). Then, if we find out that only one prefix
is used for all matches, it becomes easy. Otherwise (the case you
described above), if menucompletion or automenu is used, the prefixes
are walked through, too (note also, that storing prefixes and suffixes 
that have to be inserted into the command line with the matches
inhibits removing matches that merely have the same matching word, so
in your example we would have `schaefer' with `+' and `schaefer' with
`%' in the list of matches). If menucompletion is not used, we could
at least try to insert the unambiguous part (`schaefer'), leaving the
cursor at the place where the ambiguous part began, the user would
have to insert something to make it unambiguous, of course. In your
example where we only had one-character-prefixes, this is pretty
simple (typing either `+' or `%'). More problematic is the case where
we have prefixes like, say `barrr' and `bazzz'. The completion code
would insert the `ba', leaving the cursor after it to let the user
make it unambiuous. With completeinword set, the user could type
either `r' or `z' and then start completion to let zsh insert the
rest, but without completeinword (and without automenu), the user
would have to type `rrr' or `zzz' which is a bit ugly.

So, does this seem to make sense?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author