crossterm-rs / crossterm

Cross platform terminal library rust
MIT License
3.29k stars 280 forks source link

Support for sending ansi special characters to terminal #853

Open JPaja opened 10 months ago

JPaja commented 10 months ago

Is your feature request related to a problem? Please describe.

There is no support for sending some special keys in raw mode like Home, End, PgUp, PgDn, F{n}, and similar via execute macro.

Describe the solution you'd like Nice solution would be to impl Command on KeyCode, where it would map special chars to its ansi code,

Additionally it could be useful to implement Command on KeyEvent since there is support for modifier in ansi format: <esc> '[' (<keycode>) (';'<modifier>) '~'

Also this approach makes it easy to just pass event to keyboard if you do not want to block it.

Additional context Some documentation i found: https://en.wikipedia.org/wiki/ANSI_escape_code#Terminal_input_sequences https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#keyboard-strings