fix word wrap clipping by adjusting text container width for gutter offset

This commit is contained in:
jess 2026-04-05 05:24:07 -07:00
parent b1dd8653c9
commit 50dc72395e
1 changed files with 7 additions and 1 deletions

View File

@ -758,7 +758,7 @@ struct EditorTextView: NSViewRepresentable {
textView.isAutomaticLinkDetectionEnabled = false
textView.textContainerInset = NSSize(width: 4, height: 8)
textView.textContainer?.widthTracksTextView = true
textView.textContainer?.widthTracksTextView = false
textView.registerForDraggedTypes([.fileURL])
scrollView.documentView = textView
@ -1909,6 +1909,12 @@ class LineNumberTextView: NSTextView {
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) {
var widened = rect
widened.size.width = 2