ctlIME // Move char-clean to KeyHandler.buildInputtingState().

This commit is contained in:
ShikiSuen 2022-06-18 15:42:29 +08:00
parent 2a97a6a80a
commit efc513bf69
2 changed files with 13 additions and 13 deletions

View File

@ -113,8 +113,19 @@ extension KeyHandler {
let composedText = head + reading + tail
let cursorIndex = composedStringCursorIndex + reading.utf16.count
var cleanedComposition = ""
//
for theChar in composedText {
if let charCode = theChar.utf16.first {
if !(theChar.isASCII && !(charCode.isPrintable())) {
cleanedComposition += String(theChar)
}
}
}
/// 使
let stateResult = InputState.Inputting(composingBuffer: composedText, cursorIndex: cursorIndex)
let stateResult = InputState.Inputting(composingBuffer: cleanedComposition, cursorIndex: cursorIndex)
///
switch (tooltipParameterRef[0].isEmpty, tooltipParameterRef[1].isEmpty) {

View File

@ -303,19 +303,8 @@ extension ctlInputMethod {
return
}
var bufferOutput = ""
//
for theChar in buffer {
if let charCode = theChar.utf16.first {
if !(theChar.isASCII && !(charCode.isPrintable())) {
bufferOutput += String(theChar)
}
}
}
client().insertText(
bufferOutput, replacementRange: NSRange(location: NSNotFound, length: NSNotFound)
buffer, replacementRange: NSRange(location: NSNotFound, length: NSNotFound)
)
}