fix: do not auto_find if the selection is already a match

This commit is contained in:
CJ van den Berg 2026-01-14 12:57:06 +01:00
parent dc077350cd
commit 5362966a59
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1496,8 +1496,8 @@ pub fn handle_editor_event(self: *Self, _: tp.pid_ref, m: tp.message) tp.result
if (try m.match(.{ tp.any, tp.any, "none" }))
return self.clear_auto_find(editor);
if (try m.match(.{ tp.any, tp.any, tp.extract(&sel.begin.row), tp.extract(&sel.begin.col), tp.extract(&sel.end.row), tp.extract(&sel.end.col) })) {
if (editor.have_matches_not_of_type(.auto_find)) return;
if (!tui.config().enable_auto_find) return;
if (editor.find_selection_match(sel)) |_| return;
sel.normalize();
if (sel.end.row - sel.begin.row > ed.max_match_lines)
return self.clear_auto_find(editor);