KeyHandler // Add Alt-key Punctuation Support.
This commit is contained in:
parent
39c86a4f63
commit
e932c1c37e
|
@ -272,7 +272,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the composing buffer is empty and there's no reading, and there is some function key combination, we ignore it
|
// if the composing buffer is empty and there's no reading, and there is some function key combination, we ignore it
|
||||||
BOOL isFunctionKey = ([input isCommandHold] || [input isOptionHold] || [input isNumericPad]) || [input isControlHotKey];
|
BOOL isFunctionKey = ([input isCommandHold] || [input isOptionHotKey] || [input isNumericPad]) || [input isControlHotKey];
|
||||||
if (![state isKindOfClass:[InputStateNotEmpty class]] &&
|
if (![state isKindOfClass:[InputStateNotEmpty class]] &&
|
||||||
![state isKindOfClass:[InputStateAssociatedPhrases class]] &&
|
![state isKindOfClass:[InputStateAssociatedPhrases class]] &&
|
||||||
isFunctionKey) {
|
isFunctionKey) {
|
||||||
|
@ -345,7 +345,7 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool composeReading = false;
|
bool composeReading = false;
|
||||||
BOOL skipBpmfHandling = [input isReservedKey] || [input isControlHold];
|
BOOL skipBpmfHandling = [input isReservedKey] || [input isControlHold] || [input isOptionHold];
|
||||||
|
|
||||||
// MARK: Handle BPMF Keys
|
// MARK: Handle BPMF Keys
|
||||||
|
|
||||||
|
@ -562,7 +562,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
// if nothing is matched, see if it's a punctuation key for current layout.
|
// if nothing is matched, see if it's a punctuation key for current layout.
|
||||||
|
|
||||||
std::string punctuationNamePrefix;
|
std::string punctuationNamePrefix;
|
||||||
if ([input isControlHold]) {
|
if ([input isOptionHold]) {
|
||||||
|
punctuationNamePrefix = std::string("_alt_punctuation_");
|
||||||
|
} else if ([input isControlHold]) {
|
||||||
punctuationNamePrefix = std::string("_ctrl_punctuation_");
|
punctuationNamePrefix = std::string("_ctrl_punctuation_");
|
||||||
} else if (mgrPrefs.halfWidthPunctuationEnabled) {
|
} else if (mgrPrefs.halfWidthPunctuationEnabled) {
|
||||||
punctuationNamePrefix = std::string("_half_punctuation_");
|
punctuationNamePrefix = std::string("_half_punctuation_");
|
||||||
|
@ -1239,7 +1241,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
if (mgrPrefs.useSCPCTypingMode) {
|
if (mgrPrefs.useSCPCTypingMode) {
|
||||||
std::string layout = [self _currentLayout];
|
std::string layout = [self _currentLayout];
|
||||||
std::string punctuationNamePrefix;
|
std::string punctuationNamePrefix;
|
||||||
if ([input isControlHold]) {
|
if ([input isOptionHold]) {
|
||||||
|
punctuationNamePrefix = std::string("_alt_punctuation_");
|
||||||
|
} else if ([input isControlHold]) {
|
||||||
punctuationNamePrefix = std::string("_ctrl_punctuation_");
|
punctuationNamePrefix = std::string("_ctrl_punctuation_");
|
||||||
} else if (mgrPrefs.halfWidthPunctuationEnabled) {
|
} else if (mgrPrefs.halfWidthPunctuationEnabled) {
|
||||||
punctuationNamePrefix = std::string("_half_punctuation_");
|
punctuationNamePrefix = std::string("_half_punctuation_");
|
||||||
|
|
|
@ -134,6 +134,10 @@ class keyParser: NSObject {
|
||||||
flags.contains([.control]) && inputText?.first?.isLetter ?? false
|
flags.contains([.control]) && inputText?.first?.isLetter ?? false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc var isOptionHotKey: Bool {
|
||||||
|
flags.contains([.option]) && inputText?.first?.isLetter ?? false
|
||||||
|
}
|
||||||
|
|
||||||
@objc var isOptionHold: Bool {
|
@objc var isOptionHold: Bool {
|
||||||
flags.contains([.option])
|
flags.contains([.option])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue