From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 319 invoked by alias); 25 Jan 2018 10:15:22 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42325 Received: (qmail 2449 invoked by uid 1010); 25 Jan 2018 10:15:22 -0000 X-Qmail-Scanner-Diagnostics: from mail-yb0-f182.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.213.182):SA:0(-1.9/5.0):. Processed in 2.188134 secs); 25 Jan 2018 10:15:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: ismail@i10z.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PiwmHI/hi9DZYq7SGfl14sTXneUFyVC4s4lYfb8ce7s=; b=KW86oroVt/QL3ekhAwe5lvg5IG3AaPxDZaxzqYLRqAMm5KJ/ykghO8A5a/NSNOMOCa zcqCFlnCxM/i1OFLpMvuI35PSJOhjrZhInDQ80WAmMGTACzDBNpDYB0Y60LEpA+NfPxr 7IRRPyA74iHGvbkCoaG3fEaqlMLMF0LtZuP7beFpLJ4VWPyByag09HFAfWUrhyYS9+FS aCsvxKYw1FsAC/Khap4krPj8Y/Sy2b4P9p7OiPdFZvuBqmnZXUrBqxYeEAeBTQLP4km3 gYOZ+E8ISpkvqsSPrXOaLVfIFFOlGJ32GKv6aZJBloVj4epsDnRYPSjltlQysvNHDFQh w3xA== X-Gm-Message-State: AKwxyteEIFgnlzR8qICIC/EYyJslhcEh4G/9GhkDkfIwQsqBEjY36+3K wrlmwxI0+jRDEaOq2UFaFto4+xvQCGAnhbKooyukdg== X-Google-Smtp-Source: AH8x22690ICJQcHYM30BGOh9XxbdGAAA9hLig4er+rkvLBgx+ix2xC9uXsh9aZSVndvGUOkFUOYpuYuvSbM/eSDok1g= X-Received: by 10.37.20.215 with SMTP id 206mr7757300ybu.505.1516875316263; Thu, 25 Jan 2018 02:15:16 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20180124142102.7722a1d8@pwslap01u.europe.root.pri> References: <20180124142102.7722a1d8@pwslap01u.europe.root.pri> From: =?UTF-8?B?xLBzbWFpbCBEw7ZubWV6?= Date: Thu, 25 Jan 2018 11:14:46 +0100 Message-ID: Subject: Re: INTERACTIVE_COMMENTS regression To: Peter Stephenson Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 24, 2018 at 3:21 PM, Peter Stephenson wrote: > On Wed, 24 Jan 2018 14:50:23 +0100 > =C4=B0smail D=C3=B6nmez wrote: >> With the latest git head: >> >> ~ > setopt INTERACTIVE_COMMENTS >> ~ > # ls >> >> ~ > 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 =3D addtoline; > hs->hlinesz =3D hlinesz; > hs->defev =3D defev; > + hs->hist_aborted =3D 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 =3D hs->addtoline; > hlinesz =3D hs->hlinesz; > defev =3D hs->defev; > + hist_aborted =3D hs->hist_aborted; > if (cmdstack) > zfree(cmdstack, CMDSTACKSZ); > cmdstack =3D hs->cstack; > @@ -1462,7 +1467,7 @@ hend(Eprog prog) > } else > save =3D 0; > } > - if (chwordpos <=3D 2) > + if (chwordpos <=3D 2 && !hist_aborted) > save =3D 0; > else if (should_ignore_line(prog)) > save =3D -1; > @@ -1565,6 +1570,7 @@ hend(Eprog prog) > */ > while (histsave_stack_pos > stack_pos) > pophiststack(); > + hist_aborted =3D 0; > unqueue_signals(); > return !(flag & HISTFLAG_NOEXEC || errflag); > } > @@ -1591,6 +1597,7 @@ ihwabort(void) > { > if (chwordpos%2) > chwordpos--; > + hist_aborted =3D 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