- In addition to Events it preserves the byte sequence that created an event. This
is useful, e.g., for implementing a terminal multiplexer where the raw input
should in some cases be passed on to another tty.
- In order to ensure backwards compatibility, the function that creates the trait
is implemented in a separate extension trait.
`std::io::Write` doesn't guarantees that it will write everything,
and could even return a non-fatal `ErrorKind::Interrupted` error.
`write_all` has exactly the code required to deal with this.
* Discard leftover input when consumed
The iterator given to `parse_event` now `take()` the value from
`leftover`.
* Always save leftover
`parse_event` will consume it when required.
* Remove OptionIterator, directly uses std::option::Iter
* modify Keys and Events to detect Esc key presses
The strategy used here is to read two bytes at a time, going on the
assumption that escape sequences will consist of multi byte reads and
solitary Esc key presses will consist of single byte reads.
Tests had to be modified to account for these new multi byte reads by
including dummy bytes when a single byte was previously expected.
Fixesticki/termion#43
* expand keys example to include Esc key presses
* add test for Esc key press
This commit is a major semver bump. Every progra utilizing escape codes generated by Termion is likely broken. The main change is to make each escape has their own type implementing the Display trait.
- Use formatters, mainly Display for escapes.
- Add Truecolor support (`color::Rgb`).
- Put each primitive into distinct modules.
- Add is_tty for checking if some stream is a TTY.
- Add multiple new examples.
The event system has been reworked to allow the detection of mouse
events as well as key presses.
Xterm, rxvt and X10 emulated escape codes are supported, they are
enabled and disabled by sending the right escape codes when creating a
RawTerminal.
To allow for byte manipulation, which was necessary to implement those
features, the backend iterator has been changed from chars() to bytes()
(with specific treatment of unicode sequences), making the whole crate
not require nightly rustc.
Key now supports Home, End, PageUp, PageDown, Delete, Insert and
Function keys. All this is done through the detection of both VT100
escape codes and more modern standard counterparts.
For instance, F2 can be both
ESC OQ
on VT100, screen, and some versions of xterm and
ESC [12~
on rxvt and other xterm versions depending on your terminal