This solves #85 in a similar fashion as the color amount detection: the
cursor module now provides a trait that adds a `cursor_pos()` method to
an instance of `Write`. It also corrects that previous implementation
somewhat by making the `CONTROL_SEQUENCE_TIMEOUT` a member of the raw
module and implementing `DetectColors` for any instance of `Write`
rather than just `RawTerminal` (`MouseTerminal` for instance works as
well).
* Add (optional) support for alternate screen (#77)
The user can manually switch between main and alternate screen or
(preferably) use the wrapper struct for automatic screen restoration.
* Add two examples for screen switching
* Improve screen module documentation
* Added color support detection
Color support is inferred by using either OSC 4 escape codes or the
value of TERM.
* minor refactor and cosmetic changes
`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
* Add `UnknownCSI` event type.
* Compile test from `raw` module
But don't run it.
* Fix unused import warning in doc-test
* Rename UnknownCSI -> UnknownCsi
* 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