fix: broken build issues (#888)
Co-authored-by: gwenn <gtreguier@gmail.com>
This commit is contained in:
parent
6d20946dfe
commit
fce58c879a
4
.github/workflows/crossterm_test.yml
vendored
4
.github/workflows/crossterm_test.yml
vendored
@ -66,6 +66,10 @@ jobs:
|
|||||||
if: matrix.os != 'windows-2019'
|
if: matrix.os != 'windows-2019'
|
||||||
run: cargo test --no-default-features -- --nocapture --test-threads 1
|
run: cargo test --no-default-features -- --nocapture --test-threads 1
|
||||||
continue-on-error: ${{ matrix.can-fail }}
|
continue-on-error: ${{ matrix.can-fail }}
|
||||||
|
- name: Test no default features with use-dev-tty feature enabled
|
||||||
|
if: matrix.os != 'windows-2019'
|
||||||
|
run: cargo test --no-default-features --features "use-dev-tty events" -- --nocapture --test-threads 1
|
||||||
|
continue-on-error: ${{ matrix.can-fail }}
|
||||||
- name: Test no default features with windows feature enabled
|
- name: Test no default features with windows feature enabled
|
||||||
if: matrix.os == 'windows-2019'
|
if: matrix.os == 'windows-2019'
|
||||||
run: cargo test --no-default-features --features "windows" -- --nocapture --test-threads 1
|
run: cargo test --no-default-features --features "windows" -- --nocapture --test-threads 1
|
||||||
|
26
Cargo.toml
26
Cargo.toml
@ -28,11 +28,21 @@ all-features = true
|
|||||||
#
|
#
|
||||||
[features]
|
[features]
|
||||||
default = ["bracketed-paste", "windows", "events"]
|
default = ["bracketed-paste", "windows", "events"]
|
||||||
windows = ["dep:winapi", "dep:crossterm_winapi"] # Disables winapi dependencies from being included into the binary (SHOULD NOT be disabled on windows).
|
windows = [
|
||||||
bracketed-paste = [] # Enables triggering a `Event::Paste` when pasting text into the terminal.
|
"dep:winapi",
|
||||||
|
"dep:crossterm_winapi",
|
||||||
|
] # Disables winapi dependencies from being included into the binary (SHOULD NOT be disabled on windows).
|
||||||
|
bracketed-paste = [
|
||||||
|
] # Enables triggering a `Event::Paste` when pasting text into the terminal.
|
||||||
event-stream = ["dep:futures-core", "events"] # Enables async events
|
event-stream = ["dep:futures-core", "events"] # Enables async events
|
||||||
use-dev-tty = ["filedescriptor"] # Enables raw file descriptor polling / selecting instead of mio.
|
use-dev-tty = [
|
||||||
events = ["dep:mio", "dep:signal-hook", "dep:signal-hook-mio"] # Enables reading input/events from the system.
|
"filedescriptor",
|
||||||
|
] # Enables raw file descriptor polling / selecting instead of mio.
|
||||||
|
events = [
|
||||||
|
"dep:mio",
|
||||||
|
"dep:signal-hook",
|
||||||
|
"dep:signal-hook-mio",
|
||||||
|
] # Enables reading input/events from the system.
|
||||||
serde = ["dep:serde", "bitflags/serde"] # Enables 'serde' for various types.
|
serde = ["dep:serde", "bitflags/serde"] # Enables 'serde' for various types.
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -65,7 +75,9 @@ libc = "0.2"
|
|||||||
signal-hook = { version = "0.3.17", optional = true }
|
signal-hook = { version = "0.3.17", optional = true }
|
||||||
filedescriptor = { version = "0.8", optional = true }
|
filedescriptor = { version = "0.8", optional = true }
|
||||||
mio = { version = "0.8", features = ["os-poll"], optional = true }
|
mio = { version = "0.8", features = ["os-poll"], optional = true }
|
||||||
signal-hook-mio = { version = "0.2.3", features = ["support-v0_8"], optional = true }
|
signal-hook-mio = { version = "0.2.3", features = [
|
||||||
|
"support-v0_8",
|
||||||
|
], optional = true }
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dev dependencies (examples, ...)
|
# Dev dependencies (examples, ...)
|
||||||
@ -108,3 +120,7 @@ required-features = ["events"]
|
|||||||
[[example]]
|
[[example]]
|
||||||
name = "stderr"
|
name = "stderr"
|
||||||
required-features = ["events"]
|
required-features = ["events"]
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "key-display"
|
||||||
|
required-features = ["events"]
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#[cfg(feature = "events")]
|
#[cfg(feature = "events")]
|
||||||
pub use self::unix::position;
|
pub use self::unix::position;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
#[cfg(feature = "events")]
|
||||||
pub use self::windows::position;
|
pub use self::windows::position;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
pub(crate) use self::windows::{
|
pub(crate) use self::windows::{
|
||||||
|
@ -910,7 +910,7 @@ impl Display for ModifierKeyCode {
|
|||||||
///
|
///
|
||||||
/// # Platform-specific Notes
|
/// # Platform-specific Notes
|
||||||
///
|
///
|
||||||
/// On macOS, the control, alt, and super keys is displayed as "Control", "Option", and
|
/// On macOS, the control, alt, and super keys are displayed as "Control", "Option", and
|
||||||
/// "Command" respectively. See
|
/// "Command" respectively. See
|
||||||
/// <https://support.apple.com/guide/applestyleguide/welcome/1.0/web>.
|
/// <https://support.apple.com/guide/applestyleguide/welcome/1.0/web>.
|
||||||
///
|
///
|
||||||
@ -920,7 +920,6 @@ impl Display for ModifierKeyCode {
|
|||||||
///
|
///
|
||||||
/// On other platforms, the super key is referred to as "Super".
|
/// On other platforms, the super key is referred to as "Super".
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
match self {
|
match self {
|
||||||
ModifierKeyCode::LeftShift => write!(f, "Left Shift"),
|
ModifierKeyCode::LeftShift => write!(f, "Left Shift"),
|
||||||
ModifierKeyCode::LeftHyper => write!(f, "Left Hyper"),
|
ModifierKeyCode::LeftHyper => write!(f, "Left Hyper"),
|
||||||
|
@ -120,9 +120,7 @@ impl EventSource for UnixInternalEventSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SIGNAL_TOKEN => {
|
SIGNAL_TOKEN => {
|
||||||
for signal in self.signals.pending() {
|
if self.signals.pending().next() == Some(signal_hook::consts::SIGWINCH) {
|
||||||
match signal {
|
|
||||||
signal_hook::consts::SIGWINCH => {
|
|
||||||
// TODO Should we remove tput?
|
// TODO Should we remove tput?
|
||||||
//
|
//
|
||||||
// This can take a really long time, because terminal::size can
|
// This can take a really long time, because terminal::size can
|
||||||
@ -135,9 +133,6 @@ impl EventSource for UnixInternalEventSource {
|
|||||||
new_size.0, new_size.1,
|
new_size.0, new_size.1,
|
||||||
))));
|
))));
|
||||||
}
|
}
|
||||||
_ => unreachable!("Synchronize signal registration & handling"),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "event-stream")]
|
#[cfg(feature = "event-stream")]
|
||||||
WAKE_TOKEN => {
|
WAKE_TOKEN => {
|
||||||
|
@ -80,7 +80,7 @@ impl UnixInternalEventSource {
|
|||||||
/// only fills the given buffer and does not read beyond that.
|
/// only fills the given buffer and does not read beyond that.
|
||||||
fn read_complete(fd: &FileDesc, buf: &mut [u8]) -> io::Result<usize> {
|
fn read_complete(fd: &FileDesc, buf: &mut [u8]) -> io::Result<usize> {
|
||||||
loop {
|
loop {
|
||||||
match fd.read(buf, buf.len()) {
|
match fd.read(buf) {
|
||||||
Ok(x) => return Ok(x),
|
Ok(x) => return Ok(x),
|
||||||
Err(e) => match e.kind() {
|
Err(e) => match e.kind() {
|
||||||
io::ErrorKind::WouldBlock => return Ok(0),
|
io::ErrorKind::WouldBlock => return Ok(0),
|
||||||
|
@ -140,7 +140,10 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_attributes_const() {
|
fn test_attributes_const() {
|
||||||
const ATTRIBUTES: Attributes = Attributes::none().with(Attribute::Bold).with(Attribute::Italic).without(Attribute::Bold);
|
const ATTRIBUTES: Attributes = Attributes::none()
|
||||||
|
.with(Attribute::Bold)
|
||||||
|
.with(Attribute::Italic)
|
||||||
|
.without(Attribute::Bold);
|
||||||
assert!(!ATTRIBUTES.has(Attribute::Bold));
|
assert!(!ATTRIBUTES.has(Attribute::Bold));
|
||||||
assert!(ATTRIBUTES.has(Attribute::Italic));
|
assert!(ATTRIBUTES.has(Attribute::Italic));
|
||||||
}
|
}
|
||||||
|
@ -246,15 +246,11 @@ impl serde::ser::Serialize for Color {
|
|||||||
|
|
||||||
if str.is_empty() {
|
if str.is_empty() {
|
||||||
match *self {
|
match *self {
|
||||||
Color::AnsiValue(value) => {
|
Color::AnsiValue(value) => serializer.serialize_str(&format!("ansi_({})", value)),
|
||||||
serializer.serialize_str(&format!("ansi_({})", value))
|
|
||||||
}
|
|
||||||
Color::Rgb { r, g, b } => {
|
Color::Rgb { r, g, b } => {
|
||||||
serializer.serialize_str(&format!("rgb_({},{},{})", r, g, b))
|
serializer.serialize_str(&format!("rgb_({},{},{})", r, g, b))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => Err(serde::ser::Error::custom("Could not serialize enum type")),
|
||||||
Err(serde::ser::Error::custom("Could not serialize enum type"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
serializer.serialize_str(str)
|
serializer.serialize_str(str)
|
||||||
|
Loading…
Reference in New Issue
Block a user