Skip to content

Commit

Permalink
Scroll to last selection
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyzanowskim committed Jan 28, 2023
1 parent 4501e0f commit 6f1aa4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/STTextView/STTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ open class STTextView: NSView, NSTextInput {

if needScrollToSelection {
needScrollToSelection = false
if let textSelection = textLayoutManager.textSelections.first {
if let textSelection = textLayoutManager.textSelections.last {
scrollToSelection(textSelection)
textLayoutManager.textViewportLayoutController.layoutViewport()
}
Expand All @@ -712,7 +712,7 @@ open class STTextView: NSView, NSTextInput {
}

internal func scrollToSelection(_ selection: NSTextSelection) {
guard let selectionTextRange = selection.textRanges.first else {
guard let selectionTextRange = selection.textRanges.last else {
return
}

Expand Down

0 comments on commit 6f1aa4a

Please sign in to comment.