From cb64d883e780ca8f16a4f89f05e3abebec40a776 Mon Sep 17 00:00:00 2001 From: high_byte Date: Sat, 13 Jan 2024 21:04:36 +0200 Subject: [PATCH 1/2] fix tui to ignore key release event --- bin/reth/src/db/tui.rs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/reth/src/db/tui.rs b/bin/reth/src/db/tui.rs index 52c1e8a692ec..66388960e276 100644 --- a/bin/reth/src/db/tui.rs +++ b/bin/reth/src/db/tui.rs @@ -315,16 +315,20 @@ 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(), From feea33d26a0fe83e98d4eca2c3eaf48c851a372e Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sun, 14 Jan 2024 11:45:05 +0100 Subject: [PATCH 2/2] rustfmt --- bin/reth/src/commands/db/tui.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/reth/src/commands/db/tui.rs b/bin/reth/src/commands/db/tui.rs index 66388960e276..eac68edfb4c5 100644 --- a/bin/reth/src/commands/db/tui.rs +++ b/bin/reth/src/commands/db/tui.rs @@ -329,7 +329,7 @@ where _ => {} } } - }, + } Event::Mouse(e) => match e.kind { MouseEventKind::ScrollDown => app.next(), MouseEventKind::ScrollUp => app.previous(),