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 14:56:27 +0000	[thread overview]
Message-ID: <20071205145627.71476067@news01> (raw)
In-Reply-To: <20071205141643.GA19714@codernet.org>

On Wed, 5 Dec 2007 15:16:44 +0100
nico@codernet.org (Nico R. Wohlgemuth) wrote:
> Everytime I open a window it gets resized to fit the screen (which is
> the job of a tiling wm). Now, If I open a terminal window, dwm resizes it
> directly to fit the screen - after that the first prompt I get is
> 'unusable'.
...
> I have tested a bit around and someone from #zsh gave me a dirty hack to
> bypass this behaviour: "sleep 0.1 && kill -SIGWINCH $$" at the end of the
> .zshrc - which works but is very dirty and only a termporaly solution for
> this.

(Moved to zsh-workers; I don't think there are any user-serviceable parts
inside.)

If this fixes the problem, it means zsh isn't receiving or (more likely)
handling a SIGWINCH generated while it's starting up which is when the
window is resized.

Can you try the following patch?  I'm not entirely sure of its possible
ramifications (though it doesn't look like it should cause new problems)
but it would at least be useful to find out if it helps.

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 14:48:44 -0000
@@ -1506,12 +1506,12 @@
 /* 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		 *
+ *   1: called from the SIGWINCH handler (or faked)      *
  *   2: called from the LINES parameter callback	 *
  *   3: called from the COLUMNS parameter callback	 */
 
 /**/
-void
+mod_export void
 adjustwinsize(int from)
 {
     static int getwinsz = 1;
Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.100
diff -u -r1.100 zle_main.c
--- Src/Zle/zle_main.c	19 Oct 2007 01:33:09 -0000	1.100
+++ Src/Zle/zle_main.c	5 Dec 2007 14:48:44 -0000
@@ -1106,6 +1106,22 @@
 	if (termflags & TERM_UNKNOWN)
 	    init_term();
     }
+#ifdef TIOCGWINSZ
+    {
+	struct winsize winsize;
+	/*
+	 * We may not handle window changes that happened while the
+	 * shell was starting up.  Just before we draw the prompt,
+	 * do this fairly cheap test to see if we need to fake a
+	 * SIGWINCH.
+	 */
+	if (ioctl(SHTTY, TIOCGWINSZ, (char *)&winsize) == 0) {
+	    if (shttyinfo.winsize.ws_row != winsize.ws_row ||
+		shttyinfo.winsize.ws_col != winsize.ws_col)
+		adjustwinsize(1);
+	}
+    }
+#endif
 
     fflush(shout);
     fflush(stderr);



-- 
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 14:58 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 [this message]
2007-12-05 16:25   ` Nico R. Wohlgemuth
2007-12-05 17:28     ` Peter Stephenson
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=20071205145627.71476067@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).