aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/japanese.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/ext/bg/js/japanese.js b/ext/bg/js/japanese.js
index e8b258cb..71fbebb5 100644
--- a/ext/bg/js/japanese.js
+++ b/ext/bg/js/japanese.js
@@ -377,11 +377,11 @@
// Miscellaneous
- function collapseEmphaticSequences(sourceText, fullCollapse, sourceMap=null) {
+ function collapseEmphaticSequences(text, fullCollapse, sourceMap=null) {
let result = '';
let collapseCodePoint = -1;
const hasSourceMap = (sourceMap !== null);
- for (const char of sourceText) {
+ for (const char of text) {
const c = char.codePointAt(0);
if (c === HIRAGANA_SMALL_TSU_CODE_POINT || c === KATAKANA_SMALL_TSU_CODE_POINT) {
if (collapseCodePoint !== c) {
@@ -398,10 +398,7 @@
}
if (hasSourceMap) {
- const index = result.length;
- if (index > 0) {
- sourceMap.combine(index - 1, 1);
- }
+ sourceMap.combine(Math.max(0, result.length - 1), 1);
}
}
return result;