zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Ctrl-c not working during correction with 5.1
Date: Thu, 03 Sep 2015 17:39:05 +0100	[thread overview]
Message-ID: <20150903173905.5b53abd2@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <87wpw9vuek.fsf@gmail.com>

On Wed, 2 Sep 2015 15:10:43 +0200
Christian Neukirchen <chneukirchen@gmail.com> wrote:
> zsh 5.1 (x86_64-unknown-linux-gnu)
> zsh-5.1-0-g11189c6
> % zsh -f
> juno% setopt NOALWAYSLASTPROMPT PROMPT_SUBST
> juno% PS1='$(echo foo)%# '
> foo% ls /usr/share/man/man1/<PRESS TAB HERE>
> zsh: do you wish to see all 2528 possibilities (1264 lines)? <PRESS ^C HERE>n
> $(echo ls /usr/share/man/man1/
> foo% 
> 
> Somehow the unevaluated PS1 is printed.

I see what's happened --- in the old days we reset the error flag which
cancelled both an error and interrupt; now it only cancels an error.
However, this is one of the small number of special places where we
don't want an interrupt to take us back to the original prompt --- it
should simply cancel the query and redraw the line.

I think if we do have an error or interrupt we should not be executing
the recursive zrefresh() that was causing the bad prompt; that would
have meant the interrupt took us back to a new prompt, which would
presumably be the correct behaviour if we *didn't* reset the interrupt.
I've added that, but I don't know anywhere the difference is visible
now.

pws

diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 78046fb..0c28c0a 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -1761,7 +1761,8 @@ singlelineout:
 	inlist = 1;
 	listmatches();
 	inlist = 0;
-	zrefresh();
+	if (!errflag)
+	    zrefresh();
     }
     if (showinglist == -1)
 	showinglist = nlnct;
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index d1d3206..9751f7a 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1183,6 +1183,11 @@ getzlequery(void)
 
     /* get a character from the tty and interpret it */
     c = getfullchar(0);
+    /*
+     * We'll interpret an interruption here as only interrupting the
+     * query, not the line editor.
+     */
+    errflag &= ~ERRFLAG_INT;
     if (c == ZWC('\t'))
 	c = ZWC('y');
     else if (ZC_icntrl(c) || c == ZLEEOF)


      parent reply	other threads:[~2015-09-03 16:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01 14:10 Markus Trippelsdorf
2015-09-01 18:15 ` Bart Schaefer
2015-09-02 13:10   ` Christian Neukirchen
2015-09-02 14:09     ` Bart Schaefer
2015-09-03  2:32     ` Bart Schaefer
2015-09-03  3:00       ` Mikael Magnusson
2015-09-10 15:09         ` PATCH: Builtin exit from inside ZLE widget Bart Schaefer
2015-09-03  3:17       ` Ctrl-c not working during correction with 5.1 Bart Schaefer
2015-09-03 13:21         ` Christian Neukirchen
2015-09-03 16:39     ` 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=20150903173905.5b53abd2@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).