We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3f1d3f7 commit e287f0dCopy full SHA for e287f0d
src/highlight-support.js
@@ -45,8 +45,9 @@ const highlightSupport = {
45
this.win
46
)
47
48
- const actualStartIndex = startIndex
49
- const actualEndIndex = endIndex
+ // Do not let highlight exceed text range
+ const actualStartIndex = Math.min(Math.max(startIndex, 0), blockText.length - 1)
50
+ const actualEndIndex = Math.min(Math.max(endIndex, 1), blockText.length)
51
52
// If text is provided then validate that it matches
53
if (text && text !== blockText.slice(actualStartIndex, actualEndIndex)) {
0 commit comments