From 305c919bec998f108a195a0b2a9b18e5261d8765 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 18 Jun 2022 13:29:44 +0800 Subject: [PATCH] InputState // Add attributedString to .NotEmpty(). --- .../ControllerModules/InputState.swift | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/Source/Modules/ControllerModules/InputState.swift b/Source/Modules/ControllerModules/InputState.swift index 9cdbdfd2..56c29e8a 100644 --- a/Source/Modules/ControllerModules/InputState.swift +++ b/Source/Modules/ControllerModules/InputState.swift @@ -118,6 +118,17 @@ class InputState { defer { self.cursorIndex = cursorIndex } } + var attributedString: NSAttributedString { + let attributedString = NSAttributedString( + string: composingBuffer, + attributes: [ + .underlineStyle: NSUnderlineStyle.single.rawValue, + .markedClauseSegment: 0, + ] + ) + return attributedString + } + var description: String { "" } @@ -134,17 +145,6 @@ class InputState { super.init(composingBuffer: composingBuffer, cursorIndex: cursorIndex) } - var attributedString: NSAttributedString { - let attributedString = NSAttributedString( - string: composingBuffer, - attributes: [ - .underlineStyle: NSUnderlineStyle.single.rawValue, - .markedClauseSegment: 0, - ] - ) - return attributedString - } - override var description: String { ", poppedText:\(poppedText)>" } @@ -232,7 +232,7 @@ class InputState { defer { self.markerIndex = markerIndex } } - var attributedString: NSAttributedString { + override var attributedString: NSAttributedString { let attributedString = NSMutableAttributedString(string: composingBuffer) let end = markedRange.upperBound @@ -327,17 +327,6 @@ class InputState { super.init(composingBuffer: composingBuffer, cursorIndex: cursorIndex) } - var attributedString: NSAttributedString { - let attributedString = NSAttributedString( - string: composingBuffer, - attributes: [ - .underlineStyle: NSUnderlineStyle.single.rawValue, - .markedClauseSegment: 0, - ] - ) - return attributedString - } - override var description: String { "" }