From 55fb6d29a01120d04c3a63e1889449ad73d1c7a4 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 9 Oct 2024 21:24:58 +0200 Subject: [PATCH] feat: allow closing the panel view by dragging down --- src/tui/mainview.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index 7d0e266..80f910b 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -160,8 +160,12 @@ fn bottom_bar_primary_drag(self: *Self, y: usize) tp.result { break :blk self.panels.?; }; const h = self.plane.dim_y(); - self.panel_height = @max(2, h - @min(h, y + 1)); + self.panel_height = @max(1, h - @min(h, y + 1)); panels.layout = .{ .static = self.panel_height.? }; + if (self.panel_height == 1) { + self.panel_height = null; + command.executeName("toggle_panel", .{}) catch {}; + } } fn toggle_panel_view(self: *Self, view: anytype, enable_only: bool) !void {