diff --git a/src/user/thalamus.rs b/src/user/thalamus.rs index 5556596..a24fefb 100644 --- a/src/user/thalamus.rs +++ b/src/user/thalamus.rs @@ -13,12 +13,11 @@ use super::{App, ScreenView, screen_legend}; pub(crate) struct ThalamusScreen { sampling_selected: usize, - scroll: u16, } impl ThalamusScreen { pub fn new() -> Self { - Self { sampling_selected: 0, scroll: 0 } + Self { sampling_selected: 0 } } } @@ -148,8 +147,7 @@ impl ScreenView for ThalamusScreen { let para = Paragraph::new(lines) .block(block) - .wrap(Wrap { trim: false }) - .scroll((self.scroll, 0)); + .wrap(Wrap { trim: false }); frame.render_widget(para, area); } diff --git a/src/user/unconscious.rs b/src/user/unconscious.rs index 9f5c98b..9542d2e 100644 --- a/src/user/unconscious.rs +++ b/src/user/unconscious.rs @@ -6,35 +6,22 @@ use ratatui::{ text::{Line, Span}, widgets::{Block, Borders, Gauge, Paragraph}, Frame, - crossterm::event::KeyCode, }; use super::{App, ScreenView, screen_legend}; use crate::subconscious::daemon::GraphHealth; -pub(crate) struct UnconsciousScreen { - scroll: u16, -} +pub(crate) struct UnconsciousScreen; impl UnconsciousScreen { - pub fn new() -> Self { Self { scroll: 0 } } + pub fn new() -> Self { Self } } impl ScreenView for UnconsciousScreen { fn label(&self) -> &'static str { "hippocampus" } fn tick(&mut self, frame: &mut Frame, area: Rect, - events: &[ratatui::crossterm::event::Event], app: &mut App) { - for event in events { - if let ratatui::crossterm::event::Event::Key(key) = event { - if key.kind != ratatui::crossterm::event::KeyEventKind::Press { continue; } - match key.code { - KeyCode::PageUp => { self.scroll = self.scroll.saturating_sub(20); } - KeyCode::PageDown => { self.scroll += 20; } - _ => {} - } - } - } + _events: &[ratatui::crossterm::event::Event], app: &mut App) { let block = Block::default() .title_top(Line::from(screen_legend()).left_aligned()) diff --git a/src/user/widgets.rs b/src/user/widgets.rs index 5148880..876fbdc 100644 --- a/src/user/widgets.rs +++ b/src/user/widgets.rs @@ -102,7 +102,10 @@ pub fn tree_legend() -> Line<'static> { ) } -/// Render a paragraph with a vertical scrollbar. +/// Render a scrollable paragraph with a vertical scrollbar. +/// +/// Legacy wrapper — callers that manage their own `u16` scroll offset +/// use this. For new code, prefer ScrollPane + ScrollPaneState. pub fn render_scrollable( frame: &mut Frame, area: Rect,