fix: location_update should use editor that generated the event

This commit is contained in:
CJ van den Berg 2026-01-14 19:54:25 +01:00
parent bad1ededc1
commit b1cf854ed4
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1478,7 +1478,7 @@ pub fn handle_editor_event(self: *Self, editor: *ed.Editor, m: tp.message) tp.re
var sel: ed.Selection = undefined; var sel: ed.Selection = undefined;
if (try m.match(.{ "E", "location", tp.more })) if (try m.match(.{ "E", "location", tp.more }))
return self.location_update(m); return self.location_update(editor, m);
if (try m.match(.{ "E", "close" })) { if (try m.match(.{ "E", "close" })) {
if (!self.closing_project) { if (!self.closing_project) {
@ -1511,11 +1511,11 @@ pub fn handle_editor_event(self: *Self, editor: *ed.Editor, m: tp.message) tp.re
} }
} }
pub fn location_update(self: *Self, m: tp.message) tp.result { pub fn location_update(self: *Self, editor: *ed.Editor, m: tp.message) tp.result {
var row: usize = 0; var row: usize = 0;
var col: usize = 0; var col: usize = 0;
const file_path = self.get_active_file_path() orelse return; const file_path = editor.file_path orelse return;
const ephemeral = if (self.get_active_buffer()) |buffer| buffer.is_ephemeral() else false; const ephemeral = if (editor.buffer) |buffer| buffer.is_ephemeral() else false;
if (try m.match(.{ tp.any, tp.any, tp.any, tp.extract(&row), tp.extract(&col) })) { if (try m.match(.{ tp.any, tp.any, tp.any, tp.extract(&row), tp.extract(&col) })) {
if (row == 0 and col == 0) return; if (row == 0 and col == 0) return;