feat(buffers): add delete_buffer command and keybinding for buffer_palette
This commit is contained in:
parent
a4ac3a42fd
commit
0a632416a4
5 changed files with 50 additions and 5 deletions
|
@ -47,10 +47,18 @@ pub fn open_scratch(self: *Self, file_path: []const u8, content: []const u8) Buf
|
|||
return buffer;
|
||||
}
|
||||
|
||||
pub fn retire(_: *Self, buffer: *Buffer) void {
|
||||
buffer.update_last_used_time();
|
||||
pub fn get_buffer_for_file(self: *Self, file_path: []const u8) ?*Buffer {
|
||||
return self.buffers.get(file_path);
|
||||
}
|
||||
|
||||
pub fn delete_buffer(self: *Self, file_path: []const u8) bool {
|
||||
const buffer = self.buffers.get(file_path) orelse return false;
|
||||
buffer.deinit();
|
||||
return self.buffers.remove(file_path);
|
||||
}
|
||||
|
||||
pub fn retire(_: *Self, _: *Buffer) void {}
|
||||
|
||||
pub fn list_most_recently_used(self: *Self, allocator: std.mem.Allocator) error{OutOfMemory}![]*Buffer {
|
||||
var buffers: std.ArrayListUnmanaged(*Buffer) = .{};
|
||||
var i = self.buffers.iterator();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue