From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4494 invoked by alias); 25 Sep 2011 00:14:31 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16426 Received: (qmail 6880 invoked from network); 25 Sep 2011 00:14:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 74.125.83.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=8GEmnlyZRSxc9pvwiklJmcoJt74zoOz3lCW/1xs//AM=; b=SqV2MJsyv6doUVPuKeEEZzsXLH2w9d8m/kY6SZePilxOwEkqKcPaMOpottxcRR7K4r 0klGdYO6cyt/GkBdx9T/gExG7xpv0dghJnaMY4whj24hAS6A/4mw5KcfuOzYVky3HoL0 kRbQifFvMEPkhAQemZzsuM5PfnucxsrEgnJho= MIME-Version: 1.0 In-Reply-To: References: <110924112412.ZM24918@torch.brasslantern.com> Date: Sat, 24 Sep 2011 17:14:12 -0700 Message-ID: Subject: Re: prompts with newlines get printed twice From: =?UTF-8?Q?Jorge_Israel_Pe=C3=B1a?= To: Mikael Magnusson Cc: Bart Schaefer , zsh-users@zsh.org Content-Type: multipart/alternative; boundary=bcaec520e60109bc2004adb8ec30 --bcaec520e60109bc2004adb8ec30 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hey guys. I have extracted what I felt were the relevant parts from my previously posted link. Like I said, I am no zsh expert (In fact I'm completely new to it) so I don't know if this is right or if there are more efficient, better ways of doing this. Source: https://gist.github.com/1240023 I tested it various times and it seems to be working perfectly. What the script seems to do is wrap the PROMPT or PS1 directive in a function, and then does a `trap func WINCH` on it. Also call the function i= n precmd so it happens all the time? Like I said, it seems like it works, but is this the best way of solving this? If it is, then I'm glad I've found a way to solve this :) 2011/9/24 Jorge Israel Pe=C3=B1a > Thanks for the replies. At least I'm glad to know it's not just me, I spe= nt > a few hours on this wondering if it was something I could have screwed up= . > > So are there any known workarounds? Or is this something that would have = to > be fixed in zsh itself? > > I found this [ http://www.df.lth.se/~arno/kod/prompt/uberprompt-sh ] whic= h > has a comment near the end: > > > Mac OS X Terminal.app and IRIX xwsh seems to send repetetive WINCH to > solaris boxen > > Then it includes some code, but I don't know if it's a workaround to this > problem in particular (it seems like it is, includes some sort of trappin= g > of the WINCHes), much less how to make use of that code. I just figured I= 'd > post it in case some of you guys could make sense of it (that section in > particular is pretty short). > > Hopefully it could provide some information that we can use to fix this, = or > at least provide a workaround. The two prompts that pop up are pretty > jarring, somehow. > > On Sat, Sep 24, 2011 at 11:31 AM, Mikael Magnusson wro= te: > >> On 24 September 2011 20:24, Bart Schaefer >> wrote: >> > On Sep 23, 7:52pm, Jorge Israel Pena wrote: >> > } >> > } The problem I'm encountering is that when I create a newline in the >> prompt, >> > } the prompt gets printed twice when I open the terminal. >> > >> > We've been wrestling with this one for a while. The trouble seems to = be >> > that Terminal sends extra WINCH (window size change) signals to the >> shell, >> > which causes it to reprint the prompt. >> > >> > Zsh doesn't attempt to perform a cursor-up before printing the prompt, >> as >> > for command line editing purposes it only keeps track of the appearanc= e >> of >> > the final line. >> >> I'm seeing some strange behaviour here, when I resize after setting >> PS1=3D'%D{%s} hello >> there ' >> I do get the first line twice, but subsequent resizes properly redraws >> both lines in place, updating the time too. Pressing enter then causes >> the next resize to double the first line and then subsequent ones work >> again. >> >> -- >> Mikael Magnusson >> > > > > -- > - Jorge Israel Pe=C3=B1a > --=20 - Jorge Israel Pe=C3=B1a --bcaec520e60109bc2004adb8ec30--