Fix UI overflows

This commit is contained in:
2026-07-27 19:30:45 +02:00
parent 537ea52f2a
commit 7b1281aa57
2 changed files with 59 additions and 6 deletions
+9 -4
View File
@@ -14,21 +14,26 @@ impl Widget for ScrollText {
let title_lines = self.title.lines().count();
for (y, line) in self
let mut y = title_lines as u16;
for line in self
.text
.lines()
.skip(self.scroll)
.take(scope.rect.height as usize - title_lines)
.enumerate()
{
scope.draw_text((0, (y + title_lines) as u16), line);
y += scope.draw_text((0, y), line);
}
}
}
impl<const N: usize> ScrollState<N> {
pub fn get_selected(&self, index: usize) -> &'static str {
if index == self.0 { "\x1b[4m\x1b[1m" } else { "\x1b[1m" }
if index == self.0 {
"\x1b[4m\x1b[1m"
} else {
"\x1b[1m"
}
}
pub fn scroll(&self, index: usize, title: String, text: String) -> ScrollText {