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

Re: test patches



I wrote:
> > } > 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

That patch does not work apply for zsh-3.0.3-test5.  Here is a patch for
zsh-3.0.3-test5.

Zoltan


--- Src/globals.h	1997/04/25 05:53:45	3.0.2.4
+++ Src/globals.h	1997/05/11 05:04:53
@@ -603,6 +603,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/04/20 07:24:12	3.0.2.4
+++ Src/init.c	1997/05/11 05:04:53
@@ -441,6 +441,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  *
 	 */
@@ -599,8 +602,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
 
     /* create hash table for multi-character emacs bindings */
--- Src/params.c	1997/04/25 05:18:50	3.0.2.7
+++ Src/params.c	1997/05/11 05:13:35
@@ -1235,23 +1235,19 @@
 zlevarsetfn(Param pm, long x)
 {
     if ((long *)pm->data == & columns) {
+	if(x <= 0)
+	    x = tccolumns > 0 ? tccolumns : 80;
 	if (x > 2)
 	    termflags &= ~TERM_NARROW;
-	else {
+	else
 	    termflags |= TERM_NARROW;
-	    if (x <= 0)
-		x = 80;		/* Arbitary, but same as init.c */
-	    else
-		x = 2;
-	}
     } else if ((long *)pm->data == & lines) {
+	if(x <= 0)
+	    x = tclines > 0 ? tclines : 24;
 	if (x > 2)
 	    termflags &= ~TERM_SHORT;
-	else {
+	else
 	    termflags |= TERM_SHORT;
-	    if (x <= 0)
-		x = 24;		/* Arbitrary, but same as init.c */
-	}
     }
 
     *((long *)pm->data) = x;



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