fix: scan_next_match should find the match at the cursor if it is not selected
This commit is contained in:
parent
ee24810946
commit
834b61b16f
1 changed files with 6 additions and 3 deletions
|
|
@ -5366,9 +5366,12 @@ pub const Editor = struct {
|
||||||
const row = cursor.row;
|
const row = cursor.row;
|
||||||
const col = cursor.col;
|
const col = cursor.col;
|
||||||
const multi_cursor = self.cursels.items.len > 1;
|
const multi_cursor = self.cursels.items.len > 1;
|
||||||
for (self.matches.items) |*match_| if (match_.*) |*match|
|
for (self.matches.items) |*match_| if (match_.*) |*match| {
|
||||||
if ((!multi_cursor or !match.has_selection) and (row < match.begin.row or (row == match.begin.row and col < match.begin.col)))
|
if (match.has_selection) continue;
|
||||||
return match;
|
if (cursor.within(match.to_selection())) return match;
|
||||||
|
if (multi_cursor) continue;
|
||||||
|
if (row < match.begin.row or (row == match.begin.row and col < match.begin.col)) return match;
|
||||||
|
};
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue