Skip to content

Commit

Permalink
fixL screen flickering on WSL/Windows Terminal (#121)
Browse files Browse the repository at this point in the history
The flickering was caused due to screen being redrawn even on `InputEvent::Ignore` events

Closes #120
  • Loading branch information
AMythicDev authored Dec 17, 2023
1 parent cd2b92b commit e863d9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)?;
}
}
Expand Down Expand Up @@ -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,
Expand All @@ -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)?;
}
}
Expand Down

0 comments on commit e863d9d

Please sign in to comment.