Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: INTERACTIVE_COMMENTS regression
- X-seq: zsh-workers 42325
- From: İsmail Dönmez <ismail@xxxxxxxx>
- To: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: INTERACTIVE_COMMENTS regression
- Date: Thu, 25 Jan 2018 11:14:46 +0100
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=i10z.com; s=www; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=PiwmHI/hi9DZYq7SGfl14sTXneUFyVC4s4lYfb8ce7s=; b=J9SyiEBUE411zpkqtQaZMRl8KXC/JArQh3OeqEc4f+kcSS4qQ+YNdUel4Za4gNTDNn cI0tnNVxBs0IrZbCtQZwqCiiTCzCnlCF5AXXqK8IDlFI8SrZw/aoovPVZR3I+Fa+SS6F ndb0d1agySTH3qlyc/uJ7odFCRW4ia9mddLdG1m4/blYQ3u8aK+4DHlrlSDyP0cysy+P QI1R0tW85L5PnuB5knripCiTtf4KTiI3fqofJfaV1cGz80OnNQa8wMEx3KJANJlTGQ8y y5/lz0hzKpb6wFfCVILnb12MrZ6aGGQS1/84ZqbzGhn/AK7kv+O7Ow69b9SGLoJ/UX0p SjFQ==
- In-reply-to: <20180124142102.7722a1d8@pwslap01u.europe.root.pri>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20180124135136epcas4p439d2f18c7ec7dedc59b660c2daafdbd6@epcas4p4.samsung.com> <CAMAzfThpZJJDc8ZoOTpXYM0YfAND4Uox6Z3gQLZdEJc1jO4F0g@mail.gmail.com> <20180124142102.7722a1d8@pwslap01u.europe.root.pri>
On Wed, Jan 24, 2018 at 3:21 PM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Wed, 24 Jan 2018 14:50:23 +0100
> İsmail Dönmez <ismail@xxxxxxxx> wrote:
>> With the latest git head:
>>
>> ~ > setopt INTERACTIVE_COMMENTS
>> ~ > # ls
>> <Press up arrow in keyboard>
>> ~ > setopt INTERACTIVE_COMMENT
>>
>> Looks like comment is getting lost, tested the same config with zsh
>> 5.3.1 and it works fine.
>
> This isn't particularly elegant but it ought to do the trick.
> (Although when I commit it I might change the name of the
> variable to "hist_keep_comment" for clarity, come to think of it.)
>
> pws
>
>
> diff --git a/Src/hist.c b/Src/hist.c
> index e08984f..76c3df4 100644
> --- a/Src/hist.c
> +++ b/Src/hist.c
> @@ -204,6 +204,9 @@ int hlinesz;
>
> static zlong defev;
>
> +/* Flag that line was aborted but we want to keep it even if no words */
> +static int hist_aborted;
> +
> /* Remember the last line in the history file so we can find it again. */
> static struct histfile_stats {
> char *text;
> @@ -258,6 +261,7 @@ hist_context_save(struct hist_stack *hs, int toplevel)
> hs->addtoline = addtoline;
> hs->hlinesz = hlinesz;
> hs->defev = defev;
> + hs->hist_aborted = hist_aborted;
> /*
> * We save and restore the command stack with history
> * as it's visible to the user interactively, so if
> @@ -303,6 +307,7 @@ hist_context_restore(const struct hist_stack *hs, int toplevel)
> addtoline = hs->addtoline;
> hlinesz = hs->hlinesz;
> defev = hs->defev;
> + hist_aborted = hs->hist_aborted;
> if (cmdstack)
> zfree(cmdstack, CMDSTACKSZ);
> cmdstack = hs->cstack;
> @@ -1462,7 +1467,7 @@ hend(Eprog prog)
> } else
> save = 0;
> }
> - if (chwordpos <= 2)
> + if (chwordpos <= 2 && !hist_aborted)
> save = 0;
> else if (should_ignore_line(prog))
> save = -1;
> @@ -1565,6 +1570,7 @@ hend(Eprog prog)
> */
> while (histsave_stack_pos > stack_pos)
> pophiststack();
> + hist_aborted = 0;
> unqueue_signals();
> return !(flag & HISTFLAG_NOEXEC || errflag);
> }
> @@ -1591,6 +1597,7 @@ ihwabort(void)
> {
> if (chwordpos%2)
> chwordpos--;
> + hist_aborted = 1;
> }
>
> /* add a word to the history List */
> diff --git a/Src/zsh.h b/Src/zsh.h
> index ba2f8cd..8bc0125 100644
> --- a/Src/zsh.h
> +++ b/Src/zsh.h
> @@ -2997,6 +2997,7 @@ struct hist_stack {
> void (*addtoline) _((int));
> unsigned char *cstack;
> int csp;
> + int hist_aborted;
> };
>
> /*
That fixes the problem, thanks!
ismail
Messages sorted by:
Reverse Date,
Date,
Thread,
Author