1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-09-16 10:51:42 +02:00

Prevent unneeded redraws

This commit is contained in:
mo8it 2024-04-07 03:41:23 +02:00
parent 372290a796
commit c4897139ae

View File

@ -80,7 +80,13 @@ pub fn list(state: &State, exercises: &[Exercise]) -> Result<()> {
let key = loop {
match event::read()? {
Event::Key(key) => break key,
Event::Key(key) => {
if key.kind != KeyEventKind::Press {
continue;
}
break key;
}
// Redraw
Event::Resize(_, _) => continue 'outer,
// Ignore
@ -88,10 +94,6 @@ pub fn list(state: &State, exercises: &[Exercise]) -> Result<()> {
}
};
if key.kind != KeyEventKind::Press {
continue;
}
match key.code {
KeyCode::Char('q') => break,
KeyCode::Down | KeyCode::Char('j') => {