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

Re: When does single_line_zle get set?



dnelson@xxxxxxxx wrote:
> I just compiled zsh-2.6beta9 (was using 2.6beta-3), and now, on initial
> login shells, single_line_zle mode gets set on me.  I login to an ISP via
> modem, and my terminal defaults to 'unknown'.  It seems that zsh notices
> this and sets single_line_zle (-M) on me.

Looks like the problem is that there is a termcap entry for unknown,
but it can't go up.  The following patch introduces a new state for
the termok flag: it becomes -1 if there is a termcap entry but the
terminal doesn't have up-line capability.  The shell then functions in
single line mode until a better terminal comes along, so in practice
this does what the manual page says.

*** Src/params.c.slz	Mon Jun 26 11:02:48 1995
--- Src/params.c	Mon Jun 26 11:05:39 1995
***************
*** 1662,1672 ****
  	    }
  	}
  
!     /* if there's no termcap entry for cursor up, use single line mode. */
  
  	if (!tccan(TCUP)) {
  		tcstr[TCUP] = NULL;
! 		opts[SINGLELINEZLE] = OPT_SET;
  	}
  	hasam = tgetflag("am");
      /* if there's no termcap entry for cursor left, use \b. */
--- 1662,1675 ----
  	    }
  	}
  
!     /*
!      * If there's no termcap entry for cursor up, use single line mode.
!      * termok is set to -1 to flag this.
!      */
  
  	if (!tccan(TCUP)) {
  		tcstr[TCUP] = NULL;
! 		termok = -1;
  	}
  	hasam = tgetflag("am");
      /* if there's no termcap entry for cursor left, use \b. */
*** Src/zle_misc.c.slz	Mon Jun 26 11:02:48 1995
--- Src/zle_misc.c	Mon Jun 26 11:05:37 1995
***************
*** 678,684 ****
  void
  tsetcap(int cap, int flag)
  {
!     if (termok && !isset(SINGLELINEZLE) && tcstr[cap]) {
  	if (flag == 0) 
  	    tputs(tcstr[cap], 1, putshout);
  	else {
--- 678,684 ----
  void
  tsetcap(int cap, int flag)
  {
!     if (termok == 1 && !isset(SINGLELINEZLE) && tcstr[cap]) {
  	if (flag == 0) 
  	    tputs(tcstr[cap], 1, putshout);
  	else {
*** Src/zle_refresh.c.slz	Mon Jun 26 11:02:48 1995
--- Src/zle_refresh.c	Mon Jun 26 11:05:36 1995
***************
*** 66,72 ****
      static int lwinw = -1, lwinh = -1;	/* last window width & height */
   
      winw = (columns < 1) ? (columns = 80) : columns;  /* terminal width */
!     if (isset(SINGLELINEZLE) || !termok)
  	winh = 1;
      else
  	winh = (lines < 2) ? 24 : lines;
--- 66,72 ----
      static int lwinw = -1, lwinh = -1;	/* last window width & height */
   
      winw = (columns < 1) ? (columns = 80) : columns;  /* terminal width */
!     if (isset(SINGLELINEZLE) || termok != 1)
  	winh = 1;
      else
  	winh = (lines < 2) ? 24 : lines;
***************
*** 191,197 ****
                  cleareol = 1;   /* set */
          if (t0 > -1)
              olnct = t0;
!         if (isset(SINGLELINEZLE) || !termok)
              vcs = 0;
          else if (pptlen && !clearflag) {
              fwrite(pptbuf, pptlen, 1, shout);
--- 191,197 ----
                  cleareol = 1;   /* set */
          if (t0 > -1)
              olnct = t0;
!         if (isset(SINGLELINEZLE) || termok != 1)
              vcs = 0;
          else if (pptlen && !clearflag) {
              fwrite(pptbuf, pptlen, 1, shout);
***************
*** 205,211 ****
  
  /* now winw equals columns; now all width comparisons can be made to winw */
  
!     if (isset(SINGLELINEZLE) || !termok) {
  	singlerefresh();
  	return;
      }
--- 205,211 ----
  
  /* now winw equals columns; now all width comparisons can be made to winw */
  
!     if (isset(SINGLELINEZLE) || termok != 1) {
  	singlerefresh();
  	return;
      }

-- 
Peter Stephenson <P.Stephenson@xxxxxxxxxxxxx>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.



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