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

Re: unsetopt banghist does not work.



Tanaka Akira wrote:
> I found a problem about banghist.
> 
> Z(2):akr@is27e1u11% zsh-3.1.6-test-3 -f
> is27e1u11% unsetopt banghist
> is27e1u11% echo !!
> echo unsetopt banghist
> unsetopt banghist
> is27e1u11% 
> 
> pws-21 works well, but pws-22 has same behaviour to test-3.

I searched for BANGHIST in the archive, but I couldn't find the relevant
change, the last one is 6542, but there must be one later --- is it
working?

The following ought to work (the first hunk is just because the logic
confused me), but could everybody please try this on the favourite mode of
history usage.  Judging by the fact that it's been there for weeks, nobody
uses nobanghist anyway.

This had better be the last major bug.

I suppose I'm going to be told the following is just how history is
supposed to work?

  % unsetopt banghist
  % echo !!
  !!
  % setopt banghist
  % !!
  zsh: no such word in event

(it recovers after that).

--- Src/hist.c~	Mon Jul 19 17:43:17 1999
+++ Src/hist.c	Fri Jul 30 10:27:17 1999
@@ -700,7 +700,7 @@
 {
     isfirstln = isfirstch = 1;
     errflag = histdone = spaceflag = 0;
-    stophist = (dohist ? ((!interact || unset(SHINSTDIN)) << 1) : 2);
+    stophist = (!dohist || !interact || unset(SHINSTDIN)) ? 2 : 0;
     if (stophist == 2 || (inbufflags & INP_ALIAS)) {
 	chline = hptr = NULL;
 	hlinesz = 0;
@@ -721,6 +721,8 @@
 	hwbegin = ihwbegin;
 	hwend = ihwend;
 	addtoline = iaddtoline;
+	if (!isset(BANGHIST))
+	    stophist = 2;
     }
     chwordpos = 0;
 

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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