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

Re: Strange bug with tiling wm, urxvt and zsh



On Wed, 5 Dec 2007 17:25:01 +0100
nico@xxxxxxxxxxxx (Nico R. Wohlgemuth) wrote:
> The patch (sadly) does not solve the problem.

OK, that means (E&OE) that the rows and columns are set correctly when
we get to zle.  Next guess:  the SIGWINCH is happening too early, before
we've set up the terminal, so that adjustwinsize() is being called but is
doing the wrong thing.

The following patch stops adjustwinsize() from doing anything until we're
sure it's OK which is at the call during normal initialization.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.60
diff -u -r1.60 jobs.c
--- Src/jobs.c	5 Sep 2007 16:16:17 -0000	1.60
+++ Src/jobs.c	5 Dec 2007 17:22:05 -0000
@@ -379,7 +379,7 @@
 		if (somestopped || (pgrp > 1 && kill(-pgrp, 0) == -1)) {
 		    attachtty(mypgrp);
 		    /* check window size and adjust if necessary */
-		    adjustwinsize(0);
+		    adjustwinsize(4);
 		} else {
 		    /*
 		     * Oh, dear, we're right in the middle of some confusion
@@ -406,7 +406,7 @@
 	    } else {
 		attachtty(mypgrp);
 		/* check window size and adjust if necessary */
-		adjustwinsize(0);
+		adjustwinsize(4);
 	    }
 	}
     } else if (list_pipe && (val & 0200) && inforeground == 1 &&
@@ -1067,7 +1067,7 @@
     deletefilelist(jn->filelist);
     if (jn->stat & STAT_ATTACH) {
 	attachtty(mypgrp);
-	adjustwinsize(0);
+	adjustwinsize(4);
     }
 
     freejob(jn, 1);
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.172
diff -u -r1.172 utils.c
--- Src/utils.c	3 Dec 2007 22:46:11 -0000	1.172
+++ Src/utils.c	5 Dec 2007 17:22:06 -0000
@@ -1504,21 +1504,37 @@
 }
 
 /* check the size of the window and adjust if necessary. *
- * The value of from:					 *
- *   0: called from update_job or setupvals		 *
- *   1: called from the SIGWINCH handler		 *
- *   2: called from the LINES parameter callback	 *
- *   3: called from the COLUMNS parameter callback	 */
+ * The value of from:                                    *
+ *   0: called from setupvals                            *
+ *   1: called from the SIGWINCH handler                 *
+ *   2: called from the LINES parameter callback         *
+ *   3: called from the COLUMNS parameter callback       *
+ *   4: called from update_job                           */
 
 /**/
 void
 adjustwinsize(int from)
 {
+    static int init_ok = 0;
     static int getwinsz = 1;
     int ttyrows = shttyinfo.winsize.ws_row;
     int ttycols = shttyinfo.winsize.ws_col;
     int resetzle = 0;
 
+    if (!init_ok) {
+	/*
+	 * We don't set up until the call from setupvals().
+	 */
+	if (from)
+	    return;
+	init_ok = 1;
+    }
+    /*
+     * The call from update_job() behaves the same as the initial call.
+     */
+    if (from == 4)
+	from = 0;
+
     if (getwinsz || from == 1) {
 #ifdef TIOCGWINSZ
 	if (SHTTY == -1)



-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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