Fix CI failures (#746)
This commit is contained in:
parent
614e6a73b7
commit
814df1c4a0
@ -347,7 +347,6 @@ impl Command for EnableBlinking {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// A command that disables blinking of the terminal cursor.
|
/// A command that disables blinking of the terminal cursor.
|
||||||
///
|
///
|
||||||
/// See `SetCursorStyle` which is more advanced and better supported.
|
/// See `SetCursorStyle` which is more advanced and better supported.
|
||||||
|
@ -12,15 +12,13 @@ use filedescriptor::{poll, pollfd, POLLIN};
|
|||||||
#[cfg(feature = "event-stream")]
|
#[cfg(feature = "event-stream")]
|
||||||
use crate::event::sys::Waker;
|
use crate::event::sys::Waker;
|
||||||
|
|
||||||
use crate::{
|
use crate::event::{
|
||||||
event::{
|
source::EventSource,
|
||||||
sys::unix::{
|
sys::unix::{
|
||||||
file_descriptor::{tty_fd, FileDesc},
|
file_descriptor::{tty_fd, FileDesc},
|
||||||
parse::parse_event,
|
parse::parse_event,
|
||||||
},
|
},
|
||||||
InternalEvent,
|
InternalEvent,
|
||||||
source::EventSource,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Holds a prototypical Waker and a receiver we can wait on when doing select().
|
/// Holds a prototypical Waker and a receiver we can wait on when doing select().
|
||||||
|
@ -110,7 +110,7 @@ fn try_ensure_char_case(ch: char, desired_case: CharCase) -> char {
|
|||||||
let mut iter = ch.to_lowercase();
|
let mut iter = ch.to_lowercase();
|
||||||
// Unwrap is safe; iterator yields one or more chars.
|
// Unwrap is safe; iterator yields one or more chars.
|
||||||
let ch_lower = iter.next().unwrap();
|
let ch_lower = iter.next().unwrap();
|
||||||
if iter.next() == None {
|
if iter.next().is_none() {
|
||||||
ch_lower
|
ch_lower
|
||||||
} else {
|
} else {
|
||||||
ch
|
ch
|
||||||
@ -120,7 +120,7 @@ fn try_ensure_char_case(ch: char, desired_case: CharCase) -> char {
|
|||||||
let mut iter = ch.to_uppercase();
|
let mut iter = ch.to_uppercase();
|
||||||
// Unwrap is safe; iterator yields one or more chars.
|
// Unwrap is safe; iterator yields one or more chars.
|
||||||
let ch_upper = iter.next().unwrap();
|
let ch_upper = iter.next().unwrap();
|
||||||
if iter.next() == None {
|
if iter.next().is_none() {
|
||||||
ch_upper
|
ch_upper
|
||||||
} else {
|
} else {
|
||||||
ch
|
ch
|
||||||
@ -186,7 +186,7 @@ fn get_char_for_key(key_event: &KeyEventRecord) -> Option<char> {
|
|||||||
|
|
||||||
let mut ch_iter = std::char::decode_utf16(utf16_buf.into_iter().take(ret as usize));
|
let mut ch_iter = std::char::decode_utf16(utf16_buf.into_iter().take(ret as usize));
|
||||||
let mut ch = ch_iter.next()?.ok()?;
|
let mut ch = ch_iter.next()?.ok()?;
|
||||||
if ch_iter.next() != None {
|
if ch_iter.next().is_some() {
|
||||||
// Key doesn't map to a single char.
|
// Key doesn't map to a single char.
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ pub(crate) fn set_foreground_color(fg_color: Color) -> Result<()> {
|
|||||||
|
|
||||||
// background intensity is a separate value in attrs,
|
// background intensity is a separate value in attrs,
|
||||||
// we need to check if this was applied to the current bg color.
|
// we need to check if this was applied to the current bg color.
|
||||||
if (attrs & wincon::BACKGROUND_INTENSITY as u16) != 0 {
|
if (attrs & wincon::BACKGROUND_INTENSITY) != 0 {
|
||||||
color |= wincon::BACKGROUND_INTENSITY as u16;
|
color |= wincon::BACKGROUND_INTENSITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::from(screen_buffer.handle().clone()).set_text_attribute(color)?;
|
Console::from(screen_buffer.handle().clone()).set_text_attribute(color)?;
|
||||||
@ -58,8 +58,8 @@ pub(crate) fn set_background_color(bg_color: Color) -> Result<()> {
|
|||||||
|
|
||||||
// Foreground intensity is a separate value in attrs,
|
// Foreground intensity is a separate value in attrs,
|
||||||
// So we need to check if this was applied to the current fg color.
|
// So we need to check if this was applied to the current fg color.
|
||||||
if (attrs & wincon::FOREGROUND_INTENSITY as u16) != 0 {
|
if (attrs & wincon::FOREGROUND_INTENSITY) != 0 {
|
||||||
color |= wincon::FOREGROUND_INTENSITY as u16;
|
color |= wincon::FOREGROUND_INTENSITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::from(screen_buffer.handle().clone()).set_text_attribute(color)?;
|
Console::from(screen_buffer.handle().clone()).set_text_attribute(color)?;
|
||||||
|
@ -123,13 +123,15 @@ fn read_supports_keyboard_enhancement_raw() -> Result<bool> {
|
|||||||
// ESC [ c Query primary device attributes.
|
// ESC [ c Query primary device attributes.
|
||||||
const QUERY: &[u8] = b"\x1B[?u\x1B[c";
|
const QUERY: &[u8] = b"\x1B[?u\x1B[c";
|
||||||
|
|
||||||
if let Err(_) = File::open("/dev/tty").and_then(|mut file| {
|
let result = File::open("/dev/tty").and_then(|mut file| {
|
||||||
file.write_all(QUERY)?;
|
file.write_all(QUERY)?;
|
||||||
file.flush()
|
file.flush()
|
||||||
}) {
|
});
|
||||||
|
if result.is_err() {
|
||||||
let mut stdout = io::stdout();
|
let mut stdout = io::stdout();
|
||||||
stdout.write_all(QUERY)?;
|
stdout.write_all(QUERY)?;
|
||||||
stdout.flush()?;
|
stdout.flush()?;
|
||||||
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -234,7 +234,7 @@ fn clear_after_cursor(location: Coord, buffer_size: Size, current_attribute: u16
|
|||||||
let (mut x, mut y) = (location.x, location.y);
|
let (mut x, mut y) = (location.x, location.y);
|
||||||
|
|
||||||
// if cursor position is at the outer right position
|
// if cursor position is at the outer right position
|
||||||
if x as i16 > buffer_size.width {
|
if x > buffer_size.width {
|
||||||
y += 1;
|
y += 1;
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ fn clear_until_line(location: Coord, buffer_size: Size, current_attribute: u16)
|
|||||||
let start_location = Coord::new(x, y);
|
let start_location = Coord::new(x, y);
|
||||||
|
|
||||||
// get sum cells before cursor
|
// get sum cells before cursor
|
||||||
let cells_to_write = (buffer_size.width - x as i16) as u32;
|
let cells_to_write = (buffer_size.width - x) as u32;
|
||||||
|
|
||||||
// clear until the current line
|
// clear until the current line
|
||||||
clear_winapi(start_location, cells_to_write, current_attribute)?;
|
clear_winapi(start_location, cells_to_write, current_attribute)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user