We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 456eb78 commit 4fa21adCopy full SHA for 4fa21ad
src/windows_term/mod.rs
@@ -410,15 +410,13 @@ pub(crate) fn read_secure() -> io::Result<String> {
410
411
pub(crate) fn read_single_key(ctrlc_key: bool) -> io::Result<Key> {
412
let key_event = {
413
- let _guard = if ctrlc_key {
+ let _guard = ctrlc_key.then(|| {
414
ConsoleModeGuard::set(
415
unsafe { GetStdHandle(STD_INPUT_HANDLE) },
416
ENABLE_PROCESSED_INPUT,
417
false,
418
)
419
- } else {
420
- None
421
- };
+ });
422
read_key_event()?
423
};
424
0 commit comments