fix: retain the active owner's caret
This commit is contained in:
@@ -156,7 +156,7 @@ engine_dictionary_queue_latest_wins(struct ct *t)
|
||||
}
|
||||
|
||||
static Keyres
|
||||
ownerrequest(uvlong owner, int op, Rune key, u32int mod)
|
||||
ownerrequestat(uvlong owner, int op, Rune key, u32int mod, Caret *caret)
|
||||
{
|
||||
Channel *reply;
|
||||
Keyreq req;
|
||||
@@ -168,6 +168,8 @@ ownerrequest(uvlong owner, int op, Rune key, u32int mod)
|
||||
req.op = op;
|
||||
req.ks = key;
|
||||
req.mod = mod;
|
||||
if(caret != nil)
|
||||
req.caret = *caret;
|
||||
req.want = 1;
|
||||
req.reply = reply;
|
||||
imhandlekey(&req);
|
||||
@@ -176,6 +178,12 @@ ownerrequest(uvlong owner, int op, Rune key, u32int mod)
|
||||
return res;
|
||||
}
|
||||
|
||||
static Keyres
|
||||
ownerrequest(uvlong owner, int op, Rune key, u32int mod)
|
||||
{
|
||||
return ownerrequestat(owner, op, key, mod, nil);
|
||||
}
|
||||
|
||||
void
|
||||
engine_active_owner_lifecycle(struct ct *t)
|
||||
{
|
||||
@@ -224,6 +232,36 @@ engine_active_owner_lifecycle(struct ct *t)
|
||||
checkstr(t, "next owner first key", "k", &res.preedit);
|
||||
}
|
||||
|
||||
void
|
||||
engine_active_owner_caret(struct ct *t)
|
||||
{
|
||||
Caret a, moved;
|
||||
uvlong one, two;
|
||||
|
||||
one = ownernew();
|
||||
two = ownernew();
|
||||
memset(&a, 0, sizeof a);
|
||||
a.valid = 1;
|
||||
a.x = 10;
|
||||
a.y = 20;
|
||||
a.w = 3;
|
||||
a.h = 14;
|
||||
moved = a;
|
||||
moved.x = 80;
|
||||
init();
|
||||
im.l = getlang(LangJP);
|
||||
ownerrequestat(one, Keypress, 'k', 0, &a);
|
||||
CT_CHECK(t, caret.valid);
|
||||
CT_EQ_INT(t, 10, caret.x);
|
||||
ownerrequestat(two, Keycaret, 0, 0, &moved);
|
||||
CT_EQ_INT(t, 10, caret.x);
|
||||
ownerrequestat(one, Keycaret, 0, 0, &moved);
|
||||
CT_EQ_INT(t, 80, caret.x);
|
||||
ownerrequest(two, Keypress, 'n', 0);
|
||||
CT_EQ_UINT(t, two, activeowner);
|
||||
CT_CHECK(t, !caret.valid);
|
||||
}
|
||||
|
||||
void
|
||||
engine_commit_contract(struct ct *t)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ void engine_selects_visible_candidate(struct ct*);
|
||||
void engine_candidate_shortcut_modifiers(struct ct*);
|
||||
void engine_dictionary_queue_latest_wins(struct ct*);
|
||||
void engine_active_owner_lifecycle(struct ct*);
|
||||
void engine_active_owner_caret(struct ct*);
|
||||
void engine_commit_contract(struct ct*);
|
||||
void engine_language_switch_state(struct ct*);
|
||||
void engine_telex_history_bound(struct ct*);
|
||||
|
||||
@@ -84,6 +84,7 @@ static const struct ct_test tests[] = {
|
||||
{ "engine/candidate-shortcut-modifiers", engine_candidate_shortcut_modifiers },
|
||||
{ "engine/dictionary-queue-latest", engine_dictionary_queue_latest_wins },
|
||||
{ "engine/active-owner-lifecycle", engine_active_owner_lifecycle },
|
||||
{ "engine/active-owner-caret", engine_active_owner_caret },
|
||||
{ "engine/commit-contract", engine_commit_contract },
|
||||
{ "engine/language-switch-state", engine_language_switch_state },
|
||||
{ "engine/telex-history-bound", engine_telex_history_bound },
|
||||
|
||||
Reference in New Issue
Block a user