fix(windows): TSF apps delete all of smp

When the windows platform recieves the action for a backspace
it will check to see if the character being delete is a surrogate
pair. If it is and the app is TSF aware app it will need to backspace
twice to remove both parts of the surrogate pair. For legacy apps this
is not required.
This commit is contained in:
Ross 2022-09-08 22:28:35 +10:00
parent 066061f896
commit 0ed826a14f

View file

@ -30,8 +30,17 @@ static BOOL processAlert(AITIP* app) {
static BOOL processBack(AITIP* app, const km_kbp_action_item* actionItem) {
if (actionItem->backspace.expected_type == KM_KBP_BT_MARKER) {
app->QueueAction(QIT_BACK, BK_DEADKEY);
} else /* actionItem->backspace.expected_type == KM_KBP_BT_CHAR, KM_KBP_BT_UNKNOWN */ {
app->QueueAction(QIT_BACK, 0);
} else if(actionItem->backspace.expected_type == KM_KBP_BT_CHAR) {
// If this is a TSF-aware app we need to set the BK_SURROGATE flag to delete
// both parts of the surrogate pair. Legacy apps receive a BKSP WM_KEYDOWN event
// which results in deleting both parts in one action.
if (!app->IsLegacy() && Uni_IsSMP(actionItem->backspace.expected_value)) {
app->QueueAction(QIT_BACK, BK_DEFAULT | BK_SURROGATE);
} else {
app->QueueAction(QIT_BACK, BK_DEFAULT);
}
} else { // KM_KBP_BT_UNKNOWN
app->QueueAction(QIT_BACK, BK_DEFAULT);
}
return TRUE;
}