feat: make mru file position lookup synchronous

This commit is contained in:
CJ van den Berg 2025-02-22 22:12:21 +01:00
parent 5f7b28db5f
commit 2a76da6cf6
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 16 additions and 7 deletions

View file

@ -359,6 +359,12 @@ const cmds = struct {
const same_file = if (self.get_active_file_path()) |fp| std.mem.eql(u8, fp, f) else false;
const have_editor_metadata = if (self.buffer_manager.get_buffer_for_file(f)) |_| true else false;
if (!same_file and !have_editor_metadata)
if (try project_manager.get_mru_position(self.allocator, f)) |pos| {
line = @intCast(pos.row);
column = @intCast(pos.col);
};
if (!same_file) {
if (self.get_active_editor()) |editor| {
editor.send_editor_jump_source() catch {};
@ -374,9 +380,6 @@ const cmds = struct {
try command.executeName("scroll_view_center", .{});
if (column) |col|
try command.executeName("goto_column", command.fmt(.{col}));
} else {
if (!same_file and !have_editor_metadata)
try project_manager.get_mru_position(f);
}
tui.need_render();
}