-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add primitive TUI mode #185
Conversation
// TODO(evan): Follow output when scrolled to bottom | ||
scroll_offset: usize, |
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.
When the user is scrolled to the bottom of the scrollback (the default if they haven't scrolled at all), new output should push old output up and off the screen. Like a "follow logs" option in a CI service.
crossterm::execute!( | ||
stdout, | ||
terminal::EnterAlternateScreen, | ||
cursor::Hide, | ||
event::EnableMouseCapture, | ||
event::EnableFocusChange, | ||
event::EnableBracketedPaste, | ||
event::PushKeyboardEnhancementFlags( | ||
KEF::DISAMBIGUATE_ESCAPE_CODES | ||
| KEF::REPORT_EVENT_TYPES | ||
| KEF::REPORT_ALL_KEYS_AS_ESCAPE_CODES | ||
), | ||
) |
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.
I could remove some of these, like focus change and bracketed paste events - but they don't make a big difference.
The spammy one that does make a dent is mouse events: did you know TUI apps can track mouse movement generally, like hover? So just moving the mouse over a TUI sends dozens of events. But we need mouse events for scrolling.
Ugh, no, the performance is abysmal because of the stupid |
[Stolen from my Indigo text editor project][1], with some tweaks: - Avoid aborting - Don't remove panic hook on exit, just disable it, to avoid messing up other panic hooks (like `miette`'s) - Follow one-import-per-line style used elsewhere in `ghciwatch` [1]: https://github.com/evanrelf/indigo/blob/c6074a42f467bf7ffa621e0400f1a54af4507919/indigo-tui/src/terminal.rs
A couple minor changes to #185 before we merge it.
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.
Shows the same GHCi output and logging as the current print-to-
stdout
behavior, but renders it as a TUI. This mode is off by default, enabled by passing an undocumented--tui
flag.