Skip to content

Commit

Permalink
TextLayoutManager: Reduce viewport top inset
Browse files Browse the repository at this point in the history
The STTextView's viewport inset is reduced from half the visible height to a
quarter of the visible height. This improves performance by preparing a
smaller area of content ahead of the currently visible region.
  • Loading branch information
krzyzanowskim committed Jan 2, 2025
1 parent 5c0e0fe commit 5dac8e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/STTextViewAppKit/STTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ import AVFoundation
}

open override func prepareContent(in rect: NSRect) {
var insetRect = rect.inset(dy: -visibleRect.height / 2)
var insetRect = rect.inset(dy: -visibleRect.height / 4)
insetRect.origin = CGPoint(x: max(0, insetRect.origin.x), y: max(insetRect.origin.y, 0))
super.prepareContent(in: insetRect)
layoutViewport()
Expand Down

0 comments on commit 5dac8e4

Please sign in to comment.