r3bl-open-core
r3bl-open-core copied to clipboard
Support termion and make it the default on linux + macos
Goals:
- Add support for termion (in addition to crossterm).
- Make
TWCommand
&Keypress
compatible w/ both. - Only use crossterm if windows is detected, otherwise use termion
Note - termion is created by popos swes who work for system76
WIP
- Here's my fork of termion w/ added examples: https://github.com/nazmulidris/termion
- this commit 2abb8317874ec4063d437c8f6c70ae1fdcc7b4bf gets main_event_loop ready to handle blocking reads from termion (if that is implemented)
Current codebase:
- Currently only crossterm is supported and insulated so that no deps to it are exposed by
r3bl_rs_utils
.
Compatibility notes:
- From what I understand so far, termion shortcuts are limited to Alt + char and Ctrl + char combos. Need to verify this. If true that means that we have to be careful about creating shortcuts that won't be recognizable by termion (but might be by crossterm).
- Color seems to be the same between them, and so does alternate screen, and raw mode, so that should be seamless.
Starting points for adding support:
- https://github.com/r3bl-org/r3bl_rs_utils/blob/main/src/tui/crossterm_helpers/tw_command.rs#L287
- https://github.com/r3bl-org/r3bl_rs_utils/blob/main/src/tui/crossterm_helpers/keypress.rs#L1
More info on termion:
- https://docs.rs/termion/1.5.6/termion/cursor/index.html
- https://github.com/redox-os/termion
Modules that are affected (for crossterm & termion support):
- [ ] impl DebugFormatRenderOp
- [ ] impl PaintRenderOp
- [ ] async input / event stream / reader
- [ ] keypress conversions from "whatever key event for the underlying lib"
- [ ] color conversions from TWColor to underlying lib