Repo // Tweak alsoConfirmAssociatedCandidatesByEnter().

This commit is contained in:
ShikiSuen 2023-06-26 00:05:12 +08:00
parent beed28efe8
commit 5b58442d67
4 changed files with 6 additions and 4 deletions

View File

@ -102,7 +102,7 @@ extension InputHandler {
if let keyCodeType = KeyCode(rawValue: input.keyCode) {
switch keyCodeType {
case .kLineFeed, .kCarriageReturn:
if state.type == .ofAssociates, !prefs.alsoConfirmAssociatedCandidatesByEnter {
if state.type == .ofAssociates, !(input.isShiftHold || prefs.alsoConfirmAssociatedCandidatesByEnter) {
delegate.switchState(IMEState.ofAbortion())
return true
}

View File

@ -114,7 +114,7 @@ public class PrefMgr: PrefMgrProtocol {
@AppProperty(key: UserDef.kAutoCorrectReadingCombination.rawValue, defaultValue: true)
public var autoCorrectReadingCombination: Bool
@AppProperty(key: UserDef.kAlsoConfirmAssociatedCandidatesByEnter.rawValue, defaultValue: true)
@AppProperty(key: UserDef.kAlsoConfirmAssociatedCandidatesByEnter.rawValue, defaultValue: false)
public var alsoConfirmAssociatedCandidatesByEnter: Bool
@AppProperty(key: UserDef.kKeepReadingUponCompositionError.rawValue, defaultValue: false)

View File

@ -6,6 +6,7 @@
// marks, or product names of Contributor, except as required to fulfill notice
// requirements defined in MIT License.
import AppKit
import Foundation
import Shared
import Tekkon
@ -99,7 +100,8 @@ public extension SessionCtl {
let candidateString: String = candidateString?.string ?? ""
if state.type == .ofAssociates {
// Shift+
if !PrefMgr.shared.alsoConfirmAssociatedCandidatesByEnter {
let isShiftHold = NSEvent.modifierFlags.contains(.shift)
if !(isShiftHold || PrefMgr.shared.alsoConfirmAssociatedCandidatesByEnter) {
switchState(IMEState.ofAbortion())
return
}

View File

@ -40,7 +40,7 @@ struct VwrPrefPaneBehavior: View {
@Backport.AppStorage(wrappedValue: true, UserDef.kUseSpaceToCommitHighlightedSCPCCandidate.rawValue)
private var useSpaceToCommitHighlightedSCPCCandidate: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kAlsoConfirmAssociatedCandidatesByEnter.rawValue)
@Backport.AppStorage(wrappedValue: false, UserDef.kAlsoConfirmAssociatedCandidatesByEnter.rawValue)
private var alsoConfirmAssociatedCandidatesByEnter: Bool
@Backport.AppStorage(wrappedValue: true, UserDef.kTogglingAlphanumericalModeWithLShift.rawValue)