diff --git a/src/tui/mode/mini/open_file.zig b/src/tui/mode/mini/open_file.zig index ea2cb40..2cc4694 100644 --- a/src/tui/mode/mini/open_file.zig +++ b/src/tui/mode/mini/open_file.zig @@ -34,14 +34,12 @@ pub fn name(_: *Type) []const u8 { } pub fn select(self: *Type) void { - { - var buf: std.ArrayList(u8) = .empty; - defer buf.deinit(self.allocator); - const file_path = project_manager.expand_home(self.allocator, &buf, self.file_path.items); - if (root.is_directory(file_path)) - tp.self_pid().send(.{ "cmd", "change_project", .{file_path} }) catch {} - else if (file_path.len > 0) - tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } }) catch {}; - } + var buf: std.ArrayList(u8) = .empty; + defer buf.deinit(self.allocator); + const file_path = project_manager.expand_home(self.allocator, &buf, self.file_path.items); + if (root.is_directory(file_path)) + tp.self_pid().send(.{ "cmd", "change_project", .{file_path} }) catch {} + else if (file_path.len > 0) + tp.self_pid().send(.{ "cmd", "navigate", .{ .file = file_path } }) catch {}; command.executeName("exit_mini_mode", .{}) catch {}; } diff --git a/src/tui/mode/mini/save_as.zig b/src/tui/mode/mini/save_as.zig index c2b34e3..4593699 100644 --- a/src/tui/mode/mini/save_as.zig +++ b/src/tui/mode/mini/save_as.zig @@ -2,7 +2,6 @@ const std = @import("std"); const tp = @import("thespian"); const root = @import("soft_root").root; const command = @import("command"); -const project_manager = @import("project_manager"); const tui = @import("../../tui.zig"); @@ -27,13 +26,8 @@ pub fn name(_: *Type) []const u8 { } pub fn select(self: *Type) void { - { - var buf: std.ArrayList(u8) = .empty; - defer buf.deinit(self.allocator); - const file_path = project_manager.expand_home(self.allocator, &buf, self.file_path.items); - if (root.is_directory(file_path)) return; - if (file_path.len > 0) - tp.self_pid().send(.{ "cmd", "save_file_as", .{file_path} }) catch {}; - } + if (root.is_directory(self.file_path.items)) return; + if (self.file_path.items.len > 0) + tp.self_pid().send(.{ "cmd", "save_file_as", .{self.file_path.items} }) catch {}; command.executeName("exit_mini_mode", .{}) catch {}; }