Commit Graph

167 Commits

Author SHA1 Message Date
zethra c471ab6811 Added AsRawFd impl for RawTerminal 2020-06-26 03:31:48 -04:00
Jeremy Soller a448f510f0
1.5.5 - fix warnings 2020-01-20 11:12:03 -07:00
Jeremy Soller 6cb4e3fb75 Merge branch 'cursor-style' into 'master'
feature: changing cursor style

See merge request redox-os/termion!164
2020-01-20 18:04:14 +00:00
Jeremy Soller 24e51d01dd Merge branch 'remove-warnings' into 'master'
fix warnings

See merge request redox-os/termion!165
2020-01-20 18:03:53 +00:00
lilydjwg 67fe54119b Avoid allocating temporary Strings in Display implementations 2020-01-18 13:49:20 +08:00
akitsu-sanae a1c43eec08 fix warnings 2019-07-21 01:08:09 +09:00
akitsu-sanae cb16464375 feature: changing cursor style 2019-07-19 05:25:25 +09:00
Jeremy Soller c27678efc2 Merge branch 'bubble-read-errors' into 'master'
Make the keys return their inner error, if any.

See merge request redox-os/termion!162
2019-07-09 01:56:22 +00:00
rabite0 574f863676 Add terminal_size_pixels() to expose terminal's pixel size 2019-07-06 18:08:57 +00:00
Xavier L'Heureux e81a1c4cfc Make the keys return their inner error, if any. For example, when permission to access the TTY is denied, don't loop infinitely and instead return to the outer scope to error and exit (or not) there. 2019-06-26 18:48:53 +00:00
Jeremy Soller 68d765305c Merge branch 'backtab' into 'master'
Backtab key

See merge request redox-os/termion!157
2019-06-12 23:12:12 +00:00
Michael Bradshaw 1c936ca06c Use stdout to get and set terminal attributes 2019-06-12 22:59:41 +00:00
Jeremy Soller a69af17888
Support redox target os with unix target family 2019-04-21 16:57:34 -06:00
Ophir LOJKINE d3a7878fb4 Make Color extend Debug 2019-03-11 13:58:35 +01:00
scauligi 7f81389fc8 backtab key 2019-02-19 23:58:19 -08:00
Matthias Devlamynck 5301d8621a Merge remote-tracking branch 'origin/master' 2019-01-28 19:55:09 +01:00
Michael Neumann 0837ad5ab1 Fix TIOCGWINSZ type mismatch on DragonFly
Below is the error message I got before this patch:

    error[E0308]: mismatched types
      --> src/sys/unix/size.rs:17:34
       |
    17 |         cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut size as *mut _))?;
       |                                  ^^^^^^^^^^ expected u64, found u32
    help: you can cast an `u32` to `u64`, which will zero-extend the source value
       |
    17 |         cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size as *mut _))?;
       |                                  ^^^^^^^^^^^^^^^^^
2018-12-29 13:30:22 +01:00
Nathan Lilienthal b64b10f40b Add ability to suspend/activate raw mode on RawTerminal 2018-10-12 01:40:18 -04:00
Michael Aaron Murphy acd94a3625 Extra derives & performance optimizations 2018-08-20 22:11:58 +00:00
Josh Mcguigan a29929ee34 Corrected all remaining build warnings 2018-05-08 17:34:43 -07:00
Daniel Mueller b9881e122a Remove unused import of std::ascii::AsciiExt (#142)
The import of std::ascii::AsciiExt in src/event.rs is unused. Remove it.

> warning: unused import: `std::ascii::AsciiExt`
>  --> src/event.rs:4:5
>   |
> 4 | use std::ascii::AsciiExt;
>   |     ^^^^^^^^^^^^^^^^^^^^
>   |
>   = note: #[warn(unused_imports)] on by default
2018-05-08 17:31:47 -07:00
Daniel Mueller 047cbc0cab Remove unused 'mut' qualifier in src/input.rs (#143)
This change removes an unused 'mut' qualifier of the 'source' variable
in src/input.rs.

> warning: variable does not need to be mutable
>   --> src/input.rs:52:13
>    |
> 52 |         let mut source = &mut self.source;
>    |             ----^^^^^^
>    |             |
>    |             help: remove this `mut`
>    |
>    = note: #[warn(unused_mut)] on by default
2018-05-08 17:30:31 -07:00
Josh Mcguigan 3cb1bd4b57
Merge pull request #145 from JoshMcguigan/master
Fix detect cursor position reading extra byte
2018-05-08 04:40:57 -07:00
Josh Mcguigan 17fdd50823 Added async_stdin_until function to be used in cursor_pos 2018-05-07 17:13:55 -07:00
Robert Metcalf 7d97b6424f Update references to repository 2018-05-07 01:41:46 +01:00
Niv Kaminer 00f87e5ed8 use `TIOCGWINSZ` directly from `libc` 2017-10-11 13:06:09 +03:00
Jeremy Soller 18e589b9d9 Add cursor position save/restore 2017-08-02 20:07:37 -06:00
Jeremy Soller cd455e8358 Move system specific features into sys module 2017-07-31 21:17:47 -06:00
Jeremy Soller da9a604c40 Update tty.rs 2017-07-27 07:00:48 -06:00
Jeremy Soller 5fdabb4320 Implement size and is_tty with termios on Redox 2017-07-23 11:38:47 -06:00
ftilde 2f97c69a5c Add EventsAndRaw iter and implement it for Read
- 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.
2017-07-13 01:30:44 +02:00
Matthias Devlamynck c26d2f0a97 Implement hide cursor wrapper type 2017-07-11 10:29:28 +02:00
Jeremy Soller 75b28bab55 Fix raw mode on Redox 2017-06-08 18:47:12 -06:00
IGI-111 bd9e4eb8e1 fix #99
Add support for F1-F5 in the linux tty.
2017-03-28 10:06:04 +02:00
ticki 15c65dc5f9
Run rustfmt on the code. 2017-03-24 21:53:05 +01:00
ticki 7351aa3f16 Merge pull request #93 from IGI-111/cursor_pos
added cursor position detection
2017-03-24 21:50:57 +01:00
IGI-111 fa2e86a558 fix for #94 (#95)
parse_utf8_char() makes the assumption that at least four bytes or one UTF-8 glyph are still to read in the input.
2017-03-24 21:50:09 +01:00
IGI-111 5e336e10a1 add support for xterm mouse release code (#97)
Codes of the form `ESC [ < 3 ; Cx ; Cy` were not supported before.
2017-03-24 21:48:55 +01:00
Greg 11a0ee178a Fix terminal size ioctl number on *BSD (#98)
At least on FreeBSD and OpenBSD, TIOCGWINSZ == 0x40087468 just like on
macOS, so change the definition from not-macOS/macOS to Linux/non-Linux.
2017-03-24 21:48:36 +01:00
IGI-111 8760faca15 no need for templating 2017-03-13 11:49:24 +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
Loïc Damien 23ef0260dd Fix 64 bit build for musl and android (#90) 2017-02-25 20:17:54 +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 32ff8ba96e Replace UnknownCsi with generalized Event::Unsupported (#80) 2016-12-19 16:40:44 +01:00
ticki f9eaf6d0bc Merge branch 'master' of github.com:Ticki/libterm 2016-12-18 19:29:18 +01:00
ticki 7047acbabf Add `Color` implementation for `&Color`
Fix #53
2016-12-18 19:28:25 +01:00
Alexandre Bury c2df3d7edd Discard leftover input when consumed (#76)
* 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
2016-12-18 00:49:40 +01:00
Alexandre Bury 00ca758d45 Add `UnknownCSI` event type (#73)
* Add `UnknownCSI` event type.

* Compile test from `raw` module

But don't run it.

* Fix unused import warning in doc-test

* Rename UnknownCSI -> UnknownCsi
2016-12-16 18:20:17 +01:00