From 57cec333034209efa971e9d89c4740f708599bbe Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 9 Aug 2022 08:59:45 -0700 Subject: [PATCH] set a minimum window size Fixes #4 The currently picked 10x4 is somewhat arbitrary but matches Terminal.app. We can make this configurable. --- src/Window.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Window.zig b/src/Window.zig index 09b10d838..0a6c7a62e 100644 --- a/src/Window.zig +++ b/src/Window.zig @@ -219,6 +219,13 @@ pub fn create(alloc: Allocator, loop: libuv.Loop, config: *const Config) !*Windo .b = config.foreground.b, }; + // Set a minimum size that is cols=10 h=4. This matches Mac's Terminal.app + // but is otherwise somewhat arbitrary. + try window.setSizeLimits(.{ + .width = @floatToInt(u32, grid.cell_size.width * 10), + .height = @floatToInt(u32, grid.cell_size.height * 4), + }, .{ .width = null, .height = null }); + // Create our pty var pty = try Pty.open(.{ .ws_row = @intCast(u16, grid.size.rows),