zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: nico@codernet.org (Nico R. Wohlgemuth), zsh-workers@sunsite.dk
Subject: Re: Strange bug with tiling wm, urxvt and zsh
Date: Wed, 5 Dec 2007 17:28:21 +0000	[thread overview]
Message-ID: <20071205172821.32674415@news01> (raw)
In-Reply-To: <20071205162501.GA13383@codernet.org>

On Wed, 5 Dec 2007 17:25:01 +0100
nico@codernet.org (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@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


  reply	other threads:[~2007-12-05 17:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071205141643.GA19714@codernet.org>
2007-12-05 14:56 ` Peter Stephenson
2007-12-05 16:25   ` Nico R. Wohlgemuth
2007-12-05 17:28     ` Peter Stephenson [this message]
2007-12-05 18:29       ` Nico R. Wohlgemuth
2007-12-07 11:54         ` Peter Stephenson
2007-12-07 12:04           ` Christian Walther
2007-12-09 18:54           ` Peter Stephenson
2007-12-18 17:41 ` Nico R. Wohlgemuth
2008-09-02 21:34   ` martin f krafft
2008-09-02 21:33 ` martin f krafft

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=20071205172821.32674415@news01 \
    --to=pws@csr.com \
    --cc=nico@codernet.org \
    --cc=zsh-workers@sunsite.dk \
    /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).