From 8dea591341bd3579ab94ab7b17ce3d46b2623ccc Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Wed, 11 Dec 2024 21:24:00 +0100 Subject: [PATCH] feat: add simple add_split command (wip) --- src/tui/mainview.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/tui/mainview.zig b/src/tui/mainview.zig index bac7c51..b6ffce6 100644 --- a/src/tui/mainview.zig +++ b/src/tui/mainview.zig @@ -439,6 +439,11 @@ const cmds = struct { } pub const show_home_meta = .{}; + pub fn add_split(self: *Self, _: Ctx) Result { + return self.create_home_split(); + } + pub const add_split_meta = .{}; + pub fn gutter_mode_next(self: *Self, _: Ctx) Result { const tui_ = tui.current(); var ln = tui_.config.gutter_line_numbers; @@ -743,6 +748,12 @@ fn create_home(self: *Self) !void { tui.current().resize(); } +fn create_home_split(self: *Self) !void { + tui.reset_drag_context(); + try self.add_view(try home.create(self.allocator, Widget.to(self))); + tui.current().resize(); +} + fn write_restore_info(self: *Self) void { const editor = self.get_active_editor() orelse return; var sfa = std.heap.stackFallback(512, self.allocator);