From e863d9d2a5ac0693ef9463b57cac69066ff418a3 Mon Sep 17 00:00:00 2001 From: Arijit Dey <65700195+arijit79@users.noreply.github.com> Date: Sun, 17 Dec 2023 20:36:13 +0530 Subject: [PATCH] fixL screen flickering on WSL/Windows Terminal (#121) The flickering was caused due to screen being redrawn even on `InputEvent::Ignore` events Closes #120 --- src/core/init.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/init.rs b/src/core/init.rs index e408490..70410b9 100644 --- a/src/core/init.rs +++ b/src/core/init.rs @@ -267,6 +267,7 @@ fn start_reactor( let ev = Command::UserInput(ev); let is_exit_event = ev.is_exit_event(); let is_movement = ev.is_movement(); + let is_ignore = ev == Command::UserInput(InputEvent::Ignore); handle_event( ev, &mut out_lock, @@ -284,7 +285,7 @@ fn start_reactor( p.rows.try_into().unwrap(), )?; } - if !is_exit_event && !is_movement { + if !is_ignore && !is_exit_event && !is_movement { draw_full(&mut out_lock, &mut p)?; } } @@ -329,6 +330,7 @@ fn start_reactor( let mut p = ps.lock(); let is_exit_event = Command::UserInput(inp).is_exit_event(); let is_movement = Command::UserInput(inp).is_movement(); + let is_ignore = inp == InputEvent::Ignore; handle_event( Command::UserInput(inp), &mut out_lock, @@ -337,7 +339,7 @@ fn start_reactor( #[cfg(feature = "search")] input_thread_running, )?; - if !is_exit_event && !is_movement { + if !is_ignore && !is_exit_event && !is_movement { draw_full(&mut out_lock, &mut p)?; } }