Reset // Properly set CHS and CHT mode switches.

This commit is contained in:
ShikiSuen 2022-02-08 18:54:13 +08:00
parent b047bad692
commit 06442f29cc
3 changed files with 11 additions and 1 deletions

View File

@ -9,6 +9,7 @@ NS_ASSUME_NONNULL_BEGIN
typedef NSString *const InputMode NS_TYPED_ENUM;
extern InputMode imeModeCHT;
extern InputMode imeModeCHS;
extern InputMode imeModeNULL;
@class KeyHandler;

View File

@ -16,6 +16,7 @@ using namespace vChewing;
InputMode imeModeCHT = @"org.atelierInmu.inputmethod.vChewing.IMECHT";
InputMode imeModeCHS = @"org.atelierInmu.inputmethod.vChewing.IMECHS";
InputMode imeModeNULL = @"org.atelierInmu.inputmethod.vChewing.IMENULL";
static const double kEpsilon = 0.000001;

View File

@ -101,7 +101,15 @@ class ctlInputMethod: IMKInputController {
}
override func setValue(_ value: Any!, forTag tag: Int, client: Any!) {
let newInputMode = InputMode(rawValue: value as? String ?? InputMode.imeModeCHT.rawValue)
var newInputMode = InputMode(rawValue: value as? String ?? InputMode.imeModeNULL.rawValue)
switch newInputMode {
case InputMode.imeModeCHS:
newInputMode = InputMode.imeModeCHS
case InputMode.imeModeCHT:
newInputMode = InputMode.imeModeCHT
default:
newInputMode = InputMode.imeModeNULL
}
mgrLangModel.loadDataModel(newInputMode)
if keyHandler.inputMode != newInputMode {
UserDefaults.standard.synchronize()