fix: replace getLast by pop

This commit is contained in:
pnodet
2024-12-29 02:45:48 +01:00
parent a459b39b0e
commit 0a37fa42e6
2 changed files with 5 additions and 3 deletions

View File

@ -364,7 +364,7 @@ pub const App = struct {
};
// Get the last closed tab from the app-level storage
const last_tab: *LastClosedTab = parent.app.last_closed_tabs.getLast() orelse {
const last_tab: LastClosedTab = parent.app.last_closed_tabs.pop() orelse {
log.warn("No last closed tab found", .{});
return;
};

View File

@ -48,8 +48,10 @@ pub const LastClosedTabs = struct {
return self.this.len;
}
pub fn getLast(self: *LastClosedTabs) ?*LastClosedTab {
pub fn pop(self: *LastClosedTabs) ?LastClosedTab {
if (self.this.len == 0) return null;
return &self.this.buffer[self.this.len - 1];
const last = self.this.buffer[self.this.len - 1];
self.this.len -= 1;
return last;
}
};