zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Bart Schaefer <schaefer@candle.brasslantern.com>
Cc: Zsh hackers list <zsh-workers@sunsite.auc.dk>
Subject: Re: parse errors and up-line-or-history
Date: Thu, 19 Oct 2000 00:10:54 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.21.0010190000230.26533-100000@phong.blorf.net> (raw)
In-Reply-To: <1001018153811.ZM4426@candle.brasslantern.com>

On Wed, 18 Oct 2000, Bart Schaefer wrote:
> Aha!  It's HIST_REDUCE_BLANKS!  Unset that option, and the entire command
> line makes it into the history.

Yes, histreduceblanks() expects all the content on the line to be
represented in the chwords[] array so that it can tell which spaces are
significant and which aren't.  There are a few solutions I can think of.
One would be to add the unparsed part of the line to chwords[].  Another
would be to have histreduceblanks() notice the extra content beyond the
last chwords[] item and preserve it.  The easiest one, though, is to not
try to reduce the blanks on a line that didn't parse right.  I opted for
this last solution for now:

Index: Src/hist.c
@@ -1063,11 +1063,12 @@
 	}
 #endif
 	/* get rid of pesky \n which we've already nulled out */
-	if (chwordpos > 1 && !chline[chwords[chwordpos-2]])
+	if (chwordpos > 1 && !chline[chwords[chwordpos-2]]) {
 	    chwordpos -= 2;
-	/* strip superfluous blanks, if desired */
-	if (isset(HISTREDUCEBLANKS))
-	    histreduceblanks();
+	    /* strip superfluous blanks, if desired */
+	    if (isset(HISTREDUCEBLANKS))
+		histreduceblanks();
+	}
 	if ((isset(HISTIGNOREDUPS) || isset(HISTIGNOREALLDUPS)) && he
 	 && histstrcmp(chline, he->text) == 0) {
 	    /* This history entry compares the same as the previous.

I've tested this, and it appears to work fine, so I think I'll go ahead
and check it in.

..wayne..


      reply	other threads:[~2000-10-19  7:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-17 19:35 E. Jay Berkenbilt
2000-10-17 21:21 ` Bart Schaefer
2000-10-17 23:03   ` E. Jay Berkenbilt
2000-10-18  9:08   ` Peter Stephenson
2000-10-18 15:38     ` Bart Schaefer
2000-10-19  7:10       ` Wayne Davison [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=Pine.LNX.4.21.0010190000230.26533-100000@phong.blorf.net \
    --to=wayned@users.sourceforge.net \
    --cc=schaefer@candle.brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).