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

Re: Brace list completion errors when pre-brace word contains escaped characters



Completion inside braces is extremely difficult, because braces are a form
of expansion that turns one word into multiple words.  To "correctly" do 
completion in braces, it's necessary to first expand to all the possible
individual words, try them against the source data (e.g., list of files),
collect all the new suffixes, remove the part of the prefix that was
orginally outside the braces, use the remaining prefix to figure out where
the commas should be placed, and finally either insert or list the possible
suffixes.

The first problem is that the first step -- expand to all the possible
new words -- has to process/remove the backslashes or other special
characters to accurately match e.g. file names.  It becomes impossible
to do any simple comparisons to find the new suffixes or the original
common prefix, much less figure out where to relocate the commas.

There are similar problems with completing special characters elsewhere;
in those cases you might notice that completion discards one form of
quoting in favor of another, just to simplify the result enough to be
able to rebuild the command line.  This doesn't work with braces, so
the problem is magnified.

Now consider what happens if you have two sets of braces on the line,
or are asked to complete-in-word in a set of braces in the middle of a
line, or both, and so on.

Volunteers to dive into the C code and do a better job of implementing
this, are encouraged.



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