SessionCtl // Use AttributeStrings generated by new methods.

This commit is contained in:
ShikiSuen 2023-04-28 01:31:38 +08:00
parent 1e27947579
commit b1f256ef05
2 changed files with 6 additions and 6 deletions

View File

@ -18,8 +18,8 @@ public extension SessionCtl {
// 使 20
var attributedStringSecured: (value: NSAttributedString, range: NSRange) {
clientMitigationLevel >= 2
? (state.data.attributedStringPlaceholder, NSRange(location: 0, length: 0))
: (state.attributedString, NSRange(state.u16MarkedRange))
? (state.data.attributedStringPlaceholder(for: self), NSRange(location: 0, length: 0))
: (state.attributedString(for: self), NSRange(state.u16MarkedRange))
}
func lineHeightRect(zeroCursor: Bool = false) -> NSRect {

View File

@ -109,11 +109,11 @@ public extension SessionCtl {
mitigation: if clientMitigationLevel == 1, state.type == .ofMarking {
if !PrefMgr.shared.disableSegmentedThickUnderlineInMarkingModeForManagedClients { break mitigation }
let neo = NSMutableAttributedString(attributedString: attributedStringSecured.value)
let rangeNeo = NSRange(location: 0, length: neo.string.utf16.count)
neo.setAttributes(
[
.underlineStyle: NSUnderlineStyle.thick.rawValue,
.markedClauseSegment: 0,
], range: NSRange(location: 0, length: neo.string.utf16.count)
mark(forStyle: kTSMHiliteSelectedConvertedText, at: rangeNeo)
as? [NSAttributedString.Key: Any]
?? [.underlineStyle: NSUnderlineStyle.thick.rawValue], range: rangeNeo
)
attrStr = neo
theRange = NSRange.zero