-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(completion): enable use of pexpect et al. with basic input backend
- Loading branch information
Showing
19 changed files
with
547 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
mod basic_shell; | ||
mod raw_mode; | ||
mod term_line_reader; | ||
|
||
#[allow(clippy::module_name_repetitions)] | ||
pub use basic_shell::BasicShell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use crate::ShellError; | ||
|
||
pub(crate) struct RawModeToggle { | ||
initial: bool, | ||
} | ||
|
||
impl RawModeToggle { | ||
pub fn new() -> Result<Self, ShellError> { | ||
let initial = crossterm::terminal::is_raw_mode_enabled()?; | ||
Ok(Self { initial }) | ||
} | ||
|
||
#[allow(clippy::unused_self)] | ||
pub fn enable(&self) -> Result<(), ShellError> { | ||
crossterm::terminal::enable_raw_mode()?; | ||
Ok(()) | ||
} | ||
|
||
#[allow(clippy::unused_self)] | ||
pub fn disable(&self) -> Result<(), ShellError> { | ||
crossterm::terminal::disable_raw_mode()?; | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl Drop for RawModeToggle { | ||
fn drop(&mut self) { | ||
let _ = if self.initial { | ||
crossterm::terminal::enable_raw_mode() | ||
} else { | ||
crossterm::terminal::disable_raw_mode() | ||
}; | ||
} | ||
} |
Oops, something went wrong.