Skip to content

Commit ebecdd4

Browse files
gorhillmarijnh
authored andcommitted
[matchesonscrollbar addon] Fix possible discrepancy with search query
The scrollbar annotations may fail to match search query under certain circumstances. This happens when the search cursor is `multiline: false`. The matchesonscrollbar addon does not have a way to indicate `multiline: false`, the multiline status is heuristically determined and because of this it may end up being opposite of the status of the search cursor.
1 parent c18094e commit ebecdd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

addon/search/matchesonscrollbar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
if (match.from.line >= this.gap.to) break;
4747
if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);
4848
}
49-
var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold);
49+
var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), {caseFold: this.caseFold, multiline: this.options.multiline});
5050
var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;
5151
while (cursor.findNext()) {
5252
var match = {from: cursor.from(), to: cursor.to()};

0 commit comments

Comments
 (0)