mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-21 13:32:23 -05:00
Prevent unneeded redraws
This commit is contained in:
parent
372290a796
commit
c4897139ae
1 changed files with 7 additions and 5 deletions
12
src/list.rs
12
src/list.rs
|
@ -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') => {
|
||||
|
|
Loading…
Reference in a new issue