Skip to content

Commit

Permalink
Simplify windows read_single_key()
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Feb 27, 2025
1 parent 456eb78 commit 4fa21ad
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/windows_term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,13 @@ pub(crate) fn read_secure() -> io::Result<String> {

pub(crate) fn read_single_key(ctrlc_key: bool) -> io::Result<Key> {
let key_event = {
let _guard = if ctrlc_key {
let _guard = ctrlc_key.then(|| {
ConsoleModeGuard::set(
unsafe { GetStdHandle(STD_INPUT_HANDLE) },
ENABLE_PROCESSED_INPUT,
false,
)
} else {
None
};
});
read_key_event()?
};

Expand Down

0 comments on commit 4fa21ad

Please sign in to comment.