diff options
| author | mo8it <mo8it@proton.me> | 2024-04-07 03:41:23 +0200 |
|---|---|---|
| committer | mo8it <mo8it@proton.me> | 2024-04-07 03:41:23 +0200 |
| commit | c4897139aeff2316d2b737a4e03b7491b696ce3b (patch) | |
| tree | 326bb19fadb75383eedad5a2e2793b9eba646229 /src/list.rs | |
| parent | 372290a796eb27b28edaf2475ebbb4e6e09090b3 (diff) | |
Prevent unneeded redraws
Diffstat (limited to 'src/list.rs')
| -rw-r--r-- | src/list.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/list.rs b/src/list.rs index 82c3e46..b8ea27b 100644 --- a/src/list.rs +++ b/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') => { |
