From 8be06a89d5e13bc04ee6fc3b0fc86a457a0cc73a Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 19 Jan 2022 12:07:24 +0800 Subject: [PATCH] Fixed a regression of KangXi mode hotkey failure. - Previously, the KangXi mode switch was actually not inserted to the menu in the CHS mode when I was trying to just hide it. This leads to the defect of the hotkey used for toggling the KangXi mode. This feature needs will be dealt later. Fixed a regression of KangXi mode hotkey failure. // p2 --- Source/InputMethodController.mm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 8bc7f1ba..102230d4 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -138,11 +138,9 @@ static double FindHighestScore(const vector& nodes, double epsilon) [menu addItemWithTitle:NSLocalizedString(@"vChewing Preferences", @"") action:@selector(showPreferences:) keyEquivalent:@""]; - if ((_inputMode == kBopomofoModeIdentifierCHT) && optionKeyPressed) { - NSMenuItem *chineseConversionMenuItem = [menu addItemWithTitle:NSLocalizedString(@"Force KangXi Writing", @"") action:@selector(toggleChineseConverter:) keyEquivalent:@"K"]; + NSMenuItem *chineseConversionMenuItem = [menu addItemWithTitle:NSLocalizedString(@"Force KangXi Writing", @"") action:@selector(toggleChineseConverter:) keyEquivalent:@"K"]; chineseConversionMenuItem.keyEquivalentModifierMask = NSEventModifierFlagCommand | NSEventModifierFlagControl; chineseConversionMenuItem.state = Preferences.chineseConversionEnabled ? NSControlStateValueOn : NSControlStateValueOff; - } NSMenuItem *halfWidthPunctuationMenuItem = [menu addItemWithTitle:NSLocalizedString(@"Use Half-Width Punctuations", @"") action:@selector(toggleHalfWidthPunctuation:) keyEquivalent:@""]; halfWidthPunctuationMenuItem.state = Preferences.halfWidthPunctuationEnabled ? NSControlStateValueOn : NSControlStateValueOff; @@ -1491,10 +1489,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; } - (void)toggleChineseConverter:(id)sender { - if (_inputMode == kBopomofoModeIdentifierCHT) { - BOOL chineseConversionEnabled = [Preferences toggleChineseConversionEnabled]; - [NotifierController notifyWithMessage:[NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"Force KangXi Writing", @""), @"\n", chineseConversionEnabled ? NSLocalizedString(@"NotificationSwitchON", @"") : NSLocalizedString(@"NotificationSwitchOFF", @"")] stay:NO]; - } + [NotifierController notifyWithMessage:[NSString stringWithFormat:@"%@%@%@", NSLocalizedString(@"Force KangXi Writing", @""), @"\n", [Preferences toggleChineseConversionEnabled] ? NSLocalizedString(@"NotificationSwitchON", @"") : NSLocalizedString(@"NotificationSwitchOFF", @"")] stay:NO]; } - (void)toggleHalfWidthPunctuation:(id)sender