zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: draw prompt on the correct line after window change
Date: Mon, 15 Jul 2019 21:14:37 +0200	[thread overview]
Message-ID: <CAHYJk3Sa8Et2N274ogw2ZB2HzgduKPrNGOUMH8LethJN6tDMPA@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMp+E7esA48bEtRs-+Rmm9ng7i+FayGVqcLZqyjwVkayAw@mail.gmail.com>

On 7/15/19, Roman Perepelitsa <roman.perepelitsa@gmail.com> 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

  reply	other threads:[~2019-07-15 19:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 17:20 Roman Perepelitsa
2019-07-15 19:14 ` Mikael Magnusson [this message]
2019-07-15 19:32   ` Roman Perepelitsa
2019-07-15 19:41     ` Roman Perepelitsa
2019-07-15 21:24 ` Bart Schaefer
2019-07-15 22:09   ` Roman Perepelitsa
2019-07-15 22:11     ` Roman Perepelitsa
2019-07-15 23:28     ` Bart Schaefer
2019-07-16  8:16       ` Roman Perepelitsa
2019-07-16  0:01     ` Bart Schaefer
2020-01-06 17:50 ` Sebastian Gniazdowski
2020-01-06 18:07   ` Roman Perepelitsa
2020-01-06 18:31     ` Sebastian Gniazdowski
2020-01-06 18:46       ` Roman Perepelitsa
2020-01-06 19:02         ` Sebastian Gniazdowski
2020-01-06 19:28           ` Bart Schaefer
2020-01-06 19:38             ` Roman Perepelitsa
2020-02-01 17:22               ` Roman Perepelitsa
2020-01-06 19:40             ` Sebastian Gniazdowski

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=CAHYJk3Sa8Et2N274ogw2ZB2HzgduKPrNGOUMH8LethJN6tDMPA@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-workers@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).