InputState // Add attributedString to .NotEmpty().

This commit is contained in:
ShikiSuen 2022-06-18 13:29:44 +08:00
parent ed98a4a7ea
commit 305c919bec
1 changed files with 12 additions and 23 deletions

View File

@ -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 {
"<InputState.NotEmpty, composingBuffer:\(composingBuffer), cursorIndex:\(cursorIndex)>"
}
@ -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 {
"<InputState.Inputting, composingBuffer:\(composingBuffer), cursorIndex:\(cursorIndex)>, 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 {
"<InputState.ChoosingCandidate, candidates:\(candidates), isTypingVertical:\(isTypingVertical), composingBuffer:\(composingBuffer), cursorIndex:\(cursorIndex)>"
}