zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: draw prompt on the correct line after window change
Date: Tue, 16 Jul 2019 10:16:52 +0200	[thread overview]
Message-ID: <CAN=4vMpGPQYk+vL9AgNtTiO=poyQdpVyDSfsKSM7uXZmJ-NLpw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Z0D-sZeHAZROhmVp7waTy=1bSkR3DvqX2gqectCG6tgA@mail.gmail.com>

On Tue, Jul 16, 2019 at 1:28 AM Bart Schaefer <schaefer@brasslantern.com> wrote:
> Install some of the alternate window managers provided with the
> various OSs you have, rather than the default ones.  There's a
> plethora of them.  The main thing is one that does live redraw while
> resizing windows, rather than having you drag a window outline around
> and then snapping the window to the outline when you release the
> mouse.

Got it. So far all tests I've done were with window managers that
redraw the window continuously while it's being resized. I'll make
sure to test with those that don't redraw until the mouse button is
released.

> > This patch [is] only doing writes to the terminal without any reads.
> > Whenever ZLE prints prompt, it issues TCSAVECURSOR
>
> OK, then there is a different problem:  Nothing prevents the prompt
> itself from printing TCSAVECURSOR/TCRESTRCURSOR, and in fact some of
> the themed prompts provided with zsh do that.  There's no way for zsh
> to guarantee that the cursorsaved flag is accurate.

In my patch I attempted to not break code that stores/restores cursor.
It'll work in all the following cases:

1. The cursor is saved and restored by a foreground process.
2. The cursor is saved and restored in precmd.
3. The cursor is saved and restored in preexec.
4. The cursor is saved and restored by PROMPT and/or RPROMPT.

Cursor cannot be restored if the terminal window may have been
scrolled due to extra lines added at the bottom. This limits the
number of places where anyone can save/restore cursors. For example,
saving the cursor in precmd and restoring it in preexec won't work
because there can be new lines added in between (unless
single_line_zle is set, but in this case my patch doesn't save/restore
cursor). I _think_ my code doesn't break working code but I may be
wrong. What should I test with? Which theme(s) save and restore
cursor?

It's worth reiterating that currently prompt refresh on window change
is quite broken. Even if my patch isn't perfect, it still may be an
improvement (it is so far in all my tests).

Roman.

  reply	other threads:[~2019-07-16  8:17 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
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 [this message]
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='CAN=4vMpGPQYk+vL9AgNtTiO=poyQdpVyDSfsKSM7uXZmJ-NLpw@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=schaefer@brasslantern.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).