mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-27 18:57:42 +00:00
Pressing backspace corrupts cached context with SMP characters
This commit is contained in:
parent
dcb70b8dfd
commit
3ffa329f20
2 changed files with 15 additions and 2 deletions
|
|
@ -84,8 +84,11 @@ WCHAR *AppContext::BufMax(int n) // Used only by IMX DLLs
|
|||
|
||||
void AppContext::Delete()
|
||||
{
|
||||
if(CharIsDeadkey()) pos -= 2;
|
||||
|
||||
if (CharIsDeadkey()) {
|
||||
pos -= 2;
|
||||
} else if (CharIsSurrogatePair()) {
|
||||
pos--;
|
||||
}
|
||||
//SendDebugMessageFormat(0, sdmAIDefault, 0, "AppContext::Delete");
|
||||
|
||||
if(pos > 0) pos--;
|
||||
|
|
@ -144,6 +147,15 @@ BOOL AppContext::CharIsDeadkey()
|
|||
CurContext[pos-2] == CODE_DEADKEY;
|
||||
}
|
||||
|
||||
BOOL AppContext::CharIsSurrogatePair()
|
||||
{
|
||||
if (pos < 2) // low_surrogate, high_surrogate
|
||||
return FALSE;
|
||||
|
||||
return Uni_IsSurrogate1(CurContext[pos - 2]) &&
|
||||
Uni_IsSurrogate2(CurContext[pos - 1]);
|
||||
}
|
||||
|
||||
/* AppActionQueue */
|
||||
|
||||
AppActionQueue::AppActionQueue()
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ public:
|
|||
WCHAR *BufMax(int n);
|
||||
WCHAR *Buf(int n);
|
||||
BOOL CharIsDeadkey();
|
||||
BOOL CharIsSurrogatePair();
|
||||
};
|
||||
|
||||
class AppContextWithStores : public AppContext // I4978
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue