IME // Tweaking isPrintable().

This commit is contained in:
ShikiSuen 2022-07-06 12:32:33 +08:00
parent 42cc923425
commit 632739e39f
3 changed files with 3 additions and 3 deletions

View File

@ -116,7 +116,7 @@ extension KeyHandler {
var cleanedComposition = "" var cleanedComposition = ""
for theChar in composedText { for theChar in composedText {
if let charCode = theChar.utf16.first { if let charCode = theChar.utf16.first {
if !(theChar.isASCII && !(charCode.isPrintable())) { if !(theChar.isASCII && !(charCode.isPrintable)) {
cleanedComposition += String(theChar) cleanedComposition += String(theChar)
} }
} }

View File

@ -210,7 +210,7 @@ class ctlInputMethod: IMKInputController {
// //
// KeyHandler // KeyHandler
if !input.charCode.isPrintable() { if !input.charCode.isPrintable {
return false return false
} }

View File

@ -413,7 +413,7 @@ extension String {
// Ref: https://forums.swift.org/t/57085/5 // Ref: https://forums.swift.org/t/57085/5
extension UniChar { extension UniChar {
public func isPrintable() -> Bool { public var isPrintable: Bool {
guard Unicode.Scalar(UInt32(self)) != nil else { guard Unicode.Scalar(UInt32(self)) != nil else {
struct NotAWholeScalar: Error {} struct NotAWholeScalar: Error {}
return false return false