Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-setup scroller on size change #362

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading