renderer: don't update frame if renderer grid size != terminal size

This commit is contained in:
Qwerasd
2024-08-14 22:43:58 -04:00
parent 7929e0bc09
commit 900aab10f2
3 changed files with 23 additions and 6 deletions

View File

@ -908,12 +908,14 @@ pub fn updateFrame(
}
// If our terminal screen size doesn't match our expected renderer
// size then we skip a frame. This can happen if we get resized
// before the terminal gets resized. The terminal resize event also
// wakes up the renderer so we'll get another chance to update frame
// data.
if (self.cells.size.rows < state.terminal.rows or
self.cells.size.columns < state.terminal.cols)
// size then we skip a frame. This can happen if the terminal state
// is resized between when the renderer mailbox is drained and when
// the state mutex is acquired inside this function.
//
// For some reason this doesn't seem to cause any significant issues
// with flickering while resizing. '\_('-')_/'
if (self.cells.size.rows != state.terminal.rows or
self.cells.size.columns != state.terminal.cols)
{
return;
}

View File

@ -739,6 +739,19 @@ pub fn updateFrame(
self.foreground_color = bg;
}
// If our terminal screen size doesn't match our expected renderer
// size then we skip a frame. This can happen if the terminal state
// is resized between when the renderer mailbox is drained and when
// the state mutex is acquired inside this function.
//
// For some reason this doesn't seem to cause any significant issues
// with flickering while resizing. '\_('-')_/'
if (self.grid_size.rows != state.terminal.rows or
self.grid_size.columns != state.terminal.cols)
{
return;
}
// Get the viewport pin so that we can compare it to the current.
const viewport_pin = state.terminal.screen.pages.pin(.{ .viewport = .{} }).?;

View File

@ -522,6 +522,8 @@ fn renderCallback(
t.flags.cursor_blink_visible,
) catch |err|
log.warn("error rendering err={}", .{err});
// Draw
t.drawFrame(false);
return .disarm;