summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-19 18:39:43 -0500
committerGitHub <noreply@github.com>2021-02-19 18:39:43 -0500
commit1e927dd66e24b72ac3ba129dfb578746ce896ce2 (patch)
treeb678d6de8cf61440c6c10ef6e9568ccff6ffe5b9 /ext
parent6a6d7ba84e778d1e5917f905748fe752a8712016 (diff)
Fix translation regex replacements (#1423)
* Fix regex replacements having issues at the start of scanned text * Fix test cases * Add tests
Diffstat (limited to 'ext')
-rw-r--r--ext/js/language/translator.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js
index 729c8294..fc71bf7f 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -1361,8 +1361,8 @@ class Translator {
pattern.lastIndex += delta;
if (actualReplacementLength > 0) {
- sourceMap.combine(Math.max(0, index - 1), matchText.length);
sourceMap.insert(index, ...(new Array(actualReplacementLength).fill(0)));
+ sourceMap.combine(index - 1 + actualReplacementLength, matchText.length);
} else {
sourceMap.combine(index, matchText.length);
}