zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@ny.frontiercomm.net>
To: zsh-workers@math.gatech.edu (Zsh hacking and development)
Subject: Re: test patches
Date: Sun, 11 May 1997 00:57:15 -0400 (EDT)	[thread overview]
Message-ID: <199705110457.AAA04374@hzoli.home> (raw)
In-Reply-To: <970510121241.ZM9715@candle.brasslantern.com> from Bart Schaefer at "May 10, 97 12:12:41 pm"

> } > There still doesn't appear to be a test in init.c for the case where
> } > the system supports TIOCGWINSZ but the rows and columns value in the
> } > shttyinfo.winsize structure are both zero.  In that case we ought to
> } > be using the row and column sizes from the termcap or terminfo entry?

The patch below implements this.  It does not work for non-interactive
shells since termcap initialisation is delayed in that case.  There is no
perfect solution for that: early termcap initialisaton can cause SIGTTOU on
some operating systems when the shell is backgrounded.  We cannot adjust
COLUMNS/LINES later when termcap is actually initialised since that will
unexpectedly change the values set by the user (for example the telnetd on
Solaris does not support window size and the li terminfo entry is 60 for
xterm, so one may want to set LINES to 24 on startup and does not want to
change it back to the wrong termcap value).

Zoltan


--- Src/globals.h	1997/05/05 07:17:48	3.1.2.9
+++ Src/globals.h	1997/05/04 05:18:36
@@ -644,6 +644,10 @@
 EXTERN int tclen[TC_COUNT];
  
 EXTERN char *tcstr[TC_COUNT];
+
+/* Values of the li and co entries */
+
+EXTERN int tclines, tccolumns;
  
 /* names of the strings we want */
 #ifdef GLOBALS
--- Src/init.c	1997/05/05 06:17:46	3.1.2.9
+++ Src/init.c	1997/05/11 04:12:59
@@ -360,6 +360,9 @@
 	/* check whether terminal has automargin (wraparound) capability */
 	hasam = tgetflag("am");
 
+	tclines = tgetnum("li");
+	tccolumns = tgetnum("co");
+
 	/* if there's no termcap entry for cursor up, use single line mode: *
 	 * this is flagged by termflags which is examined in zle_refresh.c  *
 	 */
@@ -519,8 +522,9 @@
     setiparam("COLUMNS", shttyinfo.winsize.ws_col);
     setiparam("LINES", shttyinfo.winsize.ws_row);
 #else
-    setiparam("COLUMNS", 80);
-    setiparam("LINES", 24);
+    /* Using zero below sets the defaults from termcap */
+    setiparam("COLUMNS", 0);
+    setiparam("LINES", 0);
 #endif
 
 #ifdef HAVE_GETRLIMIT
--- Src/params.c	1997/05/06 05:31:12	3.1.2.10
+++ Src/params.c	1997/05/11 04:05:43
@@ -1253,14 +1253,14 @@
 {
     if ((long *)pm->u.data == & columns) {
 	if(x <= 0)
-	    x = 80;
+	    x = tccolumns > 0 ? tccolumns : 80;
 	if (x > 2)
 	    termflags &= ~TERM_NARROW;
 	else
 	    termflags |= TERM_NARROW;
     } else if ((long *)pm->u.data == & lines) {
 	if(x <= 0)
-	    x = 24;
+	    x = tclines > 0 ? tclines : 24;
 	if (x > 2)
 	    termflags &= ~TERM_SHORT;
 	else


  reply	other threads:[~1997-05-11  7:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-09  7:42 Zoltan Hidvegi
1997-05-09  8:04 ` Hrvoje Niksic
1997-05-09 17:50   ` Zoltan T. Hidvegi
1997-05-09  8:49 ` Bart Schaefer
1997-05-09 14:00 ` Zefram
1997-05-09 18:09   ` Zoltan T. Hidvegi
1997-05-09 20:40     ` Zefram
1997-05-09 21:04       ` Zoltan T. Hidvegi
1997-05-10 17:09 ` Bart Schaefer
1997-05-10 17:48   ` Zoltan Hidvegi
1997-05-10 19:12     ` Bart Schaefer
1997-05-11  4:57       ` Zoltan Hidvegi [this message]
1997-05-12 12:41 ` Andrej Borsenkow
1997-05-12 17:49   ` Zefram
1997-05-13  5:46     ` Andrej Borsenkow
1997-05-13 16:08       ` Zefram
1997-05-13 18:53         ` Zoltan T. Hidvegi
1997-05-11  6:19 Zoltan 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=199705110457.AAA04374@hzoli.home \
    --to=hzoli@ny.frontiercomm.net \
    --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).