feat(buffers): add hidden indicator to buffer palette
This commit is contained in:
parent
939537ed84
commit
9e1b9920ba
1 changed files with 7 additions and 1 deletions
|
@ -12,6 +12,7 @@ pub const label = "Switch buffers";
|
||||||
pub const name = " buffer";
|
pub const name = " buffer";
|
||||||
pub const description = "buffer";
|
pub const description = "buffer";
|
||||||
const dirty_indicator = "";
|
const dirty_indicator = "";
|
||||||
|
const hidden_indicator = "-";
|
||||||
|
|
||||||
pub const Entry = struct {
|
pub const Entry = struct {
|
||||||
label: []const u8,
|
label: []const u8,
|
||||||
|
@ -23,7 +24,12 @@ pub fn load_entries(palette: *Type) !usize {
|
||||||
const buffers = try buffer_manager.list_most_recently_used(palette.allocator);
|
const buffers = try buffer_manager.list_most_recently_used(palette.allocator);
|
||||||
defer palette.allocator.free(buffers);
|
defer palette.allocator.free(buffers);
|
||||||
for (buffers) |buffer| {
|
for (buffers) |buffer| {
|
||||||
const hint = if (buffer.is_dirty()) dirty_indicator else "";
|
const hint = if (buffer.is_dirty())
|
||||||
|
dirty_indicator
|
||||||
|
else if (buffer.is_hidden())
|
||||||
|
hidden_indicator
|
||||||
|
else
|
||||||
|
"";
|
||||||
(try palette.entries.addOne()).* = .{ .label = buffer.file_path, .hint = hint };
|
(try palette.entries.addOne()).* = .{ .label = buffer.file_path, .hint = hint };
|
||||||
}
|
}
|
||||||
return if (palette.entries.items.len == 0) label.len else 2;
|
return if (palette.entries.items.len == 0) label.len else 2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue