zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Leah Neukirchen <leah@vuxu.org>, zsh-workers@zsh.org
Subject: Re: History expansion surprisingly sets event designator
Date: Tue, 06 Jun 2017 18:13:41 +0100	[thread overview]
Message-ID: <20170606181341.6cc40956@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <874lvtcazi.fsf@vuxu.org>

On Tue, 6 Jun 2017 18:54:57 +0200
Leah Neukirchen <leah@vuxu.org> wrote:
> If my command line is "echo !:3" before pressing RET, it should always
> print z, even if I fiddled around with tab expansion during editing.

I see what you mean.  It's not obvious the default event propagates
from the line editor to the history line substitution performed
on input.

We can restrict the scope easily enough.

pws

diff --git a/Src/hist.c b/Src/hist.c
index 350688d..da5a8b2 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -253,6 +253,7 @@ hist_context_save(struct hist_stack *hs, int toplevel)
     hs->hwend = hwend;
     hs->addtoline = addtoline;
     hs->hlinesz = hlinesz;
+    hs->defev = defev;
     /*
      * We save and restore the command stack with history
      * as it's visible to the user interactively, so if
@@ -296,6 +297,7 @@ hist_context_restore(const struct hist_stack *hs, int toplevel)
     hwend = hs->hwend;
     addtoline = hs->addtoline;
     hlinesz = hs->hlinesz;
+    defev = hs->defev;
     if (cmdstack)
 	zfree(cmdstack, CMDSTACKSZ);
     cmdstack = hs->cstack;
diff --git a/Src/zsh.h b/Src/zsh.h
index 22f73f8..137b2a5 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2918,6 +2918,7 @@ struct hist_stack {
     int histdone;
     int stophist;
     int hlinesz;
+    zlong defev;
     char *hline;
     char *hptr;
     short *chwords;


  reply	other threads:[~2017-06-06 17:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170606161125epcas2p251421009eed052386daeae65f8bfd810@epcas2p2.samsung.com>
2017-06-06 15:50 ` Leah Neukirchen
2017-06-06 16:43   ` Peter Stephenson
2017-06-06 16:54     ` Leah Neukirchen
2017-06-06 17:13       ` Peter Stephenson [this message]
2017-06-06 21:09         ` Leah Neukirchen

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=20170606181341.6cc40956@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=leah@vuxu.org \
    --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).