From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22081 invoked from network); 17 Nov 2007 09:27:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 17 Nov 2007 09:27:18 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 90001 invoked from network); 17 Nov 2007 09:27:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 17 Nov 2007 09:27:09 -0000 Received: (qmail 24529 invoked by alias); 17 Nov 2007 09:27:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24098 Received: (qmail 24512 invoked from network); 17 Nov 2007 09:27:05 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 17 Nov 2007 09:27:05 -0000 Received: (qmail 89688 invoked from network); 17 Nov 2007 09:27:05 -0000 Received: from g.primenet.com.au (203.24.36.10) by a.mx.sunsite.dk with SMTP; 17 Nov 2007 09:26:59 -0000 Received: (qmail 20969 invoked by uid 100); 17 Nov 2007 09:26:55 -0000 Date: Sat, 17 Nov 2007 20:26:55 +1100 From: Geoff Wing To: Zsh Hackers Subject: Re: Geoff's prompt escape sequences patch (workers/23924) Message-ID: <20071117092655.GA19365@primenet.com.au> References: <237967ef0711160657x550e449ch44c78a8798238372@mail.gmail.com> <071116084537.ZM20036@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <071116084537.ZM20036@torch.brasslantern.com> Organization: PrimeNet Computer Consultancy User-Agent: Mutt/1.5.17 (2007-11-01) On Saturday 2007-11-17 03:46 +1100, Bart Schaefer output: :On Nov 16, 3:57pm, Mikael Magnusson wrote: :} Subject: Re: Geoff's prompt escape sequences patch (workers/23924) :} I've found another problem that seems to be caused by this patch :} (located by git-bisect). When a bg'd job finishes, the cursor is drawn :} in the wrong place in the new prompt (#bar characters to the left). : :It would appear that the starting position for the right prompt is not :being recomputed correctly. It's not just that the cursor is moved :left; RPS1 still begins at the same column even though it is shorter, :so it doesn't reach all the way to the margin. :The cursor positioning error is probably only apparent when the number :of bytes in the terminfo "move left N" string is less than the number :in "move to position X,Y". Yes, my fault. reexpandprompt() needs to happen before resetvideo() which uses the prompt sizes. :} The simplest test case i could find was :} zsh -f :} PS1="frobnizz %#" #not really needed but since the default :} depends on hostname... :} RPS1="foo%(1j.bar.)" :} true & :The effect is more obvious if you change to RPS1="%(1j.bar.)foo" I'll think this through properly a bit later (in a couple of days or so), though I currently think this fixes it. Regards, Geoff Index: Src/Zle/zle_refresh.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v retrieving revision 1.49 diff -u -r1.49 zle_refresh.c --- Src/Zle/zle_refresh.c 19 Oct 2007 01:33:09 -0000 1.49 +++ Src/Zle/zle_refresh.c 17 Nov 2007 09:22:47 -0000 @@ -446,7 +446,6 @@ int tmpcs, tmpll; /* ditto cursor position and line length */ int tmpalloced; /* flag to free tmpline when finished */ int remetafy; /* flag that zle line is metafied */ - int fixprompt; /* we still need to reexpand the prompt */ struct rparams rpms; /* If this is called from listmatches() (indirectly via trashzle()), and * @@ -540,11 +539,6 @@ listshown = 0; } #endif - fixprompt = trashedzle; - resetvideo(); - resetneeded = 0; /* unset */ - oput_rpmpt = 0; /* no right-prompt currently on screen */ - /* we probably should only have explicitly set attributes */ tsetcap(TCALLATTRSOFF, 0); tsetcap(TCSTANDOUTEND, 0); @@ -552,6 +546,12 @@ /* cheat on attribute unset */ txtunset(TXTBOLDFACE|TXTSTANDOUT|TXTUNDERLINE|TXTDIRTY); + if (trashedzle) + reexpandprompt(); + resetvideo(); + resetneeded = 0; /* unset */ + oput_rpmpt = 0; /* no right-prompt currently on screen */ + if (!clearflag) { if (tccan(TCCLEAREOD)) tcout(TCCLEAREOD); @@ -562,8 +562,6 @@ } if (t0 > -1) olnct = (t0 < winh) ? t0 : winh; - if (fixprompt) - reexpandprompt(); if (termflags & TERM_SHORT) vcs = 0; else if (!clearflag && lpromptbuf[0]) {