user: remove dead scroll state from thalamus and unconscious screens

Both had scroll: u16 fields that were never connected to any key
handling or rendering. The unconscious screen renders fixed-size
graph health gauges; thalamus builds a paragraph but never scrolled
it. Neither needs scroll state.

Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
ProofOfConcept 2026-04-11 01:31:20 -04:00 committed by Kent Overstreet
parent 2d6a68048c
commit 2230fdf3c1
3 changed files with 9 additions and 21 deletions

View file

@ -13,12 +13,11 @@ use super::{App, ScreenView, screen_legend};
pub(crate) struct ThalamusScreen { pub(crate) struct ThalamusScreen {
sampling_selected: usize, sampling_selected: usize,
scroll: u16,
} }
impl ThalamusScreen { impl ThalamusScreen {
pub fn new() -> Self { 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) let para = Paragraph::new(lines)
.block(block) .block(block)
.wrap(Wrap { trim: false }) .wrap(Wrap { trim: false });
.scroll((self.scroll, 0));
frame.render_widget(para, area); frame.render_widget(para, area);
} }

View file

@ -6,35 +6,22 @@ use ratatui::{
text::{Line, Span}, text::{Line, Span},
widgets::{Block, Borders, Gauge, Paragraph}, widgets::{Block, Borders, Gauge, Paragraph},
Frame, Frame,
crossterm::event::KeyCode,
}; };
use super::{App, ScreenView, screen_legend}; use super::{App, ScreenView, screen_legend};
use crate::subconscious::daemon::GraphHealth; use crate::subconscious::daemon::GraphHealth;
pub(crate) struct UnconsciousScreen { pub(crate) struct UnconsciousScreen;
scroll: u16,
}
impl UnconsciousScreen { impl UnconsciousScreen {
pub fn new() -> Self { Self { scroll: 0 } } pub fn new() -> Self { Self }
} }
impl ScreenView for UnconsciousScreen { impl ScreenView for UnconsciousScreen {
fn label(&self) -> &'static str { "hippocampus" } fn label(&self) -> &'static str { "hippocampus" }
fn tick(&mut self, frame: &mut Frame, area: Rect, fn tick(&mut self, frame: &mut Frame, area: Rect,
events: &[ratatui::crossterm::event::Event], app: &mut App) { _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; }
_ => {}
}
}
}
let block = Block::default() let block = Block::default()
.title_top(Line::from(screen_legend()).left_aligned()) .title_top(Line::from(screen_legend()).left_aligned())

View file

@ -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( pub fn render_scrollable(
frame: &mut Frame, frame: &mut Frame,
area: Rect, area: Rect,