162 Commits

Author SHA1 Message Date
Michael Davis
982bd1fb5c Set development version at v0.1.0-beta.1 2025-03-28 20:03:50 -04:00
Michael Davis
aa4cf2c5ea Drop document-features dependency 2025-03-28 19:42:49 -04:00
Michael Davis
cc99f02635 Remove derive-more from default features 2025-03-28 09:58:14 -04:00
Michael Davis
98c3336fca Merge remote-tracking branch 'crossterm-rs/master' 2025-03-28 09:57:24 -04:00
Michael Davis
12f36ec316 Add a feature flag for derive_more impls (#970)
This adds a feature flag to allow opting out of the `derive_more`
dependency and derivations added in e063091. `derive_more` brings in
heavy proc macro dependencies and isn't crucial for the core functioning
of crossterm, so it should be possible for a crossterm dependent to opt
out of bringing in the transitive dependency.
2025-02-16 19:20:28 +01:00
Michael Davis
ece990371e Rename crate in Cargo metadata 2025-02-14 16:05:49 -05:00
Josh McKinney
e063091312 Add is_* and as_* methods to the event enums (#949)
* Add is_ and as_ methods to the event enums

Often application code only cares about a small subset of possible
events. These methods make it simpler to write code which checks whether
an event is a particular event type or converts events into the specific
type (returning an Option).

This can help simplify some nested match blocks. E.g.:

```rust
match event {
    Event::Key(key) if key.kind == KeyEventKind::Press => { ... }
}
```

becomes:

```rust
if let Some(key) = event.as_key_press() { ... }
```

Similar flexible methods are aded across all the event enums:

- `Event::is_focus_gained()`
- `Event::is_focus_lost()`
- `Event::is_key()`
- `Event::is_mouse()`
- `Event::is_paste()`
- `Event::is_resize()`
- `Event::is_key_press()`
- `Event::as_key_press() -> Option<&KeyEvent>`
- `MouseEventKind::is_*()`
- `MouseButton::is_*()`
- `KeyEventKind::is_*()`
- `KeyEvent::is_press()`
- `KeyEvent::is_release()`
- `KeyEvent::is_repeat()`
- `KeyCode::is_*()`
- `KeyCode::is_function_key(n)`
- `KeyCode::is_char(c)`
- `KeyCode::as_char() -> Option<char>`
- `KeyCode::is_media_key(media)`
- `KeyCode::is_modifier(modifier)`
- add is_key_release() and is_key_repeat() checks
- add as_key_event()
- rename as_key_press() to as_key_press_event()
- add as_key_repeat_event()
- add as_key_release_event()
- add as_mouse_event()
- add as_paste_event()
- more tests
- update event-match and key-display examples
2025-02-02 11:31:10 +01:00
三咲雅 · Misaki Masa
6d6d3cb849 fix: Update rustix to fix the enable_raw_mode() error on WSL/Android (#926)
Fixes: #912
Co-authored-by: Josh McKinney <joshka@users.noreply.github.com>
2025-01-26 13:58:06 -08:00
Josh McKinney
fc8f977938 Document feature flags in lib.rs (#947)
* Autoformat Cargo.toml

Uses VSCode Even Better TOML plugin for opinionated formatting

* Document feature flags

Use the document-features crate to automatically add documentation about the features to the crate documentation at the crate level.
2024-11-22 15:16:55 -08:00
TimonPost
492b764f9f 0.28.1 2024-08-01 20:33:26 +02:00
Timon
4712ff5619 Fix mio and signalhook broken build (#907)
* Upgrade to mio 1.0
2024-08-01 20:30:12 +02:00
Alexandre Bury
8d1f0cc603 Require rustix/process when use-dev-tty is enabled (#906) 2024-08-01 20:12:05 +02:00
Timon
5d50d8da62 Minor upgrade to crossterm 0.28 (#898) 2024-07-31 19:41:00 +02:00
Heath Stewart
080f06494a Improve color detection across platforms (#885)
Fixes #882 by improving `style::available_color_count()`:
- Checks ANSI support on Windows.
- Uses the COLORTERM environment variable and falls back to the TERM environment variable.
- Supports "xterm-24bit" and "truecolor" values which return `u16::MAX`.
2024-06-16 14:58:31 +02:00
Josh McKinney
fe440284bf Use rustix instead of libc (additive only approach) (#892)
* use rustix instead of libc

* make rustix the default feature

* bump msrv to 1.63.0

* fix remaining libc issues

- use rustix version of sigwinch signal
- add a lifetime to FileDesc and replace FileDesc::Static to
  FileDesc::Borrowed. This made it necessary to either add a lifetime to
  the libc version of FileDesc or replace all the callers with multiple
  paths (libc, rustix). Changing FileDesc was more straightforward.
  There are no usages of FileDesc found in any repo on github, so this
  change should be reasonably safe.

* add changelog entry for rustix / filedesc change
2024-06-16 14:56:13 +02:00
Josh McKinney
fce58c879a fix: broken build issues (#888)
Co-authored-by: gwenn <gtreguier@gmail.com>
2024-05-05 18:47:20 +02:00
Timon
9a6d740ed5 0.27.0 2023-08-06 14:20:33 +02:00
Timon
9fb2e0dafd Update dependencies (#809) 2023-08-06 14:18:21 +02:00
Dave
00f7d06151 [testing] serial testing perserving terminal (#791)
This change does two things:
- add the serial_test crate to run selected tests serial rather
  than in parallel. This is done because they use global state
  so running them in parallel leads to race conditions and flaky
  results (sometimes they pass, sometimes they fail). Running
  them serialy avoids this flakiness.
- create a screen buffer within the test. This avoids changing
  the terminal (screen buffer) which is running the test. for
  example, a test that changes the terminal size to 20 x 20 can
  leave the developer running the test with a resized terminal.
  Creating a separate screen buffer for the test avoids this.
2023-08-05 15:36:42 +02:00
Wilfred Hughes
db443b08e8 Specify and document MSRV for 0.26 (#798)
As of 318f810a39, crossterm uses RFC
2795 implicit named arguments, which shipped in Rust 1.58.

Co-authored-by: Timon <timonpost@hotmail.nl>
2023-08-05 15:34:37 +02:00
Timon
769b18151c Add comments to feature flags 2023-04-08 15:34:23 +02:00
Timon
b2cbd94853 Upgrade to bitflags 2 (#777) 2023-04-08 15:30:43 +02:00
Timon
03c25178af Make the events module an optional feature (#776) 2023-04-07 17:09:15 +02:00
Jimmy Hartzell
b354b4cc34 Make direct winapi deps optional (#767) 2023-04-01 13:07:46 +02:00
Timon
1af259f9ce Release 0.26.1 2023-02-26 16:52:54 +01:00
Timon
338c122e99 0.26.0 (#750) 2023-01-28 11:12:26 +01:00
Jonathan
05229b71f9 Replace mio polling with filedescriptor's poll() (#735) 2023-01-11 20:15:32 +01:00
Timon
5d02ed8c37 0.25 (#702) 2022-08-10 22:01:18 +02:00
Charlie Groves
1fee5ff30c Add bracketed paste parsing (#693) 2022-08-10 09:16:56 +02:00
Timon
0c20590774 0.24 (#686) 2022-07-02 21:39:25 +02:00
Timon
9e6bf0fced 0.23.2 (#648)
* 0.23.1

* 0.23.2
2022-04-03 16:08:03 +02:00
Ivan Tham
c90f3190df Update to signal-hook-mio 0.8 (#645) 2022-04-02 18:58:03 +02:00
Timon
9a50fd2ce2 0.23 (#627) 2022-02-06 14:21:19 +01:00
Timon
db956267f8 0.22.1 (#614)
# Version 0.22.1
- Update yanked version crossterm-winapi and move to  crossterm-winapi 0.9.0.
- Changed panic to error when calling disable-mouse capture without setting it first.
- Update bitflags dependency.

# Version 0.22
- Fix serde Color serialisation/deserialization inconsistency.
- Update crossterm-winapi 0.8.1 to fix panic for certain mouse events
2021-10-19 10:19:16 +02:00
Timon
f909b3db95 0.21 (#596) 2021-08-23 19:07:55 +02:00
kWeiZh
c983000b51 Implement custom deserialisation for ansi value and rgb (#576) 2021-07-01 18:27:23 +02:00
Timon
a618a9f3b3 0.20 (#567) 2021-06-10 15:55:34 +02:00
Erick Tryzelaar
576990cb82 Update to signal-hook 0.3.8, signal-hook-mio 0.2.1 (#558) 2021-05-05 15:59:09 +02:00
SirWindfield
174de58b69 Update signal-hook to 0.1.17 (#555)
Closes #544
2021-03-29 09:08:04 +02:00
Timon Post
5a50d25c83 Merge branch 'master' of github.com:crossterm-rs/crossterm 2021-01-03 21:36:22 +01:00
Koxiaet
1418580fed Remove lazy_static dependency (#530) 2021-01-03 14:40:22 +01:00
Timon Post
be4deba596 0.19 version update 2020-12-28 11:05:11 +01:00
Timon
e7ea585e7c 0.19 (#527) 2020-12-28 11:02:16 +01:00
Timon
e46decc2f3 Fix wrong resize size return (#526) 2020-12-28 10:15:50 +01:00
OhhhZenix
467a884bae An to A (grammar fix)! (#509) 2020-11-10 12:09:32 +01:00
Timon Post
f85105c284 0.18.2 2020-10-29 17:46:44 +01:00
Timon Post
4d93f5e539 0.18.1 2020-10-24 10:31:47 +02:00
Timon Post
6d5d1a0ed8 0.18 2020-09-24 08:37:43 +02:00
Josh Stone
c6ffb3b8f9 Upgrade to parking_lot 0.11 (#486) 2020-09-13 14:15:02 +02:00
Timon
10421f8976 0.17.8 2020-09-08 09:02:49 +02:00