Allows auto-commiting the first candidate when users input a punctuation in plan BPMF mode.

This commit is contained in:
zonble 2021-11-11 23:02:18 +08:00
parent dbf6e91d11
commit e22efd4e90
1 changed files with 8 additions and 9 deletions

View File

@ -984,14 +984,14 @@ public:
- (BOOL)handleCandidateEventWithInputText:(NSString *)inputText charCode:(UniChar)charCode keyCode:(NSUInteger)keyCode - (BOOL)handleCandidateEventWithInputText:(NSString *)inputText charCode:(UniChar)charCode keyCode:(NSUInteger)keyCode
{ {
if (_inputMode == kPlainBopomofoModeIdentifier) { // if (_inputMode == kPlainBopomofoModeIdentifier) {
if (charCode == '<') { // if (charCode == '<') {
keyCode = kPageUpKeyCode; // keyCode = kPageUpKeyCode;
} // }
else if (charCode == '>') { // else if (charCode == '>') {
keyCode = kPageDownKeyCode; // keyCode = kPageDownKeyCode;
} // }
} // }
BOOL cancelCandidateKey = BOOL cancelCandidateKey =
(charCode == 27) || (charCode == 27) ||
@ -1138,7 +1138,6 @@ public:
} }
if (_inputMode == kPlainBopomofoModeIdentifier) { if (_inputMode == kPlainBopomofoModeIdentifier) {
// TODO: also commit punctuation.
string layout = [self currentLayout]; string layout = [self currentLayout];
string customPunctuation = string("_punctuation_") + layout + string(1, (char)charCode); string customPunctuation = string("_punctuation_") + layout + string(1, (char)charCode);
string punctuation = string("_punctuation_") + string(1, (char)charCode); string punctuation = string("_punctuation_") + string(1, (char)charCode);