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

When a TerminalView is embedded in an NSSplitView (macOS), the caretView position is not updated when the split view divider is dragged #244

Closed
mixio opened this issue Jul 1, 2022 · 2 comments

Comments

@mixio
Copy link

mixio commented Jul 1, 2022

When a TerminalView is embedded in an NSSplitView (macOS), the caretView position is not updated when the split view divider is dragged.

One solution seems to be to add a notification observer to the TerminalView.setup() method:

// SwiftTerm/Sources/SwiftTerm/Mac/MacTerminalView.swift
private func setup()
{
    wantsLayer = true
    isBigSur = ProcessInfo.processInfo.isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 11, minorVersion: 0, patchVersion: 0))
    if isBigSur {
        disableFullRedrawOnAnyChanges = true
    }
    setupScroller()
    setupOptions()
/*+++*/   // Added to update caretView's position on split view's divider drags.
/*+++*/   NotificationCenter.default.addObserver(forName: NSView.frameDidChangeNotification, object: self, queue: .main) { [weak self] _ in
/*+++*/       self?.updateDisplay()
/*+++*/   }
}
@migueldeicaza
Copy link
Owner

Thanks for the bug report - it should be fixed now, please let me know if this works for you.

@mixio
Copy link
Author

mixio commented Jul 9, 2022

Thanks Miguel, works as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants