From: "Jorge Israel Peña" <jorgepblank@gmail.com>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>, zsh-users@zsh.org
Subject: Re: prompts with newlines get printed twice
Date: Sat, 24 Sep 2011 17:14:12 -0700 [thread overview]
Message-ID: <CAF3NQe9bJUXe14zZbhLagPcCZJmApmePHUr8eSG37MfbrzXVQA@mail.gmail.com> (raw)
In-Reply-To: <CAF3NQe8D0EDid8UnW6TJd4iPHpV+3-gur0_38vQesnX5Ot++Jw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2998 bytes --]
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 in
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ña <jorgepblank@gmail.com>
> Thanks for the replies. At least I'm glad to know it's not just me, I spent
> 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 ] which
> 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 trapping
> 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 <mikachu@gmail.com>wrote:
>
>> On 24 September 2011 20:24, Bart Schaefer <schaefer@brasslantern.com>
>> 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 appearance
>> of
>> > the final line.
>>
>> I'm seeing some strange behaviour here, when I resize after setting
>> PS1='%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ña
>
--
- Jorge Israel Peña
next prev parent reply other threads:[~2011-09-25 0:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-24 2:52 Jorge Israel Peña
2011-09-24 18:24 ` Bart Schaefer
2011-09-24 18:31 ` Mikael Magnusson
2011-09-24 23:24 ` Jorge Israel Peña
2011-09-25 0:14 ` Jorge Israel Peña [this message]
2011-09-25 22:13 ` Bart Schaefer
2011-09-25 23:31 ` Jorge Israel Peña
2011-09-26 4:22 ` Jorge Israel Peña
2011-09-26 4:29 ` Jorge Israel Peña
2011-09-27 1:42 ` Jorge Israel Peña
2011-09-27 1:48 ` Jorge Israel Peña
2011-09-27 14:32 ` Bart Schaefer
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=CAF3NQe9bJUXe14zZbhLagPcCZJmApmePHUr8eSG37MfbrzXVQA@mail.gmail.com \
--to=jorgepblank@gmail.com \
--cc=mikachu@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@zsh.org \
/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).