mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
core: send pixel-level surface sizing to the pty
This commit is contained in:
@ -894,14 +894,12 @@ pub fn sizeCallback(self: *Surface, size: apprt.SurfaceSize) !void {
|
|||||||
|
|
||||||
// Recalculate our grid size. Because Ghostty supports fluid resizing,
|
// Recalculate our grid size. Because Ghostty supports fluid resizing,
|
||||||
// its possible the grid doesn't change at all even if the screen size changes.
|
// its possible the grid doesn't change at all even if the screen size changes.
|
||||||
const new_grid_size = renderer.GridSize.init(
|
// We have to update the IO thread no matter what because we send
|
||||||
|
// pixel-level sizing to the subprocess.
|
||||||
|
self.grid_size = renderer.GridSize.init(
|
||||||
self.screen_size.subPadding(self.padding),
|
self.screen_size.subPadding(self.padding),
|
||||||
self.cell_size,
|
self.cell_size,
|
||||||
);
|
);
|
||||||
if (self.grid_size.equals(new_grid_size)) return;
|
|
||||||
|
|
||||||
// Grid size changed, update our grid size and notify the terminal
|
|
||||||
self.grid_size = new_grid_size;
|
|
||||||
if (self.grid_size.columns < 5 and (self.padding.left > 0 or self.padding.right > 0)) {
|
if (self.grid_size.columns < 5 and (self.padding.left > 0 or self.padding.right > 0)) {
|
||||||
log.warn("WARNING: very small terminal grid detected with padding " ++
|
log.warn("WARNING: very small terminal grid detected with padding " ++
|
||||||
"set. Is your padding reasonable?", .{});
|
"set. Is your padding reasonable?", .{});
|
||||||
|
@ -256,10 +256,14 @@ pub fn resize(
|
|||||||
screen_size: renderer.ScreenSize,
|
screen_size: renderer.ScreenSize,
|
||||||
padding: renderer.Padding,
|
padding: renderer.Padding,
|
||||||
) !void {
|
) !void {
|
||||||
// Update the size of our pty
|
// Update the size of our pty.
|
||||||
const padded_size = screen_size.subPadding(padding);
|
const padded_size = screen_size.subPadding(padding);
|
||||||
try self.subprocess.resize(grid_size, padded_size);
|
try self.subprocess.resize(grid_size, padded_size);
|
||||||
|
|
||||||
|
// If our grid size didn't change, then we don't need to change
|
||||||
|
// the underlying terminal.
|
||||||
|
if (grid_size.equals(self.grid_size)) return;
|
||||||
|
|
||||||
// Update our cached grid size
|
// Update our cached grid size
|
||||||
self.grid_size = grid_size;
|
self.grid_size = grid_size;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user