Skip to content

Commit 48bdfee

Browse files
committed
Support scrolling with page up and page down.
1 parent 519f9bd commit 48bdfee

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Sources/Runestone/TextView/Core/Mac/TextView_Mac.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,14 @@ public extension TextView {
749749
override func selectAll(_ sender: Any?) {
750750
textViewController.selectedRange = NSRange(location: 0, length: textViewController.stringView.string.length)
751751
}
752+
753+
override func scrollPageUp(_ sender: Any?) {
754+
scrollContentView.scroll(scrollContentView.visibleRect.applying(.init(translationX: 0, y: -visibleRect.height)).origin)
755+
}
756+
757+
override func scrollPageDown(_ sender: Any?) {
758+
scrollContentView.scroll(scrollContentView.visibleRect.applying(.init(translationX: 0, y: visibleRect.height)).origin)
759+
}
752760
}
753761

754762
// MARK: - Window

0 commit comments

Comments
 (0)