engine: a mode switch shows the mode it switched to

Ctrl+S, Ctrl+N and the rest changed the mode with nothing to see; the
next key was the only way to tell.  The popup now shows A, 한, あ, ア, or
ă until a key is typed, beside the ☺ and 漢 a search already shows.
This commit is contained in:
2026-08-17 12:38:00 +09:00
parent c2aec44aa9
commit 6a6749e824
3 changed files with 37 additions and 0 deletions

View File

@@ -565,11 +565,25 @@ engine_korean_modifiers_and_backspace(struct ct *t)
void
engine_direct_language_modes(struct ct *t)
{
Drawcmd dc;
Str com;
init();
draindraw(nil);
sclear(&com);
CT_EQ_INT(t, LangEN, im.l->lang);
/* A switch shows the mode it switched to until the next key. */
CT_CHECK(t, keystroke('s', Mctrl, &com));
if(CT_CHECK(t, draindraw(&dc) > 0))
checkstr(t, "mode mark", "", &dc.pre);
CT_CHECK(t, keystroke('t', Mctrl, &com));
if(CT_CHECK(t, draindraw(&dc) > 0))
checkstr(t, "mode mark", "A", &dc.pre);
CT_CHECK(t, !keystroke('a', 0, &com));
if(CT_CHECK(t, draindraw(&dc) > 0))
CT_EQ_INT(t, 0, dc.pre.n);
CT_CHECK(t, !keystroke('a', 0, &com));
CT_EQ_INT(t, 0, draindraw(nil));
CT_EQ_PTR(t, nil, im.l->mapname);
CT_EQ_PTR(t, nil, im.l->map);
CT_EQ_PTR(t, nil, im.l->trans);