aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-28 15:44:57 -0500
committerGitHub <noreply@github.com>2021-02-28 15:44:57 -0500
commitec1a8380b5dd1b091fcdbb96edcdab56c9df9f9e (patch)
treea33f38cdf0250d34ed7a97f166895fdc1d8e75c0
parent1dfcd3e43587255dd5103cefc472d6f6f1971127 (diff)
Fix a poorly handled edge case of the scanning parser (#1468)
-rw-r--r--ext/js/background/backend.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index 3d8c4c4a..1238673b 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -1045,7 +1045,11 @@ class Backend {
text.substring(0, scanningLength),
findTermsOptions
);
- if (definitions.length > 0 && sourceLength > 0) {
+ if (
+ definitions.length > 0 &&
+ sourceLength > 0 &&
+ (sourceLength !== 1 || this._japaneseUtil.isCodePointJapanese(text[0]))
+ ) {
const {expression, reading} = definitions[0];
const source = text.substring(0, sourceLength);
for (const {text: text2, furigana} of jp.distributeFuriganaInflected(expression, reading, source)) {