fix tui to ignore key release event (#6057)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
high_byte
2024-01-14 12:54:26 +02:00
committed by GitHub
parent 5127d40f48
commit 220a2715e9

View File

@ -315,17 +315,21 @@ where
} }
match event { match event {
Event::Key(key) => match key.code { Event::Key(key) => {
KeyCode::Char('q') | KeyCode::Char('Q') => return Ok(true), if key.kind == event::KeyEventKind::Press {
KeyCode::Down => app.next(), match key.code {
KeyCode::Up => app.previous(), KeyCode::Char('q') | KeyCode::Char('Q') => return Ok(true),
KeyCode::Right => app.next_page(), KeyCode::Down => app.next(),
KeyCode::Left => app.previous_page(), KeyCode::Up => app.previous(),
KeyCode::Char('G') => { KeyCode::Right => app.next_page(),
app.mode = ViewMode::GoToPage; KeyCode::Left => app.previous_page(),
KeyCode::Char('G') => {
app.mode = ViewMode::GoToPage;
}
_ => {}
}
} }
_ => {} }
},
Event::Mouse(e) => match e.kind { Event::Mouse(e) => match e.kind {
MouseEventKind::ScrollDown => app.next(), MouseEventKind::ScrollDown => app.next(),
MouseEventKind::ScrollUp => app.previous(), MouseEventKind::ScrollUp => app.previous(),