crossterm support
For #282, fixes #283.
Todo
- [x] Fix failure to launch on 'up' keybinding
- [x] Fix up/down keys in the TUI (ctrl-n/p work fine)
A curiosity, I've decided to try partial upgrade (tui 0.18 + termion) and it's still eating my arrow key inputs, but otherwise still responsive. So I'm not sure what's going on there
So I'm not sure what's going on there
Do you know what mode your terminal is in? Different modes can send different escape sequences, and it could be listening for the wrong ones
EG we switch to cursor mode here: https://github.com/ellie/atuin/blob/main/src/shell/atuin.zsh#L34
and perhaps termion doesn't like that
Do you know what mode your terminal is in? Different modes can send different escape sequences, and it could be listening for the wrong ones
Yeah, I was debugging and termion/crossterm never get the up/down. Which made me try again with our current version.
When running atuin search -i manually, it exhibits this behaviour.
When running from the keybinding, it is fine 🚀
When running from the keybinding, it is fine 🚀
Yup I had this when I was writing the initial implementation. Some applications can switch terminal mode and then don't switch it back, leaving other programs in a broken state
Terminal stuff has a lot of baggage 😂
But otherwise it all works? search -i is only really supposed to run from the binding anyway 🤔
I'm rebasing this branch now, I'll let you know
https://github.com/crossterm-rs/crossterm/issues/396 :/
Ok, final conclusion since I've spent a while debugging this now. It's a combination of quite a few problems:
- On ZSH, in our hook, stdin is not a tty. This is different to bash and fish
- On macos, kqueue can't poll from /dev/tty
- crossterm uses mio to poll from the tty, which uses kqueue on macos.
mio said they won't fix this specific behaviour, tbh I agree: https://github.com/tokio-rs/mio/issues/1377
There's an open PR for crossterm to manually use select() for /dev/tty: https://github.com/crossterm-rs/crossterm/pull/711
So far, this patch fixed it for me
@conradludgate looks like there's been some motion on that crossterm PR, and now this has been opened
https://github.com/crossterm-rs/crossterm/pull/735
Yep. I've been following it. Hopefully it gets merged at some point
Just waiting for a new crossterm release after the merge ⏳
Crossterm 0.26 is out 🎉 https://github.com/crossterm-rs/crossterm/releases/tag/0.26
I have updated to 0.26 crossterm and started vendoring a minimal subset of tui (now that it's maintenance is in question). It can be trimmed down further, but I don't want to go too minimal incase there are features we end up using.