fix off by one error

This commit is contained in:
siikamiika 2019-08-19 19:47:45 +03:00
parent 1d6eb1c3d9
commit 39b2456ce9

View File

@ -180,7 +180,7 @@ class TextSourceRange {
let consumed = 0;
let stripped = 0;
while (state.remainder - consumed > 0) {
const currentChar = node.nodeValue[offset - consumed - stripped]; // negative indices are undefined in JS
const currentChar = node.nodeValue[offset - 1 - consumed - stripped]; // negative indices are undefined in JS
if (!currentChar) {
break;
} else if (currentChar.match(IGNORE_TEXT_PATTERN)) {