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 // 使 20
var attributedStringSecured: (value: NSAttributedString, range: NSRange) { var attributedStringSecured: (value: NSAttributedString, range: NSRange) {
clientMitigationLevel >= 2 clientMitigationLevel >= 2
? (state.data.attributedStringPlaceholder, NSRange(location: 0, length: 0)) ? (state.data.attributedStringPlaceholder(for: self), NSRange(location: 0, length: 0))
: (state.attributedString, NSRange(state.u16MarkedRange)) : (state.attributedString(for: self), NSRange(state.u16MarkedRange))
} }
func lineHeightRect(zeroCursor: Bool = false) -> NSRect { func lineHeightRect(zeroCursor: Bool = false) -> NSRect {

View File

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