Skip to content

Commit

Permalink
fix: find all in range bug
Browse files Browse the repository at this point in the history
  • Loading branch information
anijanyan committed Oct 15, 2022
1 parent 86d47fa commit 13bd553
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ var Search = function() {

if (range) {
var startColumn = range.start.column;
var endColumn = range.start.column;
var endColumn = range.end.column;
var i = 0, j = ranges.length - 1;
while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == 0)
i++;

while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
var endRow = range.end.row - range.start.row;
while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == endRow)
j--;

ranges = ranges.slice(i, j + 1);
Expand Down

0 comments on commit 13bd553

Please sign in to comment.