refactor: make get_next_mru_buffer prefer buffers from current split
This commit is contained in:
parent
51b2509f22
commit
cf7c54aa63
1 changed files with 12 additions and 0 deletions
|
|
@ -1927,6 +1927,18 @@ fn get_next_mru_buffer(self: *Self, mode: enum { all, hidden, non_hidden }) ?[]c
|
||||||
const buffers = self.buffer_manager.list_most_recently_used(self.allocator) catch return null;
|
const buffers = self.buffer_manager.list_most_recently_used(self.allocator) catch return null;
|
||||||
defer self.allocator.free(buffers);
|
defer self.allocator.free(buffers);
|
||||||
const active_file_path = self.get_active_file_path();
|
const active_file_path = self.get_active_file_path();
|
||||||
|
for (buffers) |buffer| {
|
||||||
|
if (active_file_path) |fp| if (std.mem.eql(u8, fp, buffer.get_file_path()))
|
||||||
|
continue;
|
||||||
|
if (switch (mode) {
|
||||||
|
.all => false,
|
||||||
|
.hidden => !buffer.hidden,
|
||||||
|
.non_hidden => buffer.hidden,
|
||||||
|
}) continue;
|
||||||
|
if (buffer.get_last_view() != self.active_view)
|
||||||
|
continue;
|
||||||
|
return buffer.get_file_path();
|
||||||
|
}
|
||||||
for (buffers) |buffer| {
|
for (buffers) |buffer| {
|
||||||
if (active_file_path) |fp| if (std.mem.eql(u8, fp, buffer.get_file_path()))
|
if (active_file_path) |fp| if (std.mem.eql(u8, fp, buffer.get_file_path()))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue