engine: the chosen candidate is what the client shows
The preedit sent back to the owner was always impre(), the reading, so かく stayed underlined in the application while the popup showed 書く and Enter inserted 書く. Nothing was hidden -- the popup had it -- but the text did not stand where it was going to land, and mozc, fcitx5 and kime all put the candidate inline. Only the reply changes. impre() still answers the reading everywhere it is the reading that is wanted: commitim, the okurigana mark, the seed Ctrl+H takes, and snapshot, so a popup that draws the preedit itself keeps the reading above the list where it says something the highlighted row does not. Consulting im.sel here is safe where consulting it inside impre() would not be: transstr memsets a local Im, whose sel is 0 and not -1, and this reply only ever reads the engine's own. Nothing in the suite pinned the old answer, so the test is new. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -411,6 +411,7 @@ engine_commit_contract(struct ct *t)
|
||||
{ 'd', "ㅇ", "ㅇㅇㅇ" },
|
||||
{ 'k', "ㅏ", "ㅏㅏㅏ" },
|
||||
};
|
||||
Drawcmd dc;
|
||||
Keyres res;
|
||||
Str all, com;
|
||||
char owner;
|
||||
@@ -495,6 +496,26 @@ engine_commit_contract(struct ct *t)
|
||||
CT_CHECK(t, !keystroke(0xf008, 0, &com));
|
||||
checkstr(t, "non-ASCII key commit", "か", &com);
|
||||
CT_EQ_INT(t, 0, im.pre.n);
|
||||
|
||||
/* A chosen candidate is what the client shows and what Enter
|
||||
* commits; the popup keeps the reading above the list. */
|
||||
init();
|
||||
im.l = getlang(LangJP);
|
||||
draindraw(nil);
|
||||
ownerrequestcap(&owner, 1, Keypress, 'k', 0);
|
||||
res = ownerrequestcap(&owner, 1, Keypress, 'a', 0);
|
||||
checkstr(t, "the reading before a candidate", "か", &res.preedit);
|
||||
im.kouho[0] = mkstr("蚊");
|
||||
im.nkouho = 1;
|
||||
res = ownerrequestcap(&owner, 1, Keypress, Kdown, 0);
|
||||
checkstr(t, "the candidate the client shows", "蚊", &res.preedit);
|
||||
clientpre = 0;
|
||||
redraw();
|
||||
if(CT_CHECK(t, draindraw(&dc) > 0))
|
||||
checkstr(t, "the popup keeps the reading", "か", &dc.pre);
|
||||
res = ownerrequestcap(&owner, 1, Keypress, Kret, 0);
|
||||
checkstr(t, "Enter commits what was shown", "蚊", &res.commit);
|
||||
CT_EQ_INT(t, 0, res.preedit.n);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user