Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: prompts with newlines get printed twice
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@xxxxxxxxx>
> 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@xxxxxxxxx>wrote:
>
>> On 24 September 2011 20:24, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
>> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author