mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
renderer: don't update frame if renderer grid size != terminal size
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
@ -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 = .{} }).?;
|
||||
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user