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

Re: Bug: magic-space and expand-history delete part of line since 5.0.8



On Mon, 31 Aug 2015 19:32:23 -0700
Jacob Niehus <jacob.niehus@xxxxxxxxx> wrote:
> Since zsh 5.0.8, using magic-space or expand-history can delete part of the
> command line for no apparent reason. This does not occur in 5.0.7 or 5.0.5.
> 
> To reproduce:
> 
>     $ zsh -f
>     $ bindkey ' ' magic-space
> 
> type this:
> 
>     $ vim =(ls) -c 'foo'
> 
> move the cursor between 's)' and type '|' then space, and it changes to this:
> 
>     $ vim =(ls| )
> 
> "-c 'foo'" has been deleted.

This function is low-level enough, and ctxtlex() already nasty enough,
that I hope the following is good enough.

It would be good to add a test for this, but I think this is way beyond
my interactive-test-fu.

pws

diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 97bdcc0..b1a6f9e 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2812,6 +2812,8 @@ doexpandhist(void)
     do {
 	ctxtlex();
     } while (tok != ENDINPUT && tok != LEXERR);
+    if (tok == LEXERR)
+	lexstop = 0;
     while (!lexstop)
 	hgetc();
     /* We have to save errflags because it's reset in zcontext_restore. Since  *



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