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

scrollbar for terminal window #111

Open
nektro opened this issue Mar 17, 2023 · 18 comments
Open

scrollbar for terminal window #111

nektro opened this issue Mar 17, 2023 · 18 comments
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK)

Comments

@nektro
Copy link
Collaborator

nektro commented Mar 17, 2023

helps to quickly get to the top when the output buffer is really long

@mitchellh
Copy link
Contributor

mitchellh commented Mar 18, 2023

Going to mark this as a GTK enhancement because I don't think we're going to support GUI elements like scrollbars in systems such as GLFW, otherwise we'd have to render it ourself and I'm not super interested in doing that. 😄

https://docs.gtk.org/gtk4/class.Scrollbar.html

@mitchellh mitchellh changed the title linux: no scrollbar gtk: scrollbar for terminal window Mar 18, 2023
@haze haze added os/macos and removed os/macos labels Nov 6, 2023
@mitchellh mitchellh added os/linux gui GUI or app issue regardless of platform (i.e. Swift, GTK) and removed enhancement labels Oct 2, 2024
@mitchellh
Copy link
Contributor

My last comment is so old we didn't have an AppKit apprt so I'm going to remove the linux specificity on this.

@mitchellh mitchellh changed the title gtk: scrollbar for terminal window scrollbar for terminal window Oct 29, 2024
@mitchellh
Copy link
Contributor

From #2524:

AppKit apps get all this for free when using an NSScrollView. I'm guessing since Ghostty renders using metal, using an NSScrollView isn't super convenient. But the suggestion from here is maybe workable: https://forums.developer.apple.com/forums/thread/651229

That is, have a dummy NSView as the NSScrollView's documentView and sync its size using a technique similar to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html

This looks like something to try.

Note that core changes are necessary to enable this too since our Screen and PageList structure at the time of writing this have no way to know min/max/position.

@TheWeirdDev
Copy link

Kitty draws a non-interactive scrollbar in the recent versions. I think it's pretty useful even though you can't click it, you still know where you are.

@qwelias

This comment has been minimized.

@nico
Copy link
Contributor

nico commented Jan 2, 2025

From #2524:

AppKit apps get all this for free when using an NSScrollView. I'm guessing since Ghostty renders using metal, using an NSScrollView isn't super convenient. But the suggestion from here is maybe workable: https://forums.developer.apple.com/forums/thread/651229
That is, have a dummy NSView as the NSScrollView's documentView and sync its size using a technique similar to https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html

This looks like something to try.

Note that core changes are necessary to enable this too since our Screen and PageList structure at the time of writing this have no way to know min/max/position.

In case it's useful to anyone, here's a hacky proof-of-concept of a SwiftUI app hosting an NSScrollView that then itself hosts another SwiftUI view that has a metal view and another SwiftUI view as child. The NSScrollView's document view (the thing that's scrolled around) is a dummy 20k x 10k view (larger than the max metal size), but the metal view is only as large as the scroll view's visible area. The metal view is a child of the document view, and its position on the document view is updated to keep it always visible.

This seems to work.

(The other somewhat common approach is to instead give the NSScrollView a custom NSClipView subclass and handle drawing that way. https://github.com/Tinrocket-LLC/TRMetalImageView does this, but it looks a bit more involved.)

MetalSwiftUI.zip

@neitsab

This comment has been minimized.

@marklap
Copy link

marklap commented Jan 9, 2025

Non-interactive scrollback visual indicator sounds great; interactive scrollbar sounds good too. Personally, I think an interactive scrollback minimap (like extraterm, vscode, sublimetext) would be killer.

@zhedgehog

This comment has been minimized.

@merll002

This comment has been minimized.

@r32pat

This comment has been minimized.

@albin-diagnal

This comment has been minimized.

@afarooq-dev

This comment has been minimized.

@taot

This comment has been minimized.

@pluiedev
Copy link
Contributor

pluiedev commented Feb 9, 2025

Please don't add any more comments to the effect of "+1" or "I want this". Instead, indicate your desire by reacting 👍🏼 to the issue itself, or even this comment. However, feel free to add any concrete suggestions or prior art as to how to design this feature.

People (especially busy volunteer developers) are notified every time someone adds a new comment, and it's not helpful when comments like these add no value and don't contribute directly to the feature's design and inclusion. If need be, this issue may be locked to contributors only.

@lwbt

This comment has been minimized.

@prostori

This comment has been minimized.

@pluiedev
Copy link
Contributor

Looks like my warning was not heeded. Locking to collaborators.

@ghostty-org ghostty-org locked and limited conversation to collaborators Feb 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
gui GUI or app issue regardless of platform (i.e. Swift, GTK)
Projects
None yet
Development

No branches or pull requests