Commit Graph

54 Commits

Author SHA1 Message Date
Jeremy Soller 0082c8da04 Merge branch 'rawterminal-alternatescreen-errors' into 'master'
Improve error handling in the `raw` and `screen` modules

See merge request redox-os/termion!178
2022-10-21 07:09:08 +00:00
Lassi Pulkkinen 5d08b65b57
Improve error handling in the `raw` and `screen` modules
- Ignore errors in `Drop` implementations.
- Replace `AlternateScreen::from` with an `IntoAlternateScreen` trait
  which doesn't panic on errors, to make the API more consistent with
  the `raw` module.
2021-06-09 00:28:24 +03:00
Peter Roehlen e0263cbc81 Fix "red" color in example simple.rs 2020-07-18 02:47:46 +00:00
Alex Yankov 6c6b240961 Reset style in color example before exit (#138) 2018-05-08 20:44:29 -07:00
ticki 15c65dc5f9
Run rustfmt on the code. 2017-03-24 21:53:05 +01:00
IGI-111 0758c07ab7 added cursor position detection
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).
2017-03-12 20:18:32 +00:00
ftilde 95233e9e5c Add support for alternate screen (#88)
* 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
2017-02-27 13:42:55 +01:00
IGI-111 ba72d0bcec Added color support detection (#91)
* 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
2017-02-26 09:35:39 +01:00
Alexandre Bury c9c91292e5 Replace most `std::io::Write::write` with `write_all` (#82)
`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.
2016-12-21 14:20:48 +01:00
Alexandre Bury 0395780f25 Add travis integration (#81)
* Add travis integration

* Update examples/rainbow to work on stable
2016-12-19 16:45:11 +01:00
ticki a3ad019010 Yes.
No.
2016-11-02 18:47:24 +01:00
ticki 936c4336ce Merge branch 'master' of github.com:Ticki/libterm 2016-10-26 11:56:00 +02:00
ticki 8ccc67cf33 Update the mouse example.
We use click and drag.
2016-10-26 11:55:47 +02:00
Matthew Nicholson ea06c6fd56 Modify Keys and Events to detect Esc key presses (#45)
* 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.

Fixes ticki/termion#43

* expand keys example to include Esc key presses

* add test for Esc key press
2016-10-26 11:53:36 +02:00
j-browne 0b24a3446d Change is_tty example to conform to new signature (#52)
Commit 0d1025c532 changed the signature of
is_tty, but the example was not updated.
2016-10-07 07:43:10 +02:00
ticki e63b645859 Update the documentation. 2016-09-07 11:39:32 +02:00
IGI-111 5ebda9866f added mouse hold support (#48)
This adds support for the escape codes generated in rxvt and xterm
format by holding a button and moving the mouse around.
2016-09-07 11:05:41 +02:00
James Campos a84670a51a Update keys.rs
fix message not appearing
2016-07-25 04:41:19 -07:00
ticki 9bd833a663 Fix the tests 2016-07-23 20:41:43 +02:00
ticki 59d4ae427a Fix mouse input 2016-07-23 19:03:03 +02:00
ticki 30afb4c32e Fix examples & merge 2016-07-23 18:50:33 +02:00
ticki 5b94db9663 Merge 2016-07-23 17:49:52 +02:00
ticki b17d0151d9 Update readme, fix rainbow example 2016-07-23 17:32:08 +02:00
ticki e36ff1c71b Termion 1.0.0: Complete overhaul of how escape codes are handled, add truecolor support.
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.
2016-07-23 16:40:27 +02:00
IGI-111 206c61de9e made mouse optional and fixed small issues 2016-07-20 01:13:03 +02:00
IGI-111 cc9c32b981 added mouse input
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.
2016-07-19 18:17:12 +02:00
ticki 7284a25d8f Add more examples 2016-07-02 15:07:20 +02:00
ticki b499d4825f Refactor how colors are handled 2016-07-02 15:06:47 +02:00
ticki 11225e561d Fix #24, make use of Result instead 2016-06-14 14:24:07 +02:00
ticki 119cbda718 Switch from usize to u16 in terminal_size 2016-05-03 19:42:37 +02:00
Ticki 451cb95ee2 Add colors example 2016-04-08 11:00:02 +02:00
Ticki b288548756 Fix #18 2016-04-02 18:05:31 +02:00
Greg Chapple d6161f9e24 Fixed keys example 2016-03-16 12:02:29 +00:00
Ticki 28a95cf447 Libterm is now termion 2016-03-15 21:36:33 +01:00
Ticki b65328c304 Asynchronous key events 2016-03-15 20:32:25 +01:00
Ticki df65cc7c56 Nightly message 2016-03-13 11:59:55 +01:00
Ticki 32d8ccfa24 Use IO error, instead of a custom one 2016-03-13 11:55:24 +01:00
Ticki d8e5ea3262 CTRL modified input 2016-03-10 15:12:59 +01:00
Ticki 5d4826d4ff Add test to _everything_ 2016-03-09 17:18:31 +01:00
Ticki 0efce912d0 Minor cosmetic changes 2016-03-09 11:38:43 +01:00
Ticki 6f1621d2d0 Introduce 'Key', which can decode special key input 2016-03-09 09:39:22 +01:00
Ticki d7a3e607ba Fix read example 2016-03-09 08:41:18 +01:00
Ticki abe4681158 Fix examples 2016-03-08 21:40:48 +01:00
Ticki a16cc84ea3 Rename WriteExt to TermWrite 2016-03-08 21:39:24 +01:00
Ticki 45aa8912f9 Rename Mode to Style
Mode is somewhat ambiguous term, which is often overused, for that reason I want to avoid it. This is a breaking change, but I don't guarantee stability yet, however I'll do my best to not break things.
2016-03-08 18:38:07 +01:00
Ticki 54ce18f17d Better documentation, fix TIOCGWINSZ 2016-03-08 10:08:50 +01:00
Ticki 10f6654005 Better password input 2016-03-08 08:51:34 +01:00
Ticki a19d2e245d Make debug_check private, remove warnings from examples 2016-03-08 08:27:59 +01:00
Ticki fd2d74d41a Now supports Redox! 2016-03-07 22:19:35 +01:00
Ticki 45b1136f75 get_passwd(), new example, update README 2016-03-07 18:42:11 +01:00