scrolling again
This commit is contained in:
parent
8cfe1a0b65
commit
3d9114dea9
1 changed files with 37 additions and 2 deletions
|
|
@ -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() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue