scrolling again

This commit is contained in:
Jana Dönszelmann 2026-02-25 15:18:45 +01:00
parent 8cfe1a0b65
commit 3d9114dea9
No known key found for this signature in database

View file

@ -1,5 +1,8 @@
use crossterm::{ use crossterm::{
event::{DisableMouseCapture, EnableMouseCapture, MouseButton, MouseEventKind}, event::{
DisableMouseCapture, EnableMouseCapture, KeyEventKind, KeyEventState, MouseButton,
MouseEventKind,
},
terminal::{EnterAlternateScreen, LeaveAlternateScreen}, terminal::{EnterAlternateScreen, LeaveAlternateScreen},
}; };
use ratatui_themes::{Theme, ThemeName}; use ratatui_themes::{Theme, ThemeName};
@ -28,7 +31,7 @@ use ratatui::{
crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, crossterm::event::{self, Event, KeyCode, KeyEvent, KeyModifiers},
layout::{Constraint, HorizontalAlignment, Layout, Rect}, layout::{Constraint, HorizontalAlignment, Layout, Rect},
prelude::CrosstermBackend, prelude::CrosstermBackend,
style::Style, style::{Modifier, Style},
text::Line, text::Line,
widgets::{ widgets::{
Block, Clear, List, ListItem, ListState, Padding, Paragraph, StatefulWidget, Widget, Wrap, Block, Clear, List, ListItem, ListState, Padding, Paragraph, StatefulWidget, Widget, Wrap,
@ -400,6 +403,38 @@ impl App {
} }
Event::FocusGained => {} Event::FocusGained => {}
Event::FocusLost => {} Event::FocusLost => {}
Event::Mouse(mouse) if mouse.kind == MouseEventKind::ScrollDown => {
if self
.handle_generic_keycode(
KeyEvent {
code: KeyCode::Down,
modifiers: KeyModifiers::empty(),
kind: KeyEventKind::Press,
state: KeyEventState::empty(),
},
terminal,
)
.is_break()
{
break Ok(());
}
}
Event::Mouse(mouse) if mouse.kind == MouseEventKind::ScrollUp => {
if self
.handle_generic_keycode(
KeyEvent {
code: KeyCode::Up,
modifiers: KeyModifiers::empty(),
kind: KeyEventKind::Press,
state: KeyEventState::empty(),
},
terminal,
)
.is_break()
{
break Ok(());
}
}
Event::Mouse(mouse_event) => { Event::Mouse(mouse_event) => {
if let MouseEventKind::Up(MouseButton::Left) = mouse_event.kind { if let MouseEventKind::Up(MouseButton::Left) = mouse_event.kind {
if let Tab::LogViewer(lv) = self.current_tab() { if let Tab::LogViewer(lv) = self.current_tab() {