https://asciinema.org/docs/how-it-works
A pseudo terminal is a pair of pseudo-devices, one of which, the slave, emulates a real text terminal device, the other of which, the master, provides the means by which a terminal emulator process controls the slave.
The role of the terminal emulator process is to interact with the user; to feed text input to the master pseudo-device for use by the shell (which is connected to the slave pseudo-device) and to read text output from the master pseudo-device and show it to the user.
We need to:
- spin up a pty
- launch Nu and hook it up to the pty
- handle output from Nu and input from the keyboard
Useful reading: https://poor.dev/blog/terminal-anatomy/
- Centralize the "add an Action to the Vec of all records and send the new action to any listeners (debounced)" logic
- Make newlines take up less vertical space. Solution: Add a new InvisibleLineBreak dto that we send before+after CR+LF
- Show colours in tooltip (border?) instead of just "PaletteIndex(2)" or whatever
- use a nerd font
- handle failure to get a socket with a nicer error message
- print stack trace automatically
- show raw bytes for line breaks
- embed all js libs so it works offline
- add an option to log to a file
- coalesce multiple chars into a single string event, cut down on data transfer and work for the front-end
- add a favicon
- use open-rs to launch to page in a browser
- add help page
- use rust-embed to serve files https://github.com/pyrossh/rust-embed
- show raw bytes for other
- display raw bytes better. replace control codes
- hide tooltip description when not exists
- use floating-ui for a custom tooltip
- display raw bytes in tooltip
- wrap items, don't overflow horizontally
- Use clap or argh or similar
- Debounce/chunk streaming events to cut down on #renders
- send a "disconnected" message to web browser when exiting
- Move more logic to Rust. Send to-be-displayed info as a new type
- Start using VTE to parse output stream: https://github.com/alacritty/vte
- Spin up web UI (Axum?)
- Start logging all events
- Send tokens to web UI
- Why doesn't it render prompt?
- Maybe because the cursor is on the prompt line. Do I need to disable cursor?
- Was because I was forgetting to flush stdin
- Figure out why update is so infrequent (and only prompted by several keypresses)
- Reset raw mode etc. when child Nu exits
- Can/should I detect ctrl+D/SIGQUIT? Or when the child dies more generally?
- if we get an EOF from nu stdout...