diff --git a/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift b/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift index f01933bd..84ce37b7 100644 --- a/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift +++ b/Packages/vChewing_PopupCompositionBuffer/Sources/PopupCompositionBuffer/PopupCompositionBuffer.swift @@ -62,6 +62,7 @@ public class PopupCompositionBuffer: NSWindowController { } let attrString: NSMutableAttributedString = .init(string: state.displayedTextConverted) + let attrPCBHeader: NSMutableAttributedString = .init(string: " ") let verticalAttributes: [NSAttributedString.Key: Any] = [ .verticalGlyphForm: true, .paragraphStyle: { @@ -77,6 +78,9 @@ public class PopupCompositionBuffer: NSWindowController { ] if isTypingDirectionVertical { + attrPCBHeader.setAttributes( + verticalAttributes, range: NSRange(location: 0, length: attrPCBHeader.length) + ) attrString.setAttributes( verticalAttributes, range: NSRange(location: 0, length: attrString.length) ) @@ -128,6 +132,8 @@ public class PopupCompositionBuffer: NSWindowController { : NSMutableAttributedString(string: "_", attributes: cursorAttributes) attrString.insert(attrCursor, at: state.u16Cursor) + attrString.insert(attrPCBHeader, at: 0) + textShown = attrString messageTextField.maximumNumberOfLines = 1 if let editor = messageTextField.currentEditor() {