From 5e3b6ee08f6175e2f709707552588dab40b0996f Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 22 Oct 2024 16:54:21 +0200 Subject: [PATCH] terminal: fix tiling artifacts in shrinked window When shriking the terminal window, the view must be shrinked before shriking the pixel buffer. Otherwise, when the buffer becomes smaller than the view, nitpicker fills the excess view area with tiled content of the buffer, which looks funny. Related to issue #5350 --- repos/gems/src/server/terminal/main.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/repos/gems/src/server/terminal/main.cc b/repos/gems/src/server/terminal/main.cc index 1df537c9de..5a62f8e56a 100644 --- a/repos/gems/src/server/terminal/main.cc +++ b/repos/gems/src/server/terminal/main.cc @@ -116,7 +116,17 @@ struct Terminal::Main : Character_consumer void _handle_mode_change() { + Rect const orig_win_rect = _win_rect; + _win_rect = _gui_window_rect(); + + /* shrink view before shrinking the buffer to prevent tiling artifacts */ + Rect const intersection = Rect::intersect(orig_win_rect, _win_rect); + if (intersection != orig_win_rect) { + _gui.enqueue(_view, intersection); + _gui.execute(); + } + _handle_config(); }