summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-07 03:41:23 +0200
committermo8it <mo8it@proton.me>2024-04-07 03:41:23 +0200
commitc4897139aeff2316d2b737a4e03b7491b696ce3b (patch)
tree326bb19fadb75383eedad5a2e2793b9eba646229 /src
parent372290a796eb27b28edaf2475ebbb4e6e09090b3 (diff)
Prevent unneeded redraws
Diffstat (limited to 'src')
-rw-r--r--src/list.rs12
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') => {