Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in completion with curly braces?
On 11/20/20, Felipe Contreras <felipe.contreras@xxxxxxxxx> wrote:
> Hello,
>
> While adding unquoted completions such as "stash@{0}" the completion
> system gets confused while inside the curly braces.
>
> For example, given:
>
> compadd -Q -- 'stash@{0}' 'stash@{1}'
>
> The first completion correctly generates "stash@{", but the second one
> generates curly braces, the third one does the same, and so on ad
> infinitum.
>
> I didn't specify file (-f) or any special completion, so why would zle
> attempt curly brace expansion, especially if the words contain curly
> braces, and the current character is a curly brace?
>
> Here's a simple test:
>
> ----------------------------------------
> #compdef foo
>
> _foo () {
> compadd -Q -- 'stash@{0}' 'stash@{1}'
> }
>
> _foo
This test case crashes for me, the following patch prevents the crash
and seems to restore normal operation, but there's probably some other
thing that has already gone wrong at this point,
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 787d376a19..67546d0470 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -608,7 +608,7 @@ instmatch(Cmatch m, int *scs)
r += l;
ocs = zlemetacs;
/* Re-insert the brace beginnings, if any. */
- if (brbeg) {
+ if (brbeg && m->brpl) {
int pcs = zlemetacs;
l = 0;
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author