Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: draw prompt on the correct line after window change
- X-seq: zsh-workers 44527
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: PATCH: draw prompt on the correct line after window change
- Date: Mon, 15 Jul 2019 21:14:37 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y2J/6TWUqhagtYLCw8qZXwtAqi92pUnPOUhif3wv92M=; b=bXEHxROKDdHBqZB2K+xUMr+VcbFtdUyZF/dpfgfedo6wAUUO/Ch2IQGasWBXo0/67N SasKCEKfXxfgZ0gDG8vHFwzwLmCkJAnz7w2WSsD91+rfZF+o/KkKjQagRgTrD+uNPIYn HyDZQAKPz+8jSTCPcyVfE2OPyzW5K1sWEmyQ4mc/yKAQLNrO95yEYCUtpDv0ueNCJQDs fSdWv5RIBPtqp8qjwVB/JY1Tmw5xyhWzh4DYfoTfego74kfQxyR7IKNEZE4rVnn60nBu XM9GL7oDCx2Ns2N1LyNdTQvYuLu688UHm8aSwZJiUyWZkzuxIgvj4Quigpx1v4yO3WFX K6WA==
- In-reply-to: <CAN=4vMp+E7esA48bEtRs-+Rmm9ng7i+FayGVqcLZqyjwVkayAw@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAN=4vMp+E7esA48bEtRs-+Rmm9ng7i+FayGVqcLZqyjwVkayAw@mail.gmail.com>
On 7/15/19, Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx> wrote:
> Many terminals reflow text when the window is resized. When the height
> of the prompt changes as a result of this reflowing, ZSH draws the
> updated prompt on the wrong line. This can lead to some parts of the
> prompt not being erased, or to the disappearance of lines prior to the
> prompt.
>
> There are many ways to reproduce this issue. Here are a couple. Both
> require terminals that reflow text when the window is resized.
>
> 1. Run `zsh -df`, hit <enter> a few times, then type
> `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` (don't hit <enter>).
>
> OR
>
> 2. Run `PROMPT="${(pl.$COLUMNS..-.)}%f"$'\n> ' zsh -df`
> and hit <enter> a few times.
>
> Now try resizing the terminal window back and forth causing lines to
> wrap and unwrap. Terminal content before the last prompt will be
> erased one line at a time.
>
> This patch cannot handle the case when the terminal window is being
> resized while the first prompt line is outside the terminal window.
> The content of the viewport will be correct but scrolling the terminal
> window up will reveal some mess up there. ZSH before this patch also
> fails in this case although it creates a different mess.
>
> The change is conservative. The new code triggers only on window
> resize and not, for example, on redisplay. This reduces the chance
> that it'll break something that isn't currently broken.
>
> I've tested this code only on GNOME Terminal. Before I go testing on a
> dozen different terminals I'd like to get some feedback. Anything I'm
> missing? Anything tricky to look out for?
I've tested it on urxvt and it makes things worse there, enlarging the
window always deletes the last output line even with an empty input
line.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author