interactive resize: improve user experience

Re-initialize the temporary ‘normal’ grid instance each time we
receive a configure event while doing an interactive resize.

This way, window content will not be "erased" when the window is first
made smaller, then larger again.

And, if the viewport is up in the scrollback history, increasing the
window size will reveal more of the scrollback, instead of just being
black.

The last issue is the cursor; it’s currently not "stuck" where it
should be. Instead, it follows the window around. This is due to two
things:

1) the temporary grid we create is large enough to contain the current
   viewport, but not more than that. That means we can’t "scroll up", to
   hide the cursor.

2) grid_resize_without_reflow() doesn’t know anything about
   "interactive resizing". As such, it will ensure the cursor is bound
   to the new grid dimensions.

I don’t yet have a solution for this. This patch implements a
workaround to at least reduce the impact, by simply hiding the cursor
while we’re doing an interactive resize.
This commit is contained in:
Daniel Eklöf 2022-10-17 18:49:57 +02:00
parent 3c9a51afa6
commit 0ac0d0647a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 83 additions and 60 deletions

View file

@ -601,6 +601,8 @@ struct terminal {
struct {
struct grid *grid; /* Original normal grid, before resize started */
int old_screen_rows; /* term->rows before resize started */
int old_cols; /* term->cols before resize started */
int old_hide_cursor; /* term->hide_cursor before resize started */
int new_rows; /* New number of scrollback rows */
} interactive_resizing;