Skip to content

Commit

Permalink
Merge pull request #362 from krzyzanowskim/marcin/setup-scroller-size
Browse files Browse the repository at this point in the history
re-setup scroller on size change
  • Loading branch information
migueldeicaza authored Jan 20, 2025
2 parents b589a97 + 3556f50 commit 1e76c8b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/SwiftTerm/Mac/MacTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,10 @@ open class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations,

func setupScroller()
{
if scroller != nil {
scroller.removeFromSuperview()
}

let style: NSScroller.Style = .legacy
let scrollerWidth = NSScroller.scrollerWidth(for: .regular, scrollerStyle: style)
scroller = NSScroller(frame: NSRect(x: bounds.maxX - scrollerWidth, y: 0, width: scrollerWidth, height: bounds.height))
Expand Down Expand Up @@ -430,7 +434,12 @@ open class TerminalView: NSView, NSTextInputClient, NSUserInterfaceValidations,
updateCursorPosition()
}
}


open override func setFrameSize(_ newSize: NSSize) {
super.setFrameSize(newSize)
setupScroller()
}

public override func resizeSubviews(withOldSize oldSize: NSSize) {
super.resizeSubviews(withOldSize: oldSize)
updateScroller()
Expand Down

0 comments on commit 1e76c8b

Please sign in to comment.