zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Bug: magic-space and expand-history delete part of line since 5.0.8
Date: Tue, 01 Sep 2015 11:19:15 +0100	[thread overview]
Message-ID: <20150901111915.35ef2407@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CACvCDBrevBTb4RgNvq08BRgvXAJYd_c-_9hqcMaTqmMbjJ-rFQ@mail.gmail.com>

On Mon, 31 Aug 2015 19:32:23 -0700
Jacob Niehus <jacob.niehus@gmail.com> 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  *


      parent reply	other threads:[~2015-09-01 10:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  2:32 Jacob Niehus
2015-09-01  5:27 ` Bart Schaefer
2015-09-02  8:31   ` 5.1.1? Peter Stephenson
2015-09-01 10:19 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150901111915.35ef2407@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).