fix: don't truncate scratch buffer names in tabs and terminal title
This commit is contained in:
parent
aa9aa0ac93
commit
53ea08a41e
2 changed files with 8 additions and 1 deletions
|
@ -180,7 +180,12 @@ fn render_terminal_title(self: *Self) void {
|
||||||
const project_path = tp.env.get().str("project");
|
const project_path = tp.env.get().str("project");
|
||||||
const project_name = project_manager.abbreviate_home(&project_name_buf, project_path);
|
const project_name = project_manager.abbreviate_home(&project_name_buf, project_path);
|
||||||
|
|
||||||
const file_name = if (std.mem.lastIndexOfScalar(u8, self.name, '/')) |pos| self.name[pos + 1 ..] else self.name;
|
const file_name = if (self.name.len > 0 and self.name[0] == '*')
|
||||||
|
self.name
|
||||||
|
else if (std.mem.lastIndexOfScalar(u8, self.name, '/')) |pos|
|
||||||
|
self.name[pos + 1 ..]
|
||||||
|
else
|
||||||
|
self.name;
|
||||||
const edit_state = if (!self.file_exists) "◌ " else if (self.file_dirty) " " else "";
|
const edit_state = if (!self.file_exists) "◌ " else if (self.file_dirty) " " else "";
|
||||||
|
|
||||||
const new_title = if (self.file)
|
const new_title = if (self.file)
|
||||||
|
|
|
@ -420,6 +420,8 @@ const Tab = struct {
|
||||||
|
|
||||||
fn name_from_buffer(buffer: *Buffer) []const u8 {
|
fn name_from_buffer(buffer: *Buffer) []const u8 {
|
||||||
const file_path = buffer.file_path;
|
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_begin = std.mem.lastIndexOfScalar(u8, file_path, std.fs.path.sep);
|
||||||
const basename = if (basename_begin) |begin| file_path[begin + 1 ..] else file_path;
|
const basename = if (basename_begin) |begin| file_path[begin + 1 ..] else file_path;
|
||||||
return basename;
|
return basename;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue