fix: handle absolute file paths in open file prompt

This commit is contained in:
Ian Johnson 2025-12-28 13:59:43 -05:00 committed by CJ van den Berg
parent eae28536d2
commit e39a118c70
2 changed files with 16 additions and 5 deletions

View file

@ -1040,6 +1040,8 @@ pub fn abbreviate_home(buf: []u8, path: []const u8) []const u8 {
return "~";
} else if (homerelpath.len > 3 and std.mem.eql(u8, homerelpath[0..3], "../")) {
return path;
} else if (homerelpath.len + 2 > buf.len) {
return path;
} else {
buf[0] = '~';
buf[1] = '/';