KeyHandler(Input) // Revised conditioning of letter inputs.
- This is to fix an issue of mishandling letter input condition.
This commit is contained in:
parent
62c9c66bec
commit
ae5237e0ff
|
@ -585,7 +585,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
|
||||
// Lukhnos 這裡的處理反而會使得 Apple 倚天注音動態鍵盤佈局「敲不了半形大寫英文」的缺點曝露無疑,所以注釋掉。
|
||||
// 至於他試圖用這種處理來解決的上游 UPR293 的問題,其實針對詞庫檔案的排序做點手腳就可以解決。威注音本來也就是這麼做的。
|
||||
if (/*[state isKindOfClass:[InputStateNotEmpty class]] && */(char) charCode >= 'A' && (char) charCode <= 'Z') {
|
||||
if (/*[state isKindOfClass:[InputStateNotEmpty class]] && */[input isUpperCaseASCIILetterKey]) {
|
||||
std::string letter = std::string("_letter_") + std::string(1, (char) charCode);
|
||||
if ([self _handlePunctuation:letter state:state usingVerticalMode:input.useVerticalMode stateCallback:stateCallback errorCallback:errorCallback]) {
|
||||
return YES;
|
||||
|
@ -1253,7 +1253,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
BOOL shouldAutoSelectCandidate = _bpmfReadingBuffer->isValidKey((char) charCode) || _languageModel->hasUnigramsForKey(customPunctuation) ||
|
||||
_languageModel->hasUnigramsForKey(punctuation);
|
||||
|
||||
if (!shouldAutoSelectCandidate && (char) charCode >= 'A' && (char) charCode <= 'Z') {
|
||||
if (!shouldAutoSelectCandidate && [input isUpperCaseASCIILetterKey]) {
|
||||
std::string letter = std::string("_letter_") + std::string(1, (char) charCode);
|
||||
if (_languageModel->hasUnigramsForKey(letter)) {
|
||||
shouldAutoSelectCandidate = YES;
|
||||
|
|
|
@ -233,6 +233,11 @@ class KeyHandlerInput: NSObject {
|
|||
KeyCode(rawValue: keyCode) == verticalModeOnlyChooseCandidateKey
|
||||
}
|
||||
|
||||
@objc var isUpperCaseASCIILetterKey: Bool {
|
||||
// 這裡必須加上「flags == .shift」,否則會出現某些情況下輸入法「誤判當前鍵入的非 Shift 字符為大寫」的問題。
|
||||
self.charCode >= 65 && self.charCode <= 90 && flags == .shift
|
||||
}
|
||||
|
||||
@objc var isSymbolMenuPhysicalKey: Bool {
|
||||
// 這裡必須用 KeyCode,這樣才不會受隨 macOS 版本更動的 Apple 動態注音鍵盤排列內容的影響。
|
||||
// 只是必須得與 ![input isShift] 搭配使用才可以(也就是僅判定 Shift 沒被摁下的情形)。
|
||||
|
|
Loading…
Reference in New Issue