Fix UI overflows
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user