From 54b5ae95c1bb01c5103b3ce97a8faebe75e142bb Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 22 Feb 2021 10:22:41 +0100 Subject: url-mode: snapshot screen state when entering URL mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we automatically exited URL mode whenever we received data on the PTY. This was done since we don’t know _what_ has changed on the screen, and we don’t want to display misleading jump labels. However, this becomes a problem in curses-like applications that periodically updates part of the screen. For example, a statusbar with a clock. This patch changes this behavior; instead of cancelling URL mode when receiving PTY data, we snapshot the grid when entering URL mode. When *rendering*, we use the snapshot:ed grid, while PTY updates modify the “real” grid. Snapshot:ing the grid means taking a full/deep copy of the current grid, including sixel images etc. Finally, it isn’t necessary to “damage” the entire view when *entering* URL mode, since we’re at that point the renderer is in sync with the grid. But we *do* need to damage the entire view when exiting URL mode, since the grid changes on the “real” grid hasn’t been tracked by the renderer. --- terminal.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index b1b7c391..2a6ae0b1 100644 --- a/terminal.h +++ b/terminal.h @@ -547,9 +547,11 @@ struct terminal { unsigned max_height; /* Maximum image height, in pixels */ } sixel; + /* TODO: wrap in a struct */ url_list_t urls; wchar_t url_keys[5]; bool urls_show_uri_on_jump_label; + struct grid *url_grid_snapshot; #if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED struct { -- cgit v1.3