feat: add support for ~ expansion to open_file command and file_browser

This commit is contained in:
CJ van den Berg 2025-06-19 16:08:34 +02:00
parent 9a580ac0e7
commit a33f6c8c2b
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 43 additions and 25 deletions

View file

@ -380,7 +380,10 @@ const cmds = struct {
try open_project_cwd(self, .{});
}
const f = project_manager.normalize_file_path(file orelse return);
const f_ = project_manager.normalize_file_path(file orelse return);
var buf = std.ArrayList(u8).init(self.allocator);
defer buf.deinit();
const f = project_manager.expand_home(&buf, f_);
const same_file = if (self.get_active_file_path()) |fp| std.mem.eql(u8, fp, f) else false;
const have_editor_metadata = if (self.buffer_manager.get_buffer_for_file(f)) |_| true else false;