feat: add simple add_split command (wip)

This commit is contained in:
CJ van den Berg 2024-12-11 21:24:00 +01:00
parent d6ea615283
commit 8dea591341
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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);