fix(frontends): restart preedit around commits

This commit is contained in:
2026-08-15 15:42:35 +09:00
parent 67ed2ef478
commit a1ef8a4744
5 changed files with 136 additions and 30 deletions

6
ibus.c
View File

@@ -629,6 +629,7 @@ handlekey(DBusConnection *c, DBusMessage *m, Ictx *ctx)
dbus_uint32_t sym, code, state;
Keyres res;
char commit[Maxutf], preedit[Maxutf];
int restart;
dbus_error_init(&err);
if(!dbus_message_get_args(m, &err,
@@ -645,9 +646,12 @@ handlekey(DBusConnection *c, DBusMessage *m, Ictx *ctx)
return handlebool(c, m, 0);
stoutf(&res.commit, commit, sizeof commit);
stoutf(&res.preedit, preedit, sizeof preedit);
restart = clientpreedit(ctx) && commit[0] != '\0' && preowner == ctx;
if(restart)
emitpreedit(ctx, "");
if(commit[0] != '\0')
emitcommit(c, dbus_message_get_path(m), commit);
if(clientpreedit(ctx))
if(clientpreedit(ctx) && (!restart || preedit[0] != '\0'))
emitpreedit(ctx, preedit);
return handlebool(c, m, res.eaten);
}