mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-30 20:37:55 +00:00
termio/exec: initial subprocess screen size should be sub padding
This commit is contained in:
@@ -105,8 +105,6 @@ pub fn init(alloc: Allocator, opts: termio.Options) !Exec {
|
||||
);
|
||||
errdefer term.deinit(alloc);
|
||||
term.color_palette = opts.config.palette;
|
||||
term.width_px = opts.screen_size.width;
|
||||
term.height_px = opts.screen_size.height;
|
||||
|
||||
// Set the image size limits
|
||||
try term.screen.kitty_images.setLimit(alloc, opts.config.image_storage_limit);
|
||||
@@ -115,6 +113,10 @@ pub fn init(alloc: Allocator, opts: termio.Options) !Exec {
|
||||
var subprocess = try Subprocess.init(alloc, opts);
|
||||
errdefer subprocess.deinit();
|
||||
|
||||
// Initial width/height based on subprocess
|
||||
term.width_px = subprocess.screen_size.width;
|
||||
term.height_px = subprocess.screen_size.height;
|
||||
|
||||
return Exec{
|
||||
.alloc = alloc,
|
||||
.terminal = term,
|
||||
@@ -289,8 +291,8 @@ pub fn resize(
|
||||
);
|
||||
|
||||
// Update our pixel sizes
|
||||
self.terminal.width_px = screen_size.width;
|
||||
self.terminal.height_px = screen_size.height;
|
||||
self.terminal.width_px = padded_size.width;
|
||||
self.terminal.height_px = padded_size.height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,6 +684,9 @@ const Subprocess = struct {
|
||||
log.warn("shell could not be detected, no automatic shell integration will be injected", .{});
|
||||
}
|
||||
|
||||
// Our screen size should be our padded size
|
||||
const padded_size = opts.screen_size.subPadding(opts.padding);
|
||||
|
||||
return .{
|
||||
.arena = arena,
|
||||
.env = env,
|
||||
@@ -689,7 +694,7 @@ const Subprocess = struct {
|
||||
.path = final_path,
|
||||
.args = args,
|
||||
.grid_size = opts.grid_size,
|
||||
.screen_size = opts.screen_size,
|
||||
.screen_size = padded_size,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ grid_size: renderer.GridSize,
|
||||
/// The size of the viewport in pixels.
|
||||
screen_size: renderer.ScreenSize,
|
||||
|
||||
/// The padding of the viewport.
|
||||
padding: renderer.Padding,
|
||||
|
||||
/// The full app configuration. This is only available during initialization.
|
||||
/// The memory it points to is NOT stable after the init call so any values
|
||||
/// in here must be copied.
|
||||
|
||||
Reference in New Issue
Block a user