engine: a Hanja word shows once, as every other candidate does

hanjaquery was the only query that assigned dictprefix's output straight
into im.kouho; emojiquery, dictqjp and katakouho all go through
addkouho, which is the only place a duplicate is dropped.  Two readings
under one prefix can carry the same word, and 198 of the 61,479 one- and
two-syllable prefixes in hanja.dict do: 게 listed 偈句 at rows 8 and 9,
개근 listed 皆勤狀 twice in five.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-18 16:20:18 +09:00
parent 1bc0ba0491
commit 761428dbc4
2 changed files with 7 additions and 3 deletions

View File

@@ -653,14 +653,16 @@ emojiquery(void)
static void static void
hanjaquery(void) hanjaquery(void)
{ {
Str tail; Str kouho[Maxkouho], tail;
int i, n;
transstr(im.l, &search.seed, &search.raw, &tail); transstr(im.l, &search.seed, &search.raw, &tail);
search.text = search.back; search.text = search.back;
sappend(&search.text, &tail); sappend(&search.text, &tail);
clearkouho(); clearkouho();
im.nkouho = dictprefix(getlang(LangHANJA)->dict, &search.text, n = dictprefix(getlang(LangHANJA)->dict, &search.text, kouho, Maxkouho);
im.kouho, Maxkouho); for(i = 0; i < n; i++)
addkouho(&kouho[i]);
selectfirst(); selectfirst();
} }

View File

@@ -2072,6 +2072,8 @@ engine_hanja_word_prefix(struct ct *t)
Str com; Str com;
hanjabegin(&f, LangKO); hanjabegin(&f, LangKO);
/* Two readings under one prefix may share a word; it shows once. */
setdict(f.dictlang->dict, "민민", "");
sclear(&com); sclear(&com);
if(!CT_CHECK(t, keystroke('h', Mctrl, &com)) || if(!CT_CHECK(t, keystroke('h', Mctrl, &com)) ||
!typekeys(t, "als", &com)) !typekeys(t, "als", &com))