Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): strip markers in actions_update_app_context_nfu() #10607

Merged
merged 6 commits into from
Feb 7, 2024
Merged
15 changes: 13 additions & 2 deletions core/src/actions_normalize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ km_core_usv *unicode_string_to_usv(icu::UnicodeString& src) {
/**
* Refresh app_context to match the cached_context. Does not do normalization,
* unlike `actions_normalize`. Used in conjunction with keyboard processors that
* do not support normalization.
* do not support normalization. Resulting app context is same as the cached
* context, but without markers.
*
* @param cached_context the cached context, in NFU, after transform has been
* applied to it by the keyboard processor
Expand All @@ -292,7 +293,6 @@ bool km::core::actions_update_app_context_nfu(
/* in */ km::core::context const *cached_context,
/* in, out */ km::core::context *app_context
) {
// We simply copy the cached_context to the app_context
km_core_status status = KM_CORE_STATUS_OK;
km_core_context_item *items = nullptr;

Expand All @@ -301,6 +301,17 @@ bool km::core::actions_update_app_context_nfu(
return false;
}

// Strip markers from returned context

int i, j;
for(i = 0, j = 0; items[i].type != KM_CORE_CT_END; i++) {
if(items[i].type == KM_CORE_CT_CHAR) {
mcdurdin marked this conversation as resolved.
Show resolved Hide resolved
items[j] = items[i];
j++;
}
}
items[j] = KM_CORE_CONTEXT_ITEM_END;

if((status = km_core_context_set(static_cast<km_core_context*>(app_context), items)) != KM_CORE_STATUS_OK) {
DebugLog("km_core_context_set failed with %d", status);
}
Expand Down
Loading
Loading