fix: don't truncate scratch buffer names in tabs and terminal title

This commit is contained in:
CJ van den Berg 2025-06-24 12:20:06 +02:00
parent aa9aa0ac93
commit 53ea08a41e
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 8 additions and 1 deletions

View file

@ -420,6 +420,8 @@ const Tab = struct {
fn name_from_buffer(buffer: *Buffer) []const u8 {
const file_path = buffer.file_path;
if (file_path.len > 0 and file_path[0] == '*')
return file_path;
const basename_begin = std.mem.lastIndexOfScalar(u8, file_path, std.fs.path.sep);
const basename = if (basename_begin) |begin| file_path[begin + 1 ..] else file_path;
return basename;