fix: bug in scan_next_match causing add_cursor_next_match to fail

This commit is contained in:
CJ van den Berg 2025-11-19 19:14:02 +01:00
parent 9bebebc086
commit d08c65818f
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -5451,14 +5451,12 @@ pub const Editor = struct {
fn scan_next_match(self: *const Self, cursor: Cursor) ?*Match {
const row = cursor.row;
const col = cursor.col;
const multi_cursor = self.cursels.items.len > 1;
for (self.matches.items) |*match_| if (match_.*) |*match| {
if (match.has_selection) continue;
switch (tui.get_selection_style()) {
.normal => if (cursor.within(match.to_selection())) return match,
.inclusive => {},
}
if (multi_cursor) continue;
if (row < match.begin.row or (row == match.begin.row and col < match.begin.col)) return match;
};
return null;