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

Re: #% anchoring doesn't work with (S)



On 2/2/23, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Could the bug be fixed? It already makes #% pretty much unusable for a
> backward compatible software, yet in say 4 years this would be changed, if
> the bug would be fixed today

Why would you use (S) (shortest possible match) with #% (match the
entire string)? It will obviously never have a useful effect other
than doing nothing.

That said, compgetmatch() does this, which is probably your problem
(it gives no real motivation for why it does this)
    /*
     * Search is anchored to the end of the string if we want to match
     * it all, or if we are matching at the end of the string and not
     * using substrings.
     */
    if ((*flp & SUB_ALL) || ((*flp & SUB_END) && !(*flp & SUB_SUBSTR)))
	patflags &= ~PAT_NOANCH;


-- 
Mikael Magnusson




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