From 57a462a36d7c101541cef334e13636d80e128bda Mon Sep 17 00:00:00 2001 From: Marcin Krzyzanowski Date: Thu, 9 Jan 2025 23:55:54 +0100 Subject: [PATCH] add trailing padding --- Sources/STTextViewAppKit/STTextView.swift | 2 +- Sources/STTextViewUIKit/STTextView.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/STTextViewAppKit/STTextView.swift b/Sources/STTextViewAppKit/STTextView.swift index 0269b61..290c02e 100644 --- a/Sources/STTextViewAppKit/STTextView.swift +++ b/Sources/STTextViewAppKit/STTextView.swift @@ -1187,7 +1187,7 @@ import AVFoundation if isHorizontallyResizable { // no-wrapping frameSize = CGSize( - width: max(usageBoundsForTextContainer.size.width + gutterWidth, visibleRect.width), + width: max(usageBoundsForTextContainer.size.width + gutterWidth + textContainer.lineFragmentPadding, visibleRect.width), height: max(usageBoundsForTextContainer.size.height, visibleRect.height - verticalScrollInset) ) } else { diff --git a/Sources/STTextViewUIKit/STTextView.swift b/Sources/STTextViewUIKit/STTextView.swift index a64b613..08ec86b 100644 --- a/Sources/STTextViewUIKit/STTextView.swift +++ b/Sources/STTextViewUIKit/STTextView.swift @@ -639,7 +639,7 @@ import STTextViewCommon open override func sizeToFit() { let gutterWidth = gutterView?.frame.width ?? 0 contentView.frame.origin.x = gutterWidth - contentView.frame.size.width = max(textLayoutManager.usageBoundsForTextContainer.size.width, frame.width - gutterWidth) + contentView.frame.size.width = max(textLayoutManager.usageBoundsForTextContainer.size.width + textContainer.lineFragmentPadding, frame.width - gutterWidth) contentView.frame.size.height = max(textLayoutManager.usageBoundsForTextContainer.size.height, frame.height) contentSize = contentView.frame.size