zsh-workers
 help / color / mirror / code / Atom feed
* !cmd <TAB> doesn't work in 3.0.3-test3
@ 1997-01-08 23:34 Vinnie Shelton
  1997-01-09  2:22 ` Zoltan Hidvegi
  0 siblings, 1 reply; 5+ messages in thread
From: Vinnie Shelton @ 1997-01-08 23:34 UTC (permalink / raw)
  To: zsh-workers

!cmd<TAB> no longer completes is 3.03.0.3-test3.
This worked in 3.0.3-test2.

zsh -f
spacely% echo $ZSH_VERSION
3.0.3-test3
spacely% ls -d /tmp
/tmp
spacely% !ls<TAB>

This beeps and quotes the !.

It used to search the history list and complete:

ls -d /tmp

Thanks,
  vin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: !cmd <TAB> doesn't work in 3.0.3-test3
  1997-01-08 23:34 !cmd <TAB> doesn't work in 3.0.3-test3 Vinnie Shelton
@ 1997-01-09  2:22 ` Zoltan Hidvegi
  1997-01-09  6:02   ` Vinnie Shelton
  0 siblings, 1 reply; 5+ messages in thread
From: Zoltan Hidvegi @ 1997-01-09  2:22 UTC (permalink / raw)
  To: acs; +Cc: zsh-workers

> !cmd<TAB> no longer completes is 3.03.0.3-test3.
> This worked in 3.0.3-test2.
> 
> zsh -f
> spacely% echo $ZSH_VERSION
> 3.0.3-test3
> spacely% ls -d /tmp
> /tmp
> spacely% !ls<TAB>
> 
> This beeps and quotes the !.

This does not happen here, for me it expands !ls.  Does anyone else see this
problem?

Zoltan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: !cmd <TAB> doesn't work in 3.0.3-test3
  1997-01-09  2:22 ` Zoltan Hidvegi
@ 1997-01-09  6:02   ` Vinnie Shelton
  1997-01-09  9:29     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Vinnie Shelton @ 1997-01-09  6:02 UTC (permalink / raw)
  To: zsh-workers

When I backed out Peter's patch (article 2748), !cmd<TAB> worked again.

--vin

> > !cmd<TAB> no longer completes is 3.03.0.3-test3.
> > This worked in 3.0.3-test2.
> > 
> > zsh -f
> > spacely% echo $ZSH_VERSION
> > 3.0.3-test3
> > spacely% ls -d /tmp
> > /tmp
> > spacely% !ls<TAB>
> > 
> > This beeps and quotes the !.
> 
> This does not happen here, for me it expands !ls.  Does anyone else see this
> problem?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: !cmd <TAB> doesn't work in 3.0.3-test3
  1997-01-09  6:02   ` Vinnie Shelton
@ 1997-01-09  9:29     ` Peter Stephenson
  1997-01-09 17:47       ` Vinnie Shelton
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 1997-01-09  9:29 UTC (permalink / raw)
  To: zsh-workers

Vinnie Shelton wrote:
> When I backed out Peter's patch (article 2748), !cmd<TAB> worked again.
> 
> !cmd<TAB> no longer completes is 3.03.0.3-test3.

Yes, I didn't handle multiple histories on top of one another
properly:  curhist got incremented too many times.  I've also improved
readability with some #define's for histactive.  (In my defence, for
some weird reason it worked OK after running my own initialisation
files.)

*** Src/hist.c.hist1	Wed Jan  8 14:58:02 1997
--- Src/hist.c	Thu Jan  9 10:18:41 1997
***************
*** 32,50 ****
  #include "zsh.h"
  
  /*
!  * Note on histactive: bit 0 says the history mechanism is active;
!  * bit 1 says junk the line being processed by the history
!  * when finished with it if (histactive & 1); bit 2 says we have already
!  * junked a line when !(histactive & 1).
!  *
!  * Note on curhist: with !(histactive & 1), this points to the
!  * last line actually added to the history list.  With (histactive & 1),
   * the line does not get added to the list until hend(), if at all.
   * However, curhist is incremented to reflect the current line anyway.
   * Thus if the line is not added to the list, curhist must be
   * decremented in hend().
   */
  
  extern int cs, ll;
  
  /* Array of word beginnings and endings in current history line. */
--- 32,51 ----
  #include "zsh.h"
  
  /*
!  * Note on curhist: with history active, this points to the
!  * last line actually added to the history list.  With history inactive,
   * the line does not get added to the list until hend(), if at all.
   * However, curhist is incremented to reflect the current line anyway.
   * Thus if the line is not added to the list, curhist must be
   * decremented in hend().
   */
  
+ /* Bits of histactive variable */
+ #define HA_ACTIVE	(1<<0)	/* History mechanism is active */
+ #define HA_NOSTORE	(1<<1)	/* Don't store the line when finished */
+ #define HA_JUNKED	(1<<2)	/* Last history line was already junked */
+ #define HA_NOINC	(1<<3)	/* Don't store, curhist not incremented */
+ 
  extern int cs, ll;
  
  /* Array of word beginnings and endings in current history line. */
***************
*** 597,607 ****
      if (interact && isset(SHINSTDIN) && !strin) {
  	attachtty(mypgrp);
  	defev = curhist;
! 	histactive = 1;
      } else
! 	histactive = 3;
! 
!     curhist++;
  }
  
  /* say we're done using the history mechanism */
--- 598,607 ----
      if (interact && isset(SHINSTDIN) && !strin) {
  	attachtty(mypgrp);
  	defev = curhist;
! 	histactive = HA_ACTIVE;
! 	curhist++;
      } else
! 	histactive = HA_NOINC;
  }
  
  /* say we're done using the history mechanism */
***************
*** 614,624 ****
      Histent he;
  
      DPUTS(!chline, "BUG: chline is NULL in hend()");
!     if (histactive & 2) {
  	zfree(chline, hlinesz);
  	zfree(chwords, chwordlen*sizeof(short));
  	chline = NULL;
! 	curhist--;
  	histactive = 0;
  	return 1;
      }
--- 614,625 ----
      Histent he;
  
      DPUTS(!chline, "BUG: chline is NULL in hend()");
!     if (histactive & (HA_NOSTORE|HA_NOINC)) {
  	zfree(chline, hlinesz);
  	zfree(chwords, chwordlen*sizeof(short));
  	chline = NULL;
! 	if (!(histactive & HA_NOINC))
! 	    curhist--;
  	histactive = 0;
  	return 1;
      }
***************
*** 697,713 ****
  void
  remhist(void)
  {
!     if (!(histactive & 1)) {
! 	if (!(histactive & 4)) {
  	    /* make sure this doesn't show up when we do firsthist() */
  	    Histent he = gethistent(curhist);
  	    zsfree(he->text);
  	    he->text = NULL;
! 	    histactive |= 4;
  	    curhist--;
  	}
      } else
! 	histactive |= 2;
  }
  
  /* Gives current expansion word if not last word before chwordpos. */
--- 698,714 ----
  void
  remhist(void)
  {
!     if (!(histactive & HA_ACTIVE)) {
! 	if (!(histactive & HA_JUNKED)) {
  	    /* make sure this doesn't show up when we do firsthist() */
  	    Histent he = gethistent(curhist);
  	    zsfree(he->text);
  	    he->text = NULL;
! 	    histactive |= HA_JUNKED;
  	    curhist--;
  	}
      } else
! 	histactive |= HA_NOSTORE;
  }
  
  /* Gives current expansion word if not last word before chwordpos. */
***************
*** 1074,1080 ****
  
      if (ev < firsthist() || ev > curhist)
  	return NULL;
!     if (ev == curhist && (histactive & 1)) {
  	/* The current history line has not been stored.  Build it up
  	 * from other variables.
  	 */
--- 1075,1081 ----
  
      if (ev < firsthist() || ev > curhist)
  	return NULL;
!     if (ev == curhist && (histactive & HA_ACTIVE)) {
  	/* The current history line has not been stored.  Build it up
  	 * from other variables.
  	 */

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: !cmd <TAB> doesn't work in 3.0.3-test3
  1997-01-09  9:29     ` Peter Stephenson
@ 1997-01-09 17:47       ` Vinnie Shelton
  0 siblings, 0 replies; 5+ messages in thread
From: Vinnie Shelton @ 1997-01-09 17:47 UTC (permalink / raw)
  To: zsh-workers


pws@ifh.de said:
> Yes, I didn't handle multiple histories on top of one another
> properly:  curhist got incremented too many times.  I've also improved
> readability with some #define's for histactive.  (In my defence, for
> some weird reason it worked OK after running my own initialisation
> files.) 

Yup, your fix did it.  Thanks.

vin


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-01-09 17:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-08 23:34 !cmd <TAB> doesn't work in 3.0.3-test3 Vinnie Shelton
1997-01-09  2:22 ` Zoltan Hidvegi
1997-01-09  6:02   ` Vinnie Shelton
1997-01-09  9:29     ` Peter Stephenson
1997-01-09 17:47       ` Vinnie Shelton

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