IME // Tweaking isPrintable().
This commit is contained in:
parent
42cc923425
commit
632739e39f
|
@ -116,7 +116,7 @@ extension KeyHandler {
|
|||
var cleanedComposition = ""
|
||||
for theChar in composedText {
|
||||
if let charCode = theChar.utf16.first {
|
||||
if !(theChar.isASCII && !(charCode.isPrintable())) {
|
||||
if !(theChar.isASCII && !(charCode.isPrintable)) {
|
||||
cleanedComposition += String(theChar)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ class ctlInputMethod: IMKInputController {
|
|||
|
||||
// 無法列印的訊號輸入,一概不作處理。
|
||||
// 這個過程不能放在 KeyHandler 內,否則不會起作用。
|
||||
if !input.charCode.isPrintable() {
|
||||
if !input.charCode.isPrintable {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -413,7 +413,7 @@ extension String {
|
|||
|
||||
// Ref: https://forums.swift.org/t/57085/5
|
||||
extension UniChar {
|
||||
public func isPrintable() -> Bool {
|
||||
public var isPrintable: Bool {
|
||||
guard Unicode.Scalar(UInt32(self)) != nil else {
|
||||
struct NotAWholeScalar: Error {}
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue