Skip to content

Commit

Permalink
Merge pull request #1865 from ntchjb/master
Browse files Browse the repository at this point in the history
Fix search addons: searchTerm should not be matched if the beginning of matching index < 0
  • Loading branch information
Tyriar committed Dec 28, 2018
2 parents c133c64 + 913150f commit 4375b3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/addons/search/SearchHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ export class SearchHelper implements ISearchHelper {
}
} else {
if (isReverseSearch) {
resultIndex = searchStringLine.lastIndexOf(searchTerm, col - searchTerm.length);
if (col - searchTerm.length >= 0) {
resultIndex = searchStringLine.lastIndexOf(searchTerm, col - searchTerm.length);
}
} else {
resultIndex = searchStringLine.indexOf(searchTerm, col);
}
Expand Down

0 comments on commit 4375b3c

Please sign in to comment.