fix: scan_prev_match should find the match at the cursor if it is not selected

This commit is contained in:
CJ van den Berg 2025-11-10 12:28:59 +01:00
parent 834b61b16f
commit 7b9a4071c8
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -5388,8 +5388,9 @@ pub const Editor = struct {
const count = self.matches.items.len; const count = self.matches.items.len;
for (0..count) |i| { for (0..count) |i| {
const match = if (self.matches.items[count - 1 - i]) |*m| m else continue; 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))) if (match.has_selection) continue;
return match; 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; return null;
} }