From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13424 invoked from network); 8 Aug 2005 17:59:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 8 Aug 2005 17:59:08 -0000 Received: (qmail 98341 invoked from network); 8 Aug 2005 17:59:03 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 8 Aug 2005 17:59:03 -0000 Received: (qmail 1261 invoked by alias); 8 Aug 2005 17:59:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21577 Received: (qmail 1251 invoked from network); 8 Aug 2005 17:59:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 8 Aug 2005 17:59:00 -0000 Received: (qmail 98049 invoked from network); 8 Aug 2005 17:59:00 -0000 Received: from sccimhc91.asp.att.net (63.240.76.165) by a.mx.sunsite.dk with SMTP; 8 Aug 2005 17:58:56 -0000 Received: from unicorn.bullok.com (12-208-70-16.client.insightbb.com[12.208.70.16]) by sccimhc91.asp.att.net (sccimhc91) with ESMTP id <20050808175850i9100an6ese>; Mon, 8 Aug 2005 17:58:50 +0000 From: Dan Bullok To: zsh-workers@sunsite.dk Subject: Re: PATCH: (one-liner) adjustwinsize doesn't update prompt string Date: Mon, 8 Aug 2005 12:58:37 -0500 User-Agent: KMail/1.8.1 References: <200508061220.24187.dan@bullok.com> <200508081032.j78AWcfg008014@news01.csr.com> In-Reply-To: <200508081032.j78AWcfg008014@news01.csr.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_O159CMBUXZAeN9i" Message-Id: <200508081258.38014.dan.zsh@bullok.com> X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.0.4 --Boundary-00=_O159CMBUXZAeN9i Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Monday 08 August 2005 05:32, Peter Stephenson wrote: > Dan Bullok wrote: > > zsh 4.2.5 does not re-evaluate the prompt string when the window size > > changes. > > When the window size changes, it seems to me that zle should know about > > it, and redisplay the prompt appropriately. Most of the two line prompts > > get very screwed up on a window resize, and you have to hit enter for > > them to behave again. > > I'll apply this (and to 4.3 where the code is slightly different). > > > There's another closely related issue that's bugging me, which I don't > > have a fix for. When the window is resized, zsh keeps moving the prompt > > down a line at a time. This isn't a big deal, except that it often ends > > up causing the display to scroll up so that I can't see anything but the > > messed up prompt bits on screen. Is it necessary to do this when the > > display is updated? Is there a way to prevent it without messing > > everything else up? I've looked at zrefresh for a couple of hours, but > > I'm completely confused by it. > > Yes, I can see this behaviour. I'll try to remember to look and see > what's going on, unless Geoff has any ideas. I kept at this, and have made some progress I'm able to completely work around this problem by creating a new function in Src/Zle/zle_main.c called zle_resetprompt. This does the same thing that resetprompt does, only it can be called from call the zle reset-prompt from outside of zle (i.e. in ). Then you don't have to call trashzle, which seems to be the cause of the extra newlines. Instead, you call zle_resetprompt after calling zrefresh (before might work, too, but I didn't try it). This is admittedly a circuitous solution, but it's the best I could come up with given my limited understanding of zsh internals. If anyone's interested, the patch is very small, and is attached. > > By the way, our mail scanning software (blackspider) decided there was a > virus (huntsman) in your script attachment. It's presumably wrong, but > anyway the attachment got blocked. Hmmm. Everything looks okay here. Mail was sent from a hardened Linux box that gets regular inspections by rkhunter and chkrootkit. It also seems to have gone through the mailing list intact, because I got a copy (and it's the same one I sent). I think your virus scanner's probably overcautious (which isn't necessarily a bad thing). There were two attachments (patch and demo prompt). Did you get either one? If you want them, or this patch doesn't get through, and you want it, let me know how to send it to you to circumvent your scanner. -Dan --Boundary-00=_O159CMBUXZAeN9i Content-Type: text/x-diff; charset="iso-8859-1"; name="zsh-4.2.5-zle_resetprompt.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="zsh-4.2.5-zle_resetprompt.diff" diff -urb zsh-4.2.5.ORIG/Src/Zle/zle.h zsh-4.2.5/Src/Zle/zle.h --- zsh-4.2.5.ORIG/Src/Zle/zle.h 2003-01-27 08:54:52.000000000 -0600 +++ zsh-4.2.5/Src/Zle/zle.h 2005-08-06 14:17:52.000000000 -0500 @@ -28,6 +28,7 @@ */ #undef trashzle +#undef zle_resetprompt #undef zleread #undef spaceinline #undef zrefresh diff -urb zsh-4.2.5.ORIG/Src/Zle/zle_main.c zsh-4.2.5/Src/Zle/zle_main.c --- zsh-4.2.5.ORIG/Src/Zle/zle_main.c 2005-04-01 04:35:09.000000000 -0600 +++ zsh-4.2.5/Src/Zle/zle_main.c 2005-08-06 14:17:59.000000000 -0500 @@ -1358,6 +1358,16 @@ /**/ mod_export void +zle_resetprompt(void) +{ reexpandprompt(); + if (zleactive) + redisplay(NULL); +} + + + +/**/ +mod_export void trashzle(void) { if (zleactive) { @@ -1435,6 +1445,7 @@ { /* Set up editor entry points */ trashzleptr = trashzle; + zle_resetpromptptr = zle_resetprompt; refreshptr = zrefresh; spaceinlineptr = spaceinline; zlereadptr = zleread; @@ -1519,6 +1530,7 @@ /* editor entry points */ trashzleptr = noop_function; + zle_resetpromptptr = noop_function; refreshptr = noop_function; spaceinlineptr = noop_function_int; zlereadptr = fallback_zleread; diff -urb zsh-4.2.5.ORIG/Src/init.c zsh-4.2.5/Src/init.c --- zsh-4.2.5.ORIG/Src/init.c 2005-04-01 04:20:30.000000000 -0600 +++ zsh-4.2.5/Src/init.c 2005-08-06 14:18:47.000000000 -0500 @@ -1125,6 +1125,8 @@ /**/ mod_export ZleVoidFn trashzleptr = noop_function; /**/ +mod_export ZleVoidFn zle_resetpromptptr = noop_function; +/**/ mod_export ZleVoidFn refreshptr = noop_function; /**/ mod_export ZleVoidIntFn spaceinlineptr = noop_function_int; @@ -1136,6 +1138,7 @@ #else /* !LINKED_XMOD_zshQszle */ mod_export ZleVoidFn trashzleptr = noop_function; +mod_export ZleVoidFn zle_resetpromptptr = noop_function; mod_export ZleVoidFn refreshptr = noop_function; mod_export ZleVoidIntFn spaceinlineptr = noop_function_int; # ifdef UNLINKED_XMOD_zshQszle diff -urb zsh-4.2.5.ORIG/Src/utils.c zsh-4.2.5/Src/utils.c --- zsh-4.2.5.ORIG/Src/utils.c 2005-03-21 12:49:00.000000000 -0600 +++ zsh-4.2.5/Src/utils.c 2005-08-06 14:17:43.000000000 -0500 @@ -1055,6 +1055,7 @@ #endif /* TIOCGWINSZ */ resetneeded = 1; zrefresh(); + zle_resetprompt(); } } diff -urb zsh-4.2.5.ORIG/Src/zsh.h zsh-4.2.5/Src/zsh.h --- zsh-4.2.5.ORIG/Src/zsh.h 2005-01-12 06:19:06.000000000 -0600 +++ zsh-4.2.5/Src/zsh.h 2005-08-06 14:20:19.000000000 -0500 @@ -28,6 +28,7 @@ */ #define trashzle() trashzleptr() +#define zle_resetprompt() zle_resetpromptptr() #define zleread(X,Y,H,C) zlereadptr(X,Y,H,C) #define spaceinline(X) spaceinlineptr(X) #define zrefresh() refreshptr() --Boundary-00=_O159CMBUXZAeN9i--