Cleaner scroll handling

This commit is contained in:
2026-07-31 15:15:55 +02:00
parent 0f7d25627d
commit d779ac1a59
2 changed files with 58 additions and 43 deletions
+2 -4
View File
@@ -10,9 +10,7 @@ pub struct ScrollText {
impl Widget for ScrollText {
fn render(&self, scope: &mut crate::render::RenderScope) {
scope.draw_text(0, &self.title);
let title_lines = self.title.lines().count();
let title_lines = scope.draw_text(0, &self.title);
let mut y = title_lines as u16;
@@ -20,7 +18,7 @@ impl Widget for ScrollText {
.text
.lines()
.skip(self.scroll)
.take(scope.rect.height as usize - title_lines)
.take((scope.rect.height - title_lines) as usize)
{
y += scope.draw_text((0, y), line);
}