Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: parse errors and up-line-or-history



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..



Messages sorted by: Reverse Date, Date, Thread, Author