From 220a2715e9a527fc79c2ce1066b45ffbe99a2a63 Mon Sep 17 00:00:00 2001 From: high_byte <63053861+hananbeer@users.noreply.github.com> Date: Sun, 14 Jan 2024 12:54:26 +0200 Subject: [PATCH] fix tui to ignore key release event (#6057) Co-authored-by: Matthias Seitz --- bin/reth/src/commands/db/tui.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bin/reth/src/commands/db/tui.rs b/bin/reth/src/commands/db/tui.rs index 52c1e8a692ec..eac68edfb4c5 100644 --- a/bin/reth/src/commands/db/tui.rs +++ b/bin/reth/src/commands/db/tui.rs @@ -315,17 +315,21 @@ where } match event { - Event::Key(key) => match key.code { - KeyCode::Char('q') | KeyCode::Char('Q') => return Ok(true), - KeyCode::Down => app.next(), - KeyCode::Up => app.previous(), - KeyCode::Right => app.next_page(), - KeyCode::Left => app.previous_page(), - KeyCode::Char('G') => { - app.mode = ViewMode::GoToPage; + Event::Key(key) => { + if key.kind == event::KeyEventKind::Press { + match key.code { + KeyCode::Char('q') | KeyCode::Char('Q') => return Ok(true), + KeyCode::Down => app.next(), + KeyCode::Up => app.previous(), + KeyCode::Right => app.next_page(), + KeyCode::Left => app.previous_page(), + KeyCode::Char('G') => { + app.mode = ViewMode::GoToPage; + } + _ => {} + } } - _ => {} - }, + } Event::Mouse(e) => match e.kind { MouseEventKind::ScrollDown => app.next(), MouseEventKind::ScrollUp => app.previous(),