-
Notifications
You must be signed in to change notification settings - Fork 3
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
Addition of support for the Kitty keyboard protocol. #5
Conversation
modified crossterm event handler to pass along all EventKind variants. added example showing how to enable the kitty protocol and listen for "release" events.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 4 4
Lines 116 129 +13
=====================================
- Misses 116 129 +13 ☔ View full report in Codecov by Sentry. |
In theory that's handled by Terminal::drop - https://github.com/ratatui-org/ratatui/blob/main/src/terminal/terminal.rs#L91-L95, but I suppose that it likely suffers the same problems that happen when panics happen (maybe - I don't 100% recall if drop gets skipped). There was some discussion on a bevy issue about adding a shutdown / teardown system similar to the way the startup systems run, but it petered out due to lack of interest. I was thinking that this might be a good reason to go back to that idea.
I had a vague thought that perhaps it's worth splitting bevy_ratatui and bevy_crossterm perhaps, but for now it's useful to think of them as paired (and there's an existing https://crates.io/crates/bevy_crossterm that seems to be abandoned - it uses a custom runner approach rather than just using the existing systems / schedules like I have). For now, I'm fine with keeping this sort of thing in the lib, then we can work out where it goes when evolving. (get it working, get it right, get it performing)
Yup - I want that - you're thinking the same thing as me there.
I'll think about this as I look through the code. I ran into a similar problem with mouse capture implementing the crossterm / mouse events earlier today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for fixing that up! |
Changes
enable_kitty_protocol
method that usescrossterm
helper methods to enable the Kitty keyboard protocol.cursor::Show
during cleanup, necessary in some terminals.Justification
One could argue that kitty protocol support is somewhat orthogonal to what an integration between bevy and ratatui should be responsible for, but I think there are two good arguments for inclusion:
Alternative
Alternatively, for an even more seamless setup we could just push the flags as part of the context initialization and store whether the protocol was enabled as part of the
RatatuiContext
struct. Opinion here?Testing
Tested with Alacritty, Kitty, iTerm, and WezTerm on macOS.