From 0ac0d0647ae996bcef119d885cbd2d22a9940d8d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 17 Oct 2022 18:49:57 +0200 Subject: interactive resize: improve user experience MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- terminal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index d5ed1ba2..ec5560cd 100644 --- a/terminal.h +++ b/terminal.h @@ -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; -- cgit v1.3