From 7b9a4071c8bda2e2555dcbe8b4b3b52013757d32 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Mon, 10 Nov 2025 12:28:59 +0100 Subject: [PATCH] fix: scan_prev_match should find the match at the cursor if it is not selected --- src/tui/editor.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tui/editor.zig b/src/tui/editor.zig index f83aba3..0c9b180 100644 --- a/src/tui/editor.zig +++ b/src/tui/editor.zig @@ -5388,8 +5388,9 @@ pub const Editor = struct { const count = self.matches.items.len; for (0..count) |i| { const match = if (self.matches.items[count - 1 - i]) |*m| m else continue; - if (!match.has_selection and (row > match.end.row or (row == match.end.row and col > match.end.col))) - return match; + if (match.has_selection) continue; + if (cursor.eql(match.end)) return match; + if (row > match.end.row or (row == match.end.row and col > match.end.col)) return match; } return null; }