Convert SectionTree and all remaining callers to ScrollPane

SectionTree.scroll is now a ScrollPaneState. All callers of
render_scrollable replaced with ScrollPane::render_stateful_widget.

Deleted render_scrollable and its imports — no hand-rolled scroll
rendering remains outside of scroll_pane.rs.

Co-Authored-By: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
ProofOfConcept 2026-04-11 01:42:49 -04:00
parent 4a1f5acb85
commit e17118e4c9
3 changed files with 19 additions and 47 deletions

View file

@ -15,7 +15,7 @@ use ratatui::{
};
use super::{App, ScreenView, screen_legend};
use super::widgets::{SectionTree, SectionView, section_to_view, pane_block_focused, render_scrollable, tree_legend, format_age, format_ts_age};
use super::widgets::{SectionTree, SectionView, section_to_view, pane_block_focused, tree_legend, format_age, format_ts_age};
#[derive(Clone, Copy, PartialEq)]
enum Pane { Agents, Outputs, History, Context }
@ -282,7 +282,7 @@ impl SubconsciousScreen {
frame.render_stateful_widget(list, area, &mut self.list_state);
}
fn draw_outputs(&self, frame: &mut Frame, area: Rect, app: &App) {
fn draw_outputs(&mut self, frame: &mut Frame, area: Rect, app: &App) {
let sections = self.output_sections(app);
let mut lines: Vec<Line> = Vec::new();
@ -297,7 +297,8 @@ impl SubconsciousScreen {
let mut block = pane_block_focused("state", self.focus == Pane::Outputs);
if self.focus == Pane::Outputs { block = block.title_bottom(tree_legend()); }
render_scrollable(frame, area, lines, block, self.output_tree.scroll);
let widget = super::scroll_pane::ScrollPane::new(&lines).block(block);
frame.render_stateful_widget(widget, area, &mut self.output_tree.scroll);
}
fn draw_history(&mut self, frame: &mut Frame, area: Rect, app: &App) {
@ -351,7 +352,7 @@ impl SubconsciousScreen {
}
fn draw_context(
&self,
&mut self,
frame: &mut Frame,
area: Rect,
sections: &[SectionView],
@ -374,6 +375,7 @@ impl SubconsciousScreen {
let mut block = pane_block_focused(title, self.focus == Pane::Context);
if self.focus == Pane::Context { block = block.title_bottom(tree_legend()); }
render_scrollable(frame, area, lines, block, self.context_tree.scroll);
let widget = super::scroll_pane::ScrollPane::new(&lines).block(block);
frame.render_stateful_widget(widget, area, &mut self.context_tree.scroll);
}
}