Fix typos (#630)
This commit is contained in:
parent
9a50fd2ce2
commit
9bc5cd3527
@ -31,7 +31,7 @@ fn enable_vt_processing() -> Result<()> {
|
|||||||
static SUPPORTS_ANSI_ESCAPE_CODES: AtomicBool = AtomicBool::new(false);
|
static SUPPORTS_ANSI_ESCAPE_CODES: AtomicBool = AtomicBool::new(false);
|
||||||
static INITIALIZER: Once = Once::new();
|
static INITIALIZER: Once = Once::new();
|
||||||
|
|
||||||
/// Checks if the current terminal supports ansi escape sequences
|
/// Checks if the current terminal supports ANSI escape sequences
|
||||||
pub fn supports_ansi() -> bool {
|
pub fn supports_ansi() -> bool {
|
||||||
INITIALIZER.call_once(|| {
|
INITIALIZER.call_once(|| {
|
||||||
// Some terminals on Windows like GitBash can't use WinAPI calls directly
|
// Some terminals on Windows like GitBash can't use WinAPI calls directly
|
||||||
|
@ -8,13 +8,13 @@ use super::error::Result;
|
|||||||
/// Crossterm provides a set of commands,
|
/// Crossterm provides a set of commands,
|
||||||
/// and there is no immediate reason to implement a command yourself.
|
/// and there is no immediate reason to implement a command yourself.
|
||||||
/// In order to understand how to use and execute commands,
|
/// In order to understand how to use and execute commands,
|
||||||
/// it is recommended that you take a look at [Command Api](../#command-api) chapter.
|
/// it is recommended that you take a look at [Command API](../#command-api) chapter.
|
||||||
pub trait Command {
|
pub trait Command {
|
||||||
/// Write an ANSI representation of this command to the given writer.
|
/// Write an ANSI representation of this command to the given writer.
|
||||||
/// An ANSI code can manipulate the terminal by writing it to the terminal buffer.
|
/// An ANSI code can manipulate the terminal by writing it to the terminal buffer.
|
||||||
/// However, only Windows 10 and UNIX systems support this.
|
/// However, only Windows 10 and UNIX systems support this.
|
||||||
///
|
///
|
||||||
/// This method does not need to be accessed manually, as it is used by the crossterm's [Command Api](../#command-api)
|
/// This method does not need to be accessed manually, as it is used by the crossterm's [Command API](../#command-api)
|
||||||
fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result;
|
fn write_ansi(&self, f: &mut impl fmt::Write) -> fmt::Result;
|
||||||
|
|
||||||
/// Execute this command.
|
/// Execute this command.
|
||||||
@ -22,11 +22,11 @@ pub trait Command {
|
|||||||
/// Windows versions lower than windows 10 do not support ANSI escape codes,
|
/// Windows versions lower than windows 10 do not support ANSI escape codes,
|
||||||
/// therefore a direct WinAPI call is made.
|
/// therefore a direct WinAPI call is made.
|
||||||
///
|
///
|
||||||
/// This method does not need to be accessed manually, as it is used by the crossterm's [Command Api](../#command-api)
|
/// This method does not need to be accessed manually, as it is used by the crossterm's [Command API](../#command-api)
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn execute_winapi(&self) -> Result<()>;
|
fn execute_winapi(&self) -> Result<()>;
|
||||||
|
|
||||||
/// Returns whether the ansi code representation of this command is supported by windows.
|
/// Returns whether the ANSI code representation of this command is supported by windows.
|
||||||
///
|
///
|
||||||
/// A list of supported ANSI escape codes
|
/// A list of supported ANSI escape codes
|
||||||
/// can be found [here](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences).
|
/// can be found [here](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences).
|
||||||
|
@ -472,7 +472,7 @@ pub enum KeyCode {
|
|||||||
End,
|
End,
|
||||||
/// Page up key.
|
/// Page up key.
|
||||||
PageUp,
|
PageUp,
|
||||||
/// Page dow key.
|
/// Page down key.
|
||||||
PageDown,
|
PageDown,
|
||||||
/// Tab key.
|
/// Tab key.
|
||||||
Tab,
|
Tab,
|
||||||
|
@ -250,7 +250,7 @@ pub mod terminal;
|
|||||||
pub mod tty;
|
pub mod tty;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
/// A module that exposes one function to check if the current terminal supports ansi sequences.
|
/// A module that exposes one function to check if the current terminal supports ANSI sequences.
|
||||||
pub mod ansi_support;
|
pub mod ansi_support;
|
||||||
mod command;
|
mod command;
|
||||||
mod error;
|
mod error;
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ### Attributes
|
//! ### Attributes
|
||||||
//!
|
//!
|
||||||
//! How to appy terminal attributes to text.
|
//! How to apply terminal attributes to text.
|
||||||
//!
|
//!
|
||||||
//! Command API:
|
//! Command API:
|
||||||
//!
|
//!
|
||||||
@ -427,7 +427,7 @@ impl_display!(for PrintStyledContent<&'static str>);
|
|||||||
impl_display!(for ResetColor);
|
impl_display!(for ResetColor);
|
||||||
|
|
||||||
/// Utility function for ANSI parsing in Color and Colored.
|
/// Utility function for ANSI parsing in Color and Colored.
|
||||||
/// Gets the next element of `iter` and tries to parse it as a u8.
|
/// Gets the next element of `iter` and tries to parse it as a `u8`.
|
||||||
fn parse_next_u8<'a>(iter: &mut impl Iterator<Item = &'a str>) -> Option<u8> {
|
fn parse_next_u8<'a>(iter: &mut impl Iterator<Item = &'a str>) -> Option<u8> {
|
||||||
iter.next().and_then(|s| s.parse().ok())
|
iter.next().and_then(|s| s.parse().ok())
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
//! - Input will not be forwarded to screen
|
//! - Input will not be forwarded to screen
|
||||||
//! - Input will not be processed on enter press
|
//! - Input will not be processed on enter press
|
||||||
//! - Input will not be line buffered (input sent byte-by-byte to input buffer)
|
//! - Input will not be line buffered (input sent byte-by-byte to input buffer)
|
||||||
//! - Special keys like backspace and CTL+C will not be processed by terminal driver
|
//! - Special keys like backspace and CTRL+C will not be processed by terminal driver
|
||||||
//! - New line character will not be processed therefore `println!` can't be used, use `write!` instead
|
//! - New line character will not be processed therefore `println!` can't be used, use `write!` instead
|
||||||
//!
|
//!
|
||||||
//! Raw mode can be enabled/disabled with the [enable_raw_mode](terminal::enable_raw_mode) and [disable_raw_mode](terminal::disable_raw_mode) functions.
|
//! Raw mode can be enabled/disabled with the [enable_raw_mode](terminal::enable_raw_mode) and [disable_raw_mode](terminal::disable_raw_mode) functions.
|
||||||
|
@ -24,7 +24,7 @@ pub trait IsTty {
|
|||||||
fn is_tty(&self) -> bool;
|
fn is_tty(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// On unix, the `isatty()` function returns true if a file
|
/// On UNIX, the `isatty()` function returns true if a file
|
||||||
/// descriptor is a terminal.
|
/// descriptor is a terminal.
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
impl<S: AsRawFd> IsTty for S {
|
impl<S: AsRawFd> IsTty for S {
|
||||||
|
Loading…
Reference in New Issue
Block a user