From f96cb6903db04339bf029e1c1cd2c5b27d210e19 Mon Sep 17 00:00:00 2001 From: Andrew Lee <32912555+candrewlee14@users.noreply.github.com> Date: Mon, 12 Feb 2024 01:24:24 -0700 Subject: fix: reorder the exit of enhanced keyboard mode (#1694) The `Stdout::new` function first enters an alternate screen then later enables enhanced keyboard mode. In `Drop`, we need to do this in the opposite order: disable enhanced keyboard mode then exit alternate mode. Fixes #1693 --- atuin/src/command/client/search/interactive.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atuin/src/command/client/search/interactive.rs b/atuin/src/command/client/search/interactive.rs index 1a94e36d..5401a269 100644 --- a/atuin/src/command/client/search/interactive.rs +++ b/atuin/src/command/client/search/interactive.rs @@ -794,6 +794,9 @@ impl Stdout { impl Drop for Stdout { fn drop(&mut self) { + #[cfg(not(target_os = "windows"))] + execute!(self.stdout, PopKeyboardEnhancementFlags).unwrap(); + if !self.inline_mode { execute!(self.stdout, terminal::LeaveAlternateScreen).unwrap(); } @@ -804,9 +807,6 @@ impl Drop for Stdout { ) .unwrap(); - #[cfg(not(target_os = "windows"))] - execute!(self.stdout, PopKeyboardEnhancementFlags).unwrap(); - terminal::disable_raw_mode().unwrap(); } } -- cgit v1.3.1