Skip to content

Commit 70b7f68

Browse files
committed
check assistchar before check is sp #22
1 parent 26001c2 commit 70b7f68

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Packages/ilimi_MainAssembly/Sources/ilimiMainAssembly/IlimiInputController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ extension IlimiInputController {
247247

248248
func commitText(client sender: Any!, text: String) {
249249
// 在快打模式下如果不是最簡碼不會輸出,並且會要求使用重新最簡碼重打
250-
if !isASCIIMode, InputContext.shared.isSpMode, !SpModeManager.checkInputIsSp(text) {
250+
if !isASCIIMode, InputContext.shared.isSpMode, !SpModeManager.checkInputIsSp(text, assistSelectChar.chr) {
251251
cleanComposition()
252252
let res = SpModeManager.getSpKeyOfChar(text).joined(separator: "")
253253
NotifierController.notify(message: "\(text)的簡碼為\(res)", stay: true)

Packages/ilimi_MainAssembly/Sources/ilimiMainAssembly/Utils/SpMode/SpModeManager.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ class SpModeManager {
1717
return getSpOfCharWithoutLiuTab(chr)
1818
}
1919

20-
static func checkInputIsSp(_ text: String) -> Bool {
20+
static func checkInputIsSp(_ text: String, _ assistChar: String) -> Bool {
2121
let isLoadByLiu = UserDefaults.standard.bool(forKey: "isLoadByLiuUniTab")
22-
let input = InputContext.shared.getCurrentInput()
22+
var input = InputContext.shared.getCurrentInput()
23+
if !assistChar.isEmpty {
24+
input.removeLast()
25+
}
2326
if isLoadByLiu, !getSpOfCharWithLiuTab(text).contains(input) {
2427
return false
2528
}

0 commit comments

Comments
 (0)