aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/js/language/japanese-util.js2
-rw-r--r--test/test-japanese.js7
2 files changed, 8 insertions, 1 deletions
diff --git a/ext/js/language/japanese-util.js b/ext/js/language/japanese-util.js
index 4d317396..861d66e8 100644
--- a/ext/js/language/japanese-util.js
+++ b/ext/js/language/japanese-util.js
@@ -531,7 +531,7 @@ const JapaneseUtil = (() => {
_segmentizeFurigana(reading, readingNormalized, groups, groupsStart) {
const groupCount = groups.length - groupsStart;
if (groupCount <= 0) {
- return [];
+ return reading.length === 0 ? [] : null;
}
const group = groups[groupsStart];
diff --git a/test/test-japanese.js b/test/test-japanese.js
index 1a4fc494..e9fb9c90 100644
--- a/test/test-japanese.js
+++ b/test/test-japanese.js
@@ -707,6 +707,13 @@ function testDistributeFurigana() {
{text: 'サボ', furigana: ''},
{text: 'る', furigana: 'ル'}
]
+ ],
+ // Reading starts with expression, but has remainder characters
+ [
+ ['シック', 'シック・ビルしょうこうぐん'],
+ [
+ {text: 'シック', furigana: 'シック・ビルしょうこうぐん'}
+ ]
]
];