fix word wrap clipping by adjusting text container width for gutter offset
This commit is contained in:
parent
b1dd8653c9
commit
50dc72395e
|
|
@ -758,7 +758,7 @@ struct EditorTextView: NSViewRepresentable {
|
||||||
textView.isAutomaticLinkDetectionEnabled = false
|
textView.isAutomaticLinkDetectionEnabled = false
|
||||||
|
|
||||||
textView.textContainerInset = NSSize(width: 4, height: 8)
|
textView.textContainerInset = NSSize(width: 4, height: 8)
|
||||||
textView.textContainer?.widthTracksTextView = true
|
textView.textContainer?.widthTracksTextView = false
|
||||||
textView.registerForDraggedTypes([.fileURL])
|
textView.registerForDraggedTypes([.fileURL])
|
||||||
|
|
||||||
scrollView.documentView = textView
|
scrollView.documentView = textView
|
||||||
|
|
@ -1909,6 +1909,12 @@ class LineNumberTextView: NSTextView {
|
||||||
return NSPoint(x: LineNumberTextView.gutterWidth, y: textContainerInset.height)
|
return NSPoint(x: LineNumberTextView.gutterWidth, y: textContainerInset.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func setFrameSize(_ newSize: NSSize) {
|
||||||
|
super.setFrameSize(newSize)
|
||||||
|
let insetWidth = textContainerInset.width
|
||||||
|
textContainer?.size.width = newSize.width - LineNumberTextView.gutterWidth - insetWidth
|
||||||
|
}
|
||||||
|
|
||||||
override func drawInsertionPoint(in rect: NSRect, color: NSColor, turnedOn flag: Bool) {
|
override func drawInsertionPoint(in rect: NSRect, color: NSColor, turnedOn flag: Bool) {
|
||||||
var widened = rect
|
var widened = rect
|
||||||
widened.size.width = 2
|
widened.size.width = 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue