Fix scroll

This commit is contained in:
2026-07-31 15:44:22 +02:00
parent d779ac1a59
commit 4d042251b3
2 changed files with 14 additions and 7 deletions
+6 -7
View File
@@ -12,16 +12,15 @@ impl Widget for ScrollText {
fn render(&self, scope: &mut crate::render::RenderScope) {
let title_lines = scope.draw_text(0, &self.title);
let mut y = title_lines as u16;
for line in self
let text = self
.text
.lines()
.skip(self.scroll)
.take((scope.rect.height - title_lines) as usize)
{
y += scope.draw_text((0, y), line);
}
.map(|v| v.trim_end())
.collect::<Vec<_>>()
.join("\n");
scope.draw_text((0, title_lines), text);
}
}