zsh-workers
 help / color / mirror / code / Atom feed
From: gwing@primenet.com.au
To: zsh-workers@math.gatech.edu (zsh-workers)
Subject: zle_refresh patch 2
Date: Mon, 3 Feb 1997 21:55:33 +1100 (EST)	[thread overview]
Message-ID: <19970203105533.19149.qmail@primenet.com.au> (raw)

Heyla, 
this goes on top of zsh-workers/2817

It fixes coredumps and bad displays when terms are 1 or 2 lines.
When a terminal is 1 or 2 lines high, the terminal will act as if 
SINGLE_LINE_ZLE is set.  This avoids many problems with the status line.
I also noticed a very minor display problem with singlerefresh(), but it
must have already been present previously - there's an off-by-one calculation
which makes the display slightly wrong.  If I get some more time later 
(unlikely before the weekend) I'll fix it.

BTW, I put some code in utils.c - that's mainly laziness / lack of time
on my part - it's there as a safety net because I didn't check every possible
startup situation.  Ah well...


*** utils.c.org	Mon Feb  3 21:37:39 1997
--- utils.c	Mon Feb  3 21:38:15 1997
***************
*** 864,869 ****
--- 864,873 ----
      if (oldrows != lines)
  	setintenv("LINES", lines);
  #endif   /*  TIOCGWINSZ */
+     if (isset(SINGLELINEZLE) || termok != TERM_OK || lines < 3) /* safety */
+ 	shortterm = 1;
+     else
+ 	shortterm = 0;
  }
  
  /* Move a fd to a place >= 10 and mark the new fd in fdtable.  If the fd *

*** zle.h.~2~	Fri Jan 24 22:50:08 1997
--- zle.h	Mon Feb  3 21:31:47 1997
***************
*** 106,111 ****
--- 106,114 ----
  /* height of left prompt */
  ZLEXTERN int lppth;
  
+ /* terminal is too short to do anything */
+ ZLEXTERN int shortterm;
+ 
  /* last named command done */
  ZLEXTERN int lastnamed;
  
*** zle_misc.c.~2~	Fri Jan 24 22:50:08 1997
--- zle_misc.c	Mon Feb  3 21:33:29 1997
***************
*** 763,769 ****
  void
  tsetcap(int cap, int flag)
  {
!     if (termok && unset(SINGLELINEZLE) && tcstr[cap]) {
  	switch(flag) {
  	case -1:
  	    tputs(tcstr[cap], 1, putraw);
--- 763,769 ----
  void
  tsetcap(int cap, int flag)
  {
!     if (!shortterm) {
  	switch(flag) {
  	case -1:
  	    tputs(tcstr[cap], 1, putraw);

*** zle_refresh.c.~2~	Fri Jan 24 22:50:08 1997
--- zle_refresh.c	Mon Feb  3 21:32:59 1997
***************
*** 72,78 ****
   
      genprompts();
      winw = columns;  /* terminal width */
!     if (isset(SINGLELINEZLE) || termok != TERM_OK)
  	winh = 1;
      else
  	winh = (lines < 2) ? 24 : lines;
--- 72,78 ----
   
      genprompts();
      winw = columns;  /* terminal width */
!     if (shortterm)
  	winh = 1;
      else
  	winh = (lines < 2) ? 24 : lines;
***************
*** 245,250 ****
--- 245,254 ----
  
      cleareol = 0;		/* unset */
      more_start = more_end = 0;	/* unset */
+     if (isset(SINGLELINEZLE) || termok != TERM_OK || lines < 3)
+ 	shortterm = 1;
+     else
+ 	shortterm = 0;
      if (resetneeded) {
  	onumscrolls = 0;
  	setterm();
***************
*** 271,277 ****
                  cleareol = 1;   /* request: clear to end of line */
          if (t0 > -1)
              olnct = t0;
!         if (isset(SINGLELINEZLE) || termok != TERM_OK)
              vcs = 0;
          else if (!clearflag && lpptlen)
              zwrite(lpptbuf, lpptlen, 1, shout);
--- 275,281 ----
                  cleareol = 1;   /* request: clear to end of line */
          if (t0 > -1)
              olnct = t0;
!         if (shortterm)
              vcs = 0;
          else if (!clearflag && lpptlen)
              zwrite(lpptbuf, lpptlen, 1, shout);
***************
*** 288,294 ****
  /* now winw equals columns and winh equals lines 
     width comparisons can be made with winw, height comparisons with winh */
  
!     if (isset(SINGLELINEZLE) || termok != TERM_OK) {
  	singlerefresh();
  	return;
      }
--- 292,298 ----
  /* now winw equals columns and winh equals lines 
     width comparisons can be made with winw, height comparisons with winh */
  
!     if (shortterm) {
  	singlerefresh();
  	return;
      }
***************
*** 355,360 ****
--- 359,371 ----
  
      if (statusline) {
  	tosln = ln + 1;
+         if (ln == winh - 1) {
+ 	    if (nvln > 0) {
+ 		scrollwindow(0);
+ 		nvln--;
+ 	    }
+ 	    tosln--;
+ 	}
  	snextline
  	t = (unsigned char *)statusline;
  	for (; t < (unsigned char *)statusline + statusll; t++) {



-- 
Geoff Wing [gwing@primenet.com.au]   Technical Manager
  Phone    : +61-3-9818 2977         PrimeNet - Internet Consultancy
  Facsimile: +61-3-9819 3788         Web : <URL:http://www.primenet.com.au/>
  Mobile   : 0412 162 441


             reply	other threads:[~1997-02-03 11:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-03 10:55 gwing [this message]
1997-02-03 18:05 ` Bart Schaefer
1997-02-03 18:34   ` gwing
1997-02-03 19:03     ` Bart Schaefer
1997-02-04  8:25     ` Peter Stephenson
1997-03-05 20:56   ` Zoltan T. Hidvegi
1997-03-05 21:55     ` Bart Schaefer
1997-03-05 23:06       ` Bart Schaefer
1997-03-05 23:47         ` Zoltan T. Hidvegi
1997-03-06  0:51           ` Bart Schaefer
1997-03-06  3:56             ` gwing
1997-03-06  4:58               ` Bart Schaefer
1997-03-06  5:03                 ` gwing
1997-03-06 18:32                   ` Zoltan T. Hidvegi
1997-03-06 18:58             ` Zoltan T. Hidvegi
1997-03-05 23:52 Zoltan T. Hidvegi

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=19970203105533.19149.qmail@primenet.com.au \
    --to=gwing@primenet.com.au \
    --cc=zsh-workers@math.gatech.edu \
    /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).