Skip to content

Commit

Permalink
fix: Do not render selected word markers for the same range multiple …
Browse files Browse the repository at this point in the history
…times (#4727)

* fix: Do not render selected word markers for the same range multiple times

* use map instead of set
  • Loading branch information
andrewnester authored May 30, 2022
1 parent 045a3e6 commit cd30f59
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/ace/search_highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var SearchHighlight = function(regExp, clazz, type) {
if (!this.regExp)
return;
var start = config.firstRow, end = config.lastRow;
var renderedMarkerRanges = {};

for (var i = start; i <= end; i++) {
var ranges = this.cache[i];
Expand All @@ -70,8 +71,13 @@ var SearchHighlight = function(regExp, clazz, type) {
}

for (var j = ranges.length; j --; ) {
var rangeToAddMarkerTo = ranges[j].toScreenRange(session);
var rangeAsString = rangeToAddMarkerTo.toString();
if (renderedMarkerRanges[rangeAsString]) continue;

renderedMarkerRanges[rangeAsString] = true;
markerLayer.drawSingleLineMarker(
html, ranges[j].toScreenRange(session), this.clazz, config);
html, rangeToAddMarkerTo, this.clazz, config);
}
}
};
Expand Down

0 comments on commit cd30f59

Please sign in to comment.