Issue 3264: reformat to conform to style guidelines
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers};
|
use crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers};
|
||||||
use std::io::{Read, Error, ErrorKind};
|
use std::io::{Error, ErrorKind, Read};
|
||||||
|
|
||||||
// Provide graceful degradation limited support mode if reading from stdin that does not
|
// Provide graceful degradation limited support mode if reading from stdin that does not
|
||||||
// support terminal features.
|
// support terminal features.
|
||||||
//
|
//
|
||||||
// Retrieve a single byte from stdin, does not support full Unicode decoding; only convert
|
// Retrieve a single byte from stdin, does not support full Unicode decoding; only convert
|
||||||
// byte to KeyEvent char if it falls within the ASCII subset of UTF-8.
|
// byte to KeyEvent char if it falls within the ASCII subset of UTF-8.
|
||||||
//
|
//
|
||||||
// Does not support passing through Ctrl-C as a KeyEvent.
|
// Does not support passing through Ctrl-C as a KeyEvent.
|
||||||
@@ -16,8 +16,7 @@ pub(crate) fn limited_support_read() -> std::io::Result<KeyEvent> {
|
|||||||
Ok(b) => {
|
Ok(b) => {
|
||||||
if b.is_ascii() {
|
if b.is_ascii() {
|
||||||
Ok(map_ascii_to_keyevent(b as char))
|
Ok(map_ascii_to_keyevent(b as char))
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Err(Error::new(ErrorKind::Unsupported, "not supported input"))
|
Err(Error::new(ErrorKind::Unsupported, "not supported input"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,4 +33,4 @@ fn map_ascii_to_keyevent(c: char) -> KeyEvent {
|
|||||||
kind: KeyEventKind::Press,
|
kind: KeyEventKind::Press,
|
||||||
state: KeyEventState::empty(),
|
state: KeyEventState::empty(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,4 +46,4 @@ fn supported_terminal() -> bool {
|
|||||||
|
|
||||||
// If OS is Windows and stdin is not a tty, it's either a pipe or an unsupported terminal configuration.
|
// If OS is Windows and stdin is not a tty, it's either a pipe or an unsupported terminal configuration.
|
||||||
!windows_os || std::io::stdin().is_tty()
|
!windows_os || std::io::stdin().is_tty()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user