Skip to content

Commit

Permalink
Revert contentInset. It doesn't work as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyzanowskim committed Jan 28, 2023
1 parent 86ccf20 commit 20370a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
1 change: 0 additions & 1 deletion STTextViewDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ final class ViewController: NSViewController {

textView.widthTracksTextView = false // wrap
textView.highlightSelectedLine = true
textView.contentInsets = NSEdgeInsets(top: 0, left: 0, bottom: 50, right: 0)
textView.textFinder.isIncrementalSearchingEnabled = true
textView.textFinder.incrementalSearchingShouldDimContentView = true
textView.delegate = self
Expand Down
20 changes: 4 additions & 16 deletions Sources/STTextView/STTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,6 @@ open class STTextView: NSView, NSTextInput {
}
}

/// The empty space the receiver leaves around its container
/// Allows setup overscroll behavior.
///
/// It is possible to set the text container and view sizes and resizing
/// behavior so that the inset cannot be maintained exactly, although
/// the text system tries to maintain the inset wherever possible
public var contentInsets: NSEdgeInsets = .init() {
didSet {
needsLayout = true
}
}

/// A Boolean value that indicates whether the receiver allows undo.
///
/// `true` if the receiver allows undo, otherwise `false`. Default `true`.
Expand Down Expand Up @@ -668,10 +656,10 @@ open class STTextView: NSView, NSTextInput {
let clipView = scrollView.contentView
clipView.automaticallyAdjustsContentInsets = false
clipView.contentInsets = NSEdgeInsets(
top: contentInsets.top,
left: contentInsets.left,
bottom: contentInsets.bottom,
right: contentInsets.right
top: 0,
left: 0,
bottom: 0,
right: 0
)

if scrollView.hasVerticalRuler, let verticalRulerView = scrollView.verticalRulerView {
Expand Down

0 comments on commit 20370a4

Please sign in to comment.