Compare commits

..

2 Commits

Author SHA1 Message Date
Thomas Forgione 922ba9c524 Remove useless eprintln 2023-10-26 11:41:16 +02:00
Thomas Forgione 9802c8e740 Fix bad rendering of border 2023-10-26 11:40:20 +02:00
1 changed files with 12 additions and 12 deletions

View File

@ -289,7 +289,7 @@ impl Tile {
}
// Autoscroll whene content arrives on stdout
self.scroll = self.stdout.len() as isize - 1 - (self.inner_size.1 as isize);
self.scroll = self.stdout.len() as isize - 2 - (self.inner_size.1 as isize);
if self.scroll < 0 {
self.scroll = 0;
}
@ -448,8 +448,6 @@ impl Tile {
}
buffer.push(spaces);
eprintln!("Clear {}", max_char_index);
line_index += 1;
current_char_index = 0;
max_char_index = 0;
@ -499,15 +497,17 @@ impl Tile {
}
}
let mut spaces = format!(
"{}",
cursor::Goto(x + max_char_index, y + last_line_index as u16 - scroll)
);
if last_line_index <= h {
let mut spaces = format!(
"{}",
cursor::Goto(x + max_char_index, y + last_line_index as u16 - scroll)
);
for _ in max_char_index..w {
spaces.push(DELETE_CHAR);
for _ in max_char_index..w {
spaces.push(DELETE_CHAR);
}
buffer.push(spaces);
}
buffer.push(spaces);
buffer.push(format!("{}", style::Reset));
buffer.join("")
@ -522,7 +522,7 @@ impl Tile {
/// Scrolls down one line.
pub fn scroll_down(&mut self) {
if self.scroll + (self.inner_size.1 as isize) < self.stdout.len() as isize - 1 {
if self.scroll + (self.inner_size.1 as isize) < self.stdout.len() as isize - 2 {
self.scroll += 1;
}
}
@ -534,7 +534,7 @@ impl Tile {
/// Scrolls down one line.
pub fn scroll_full_down(&mut self) {
self.scroll = self.stdout.len() as isize - self.inner_size.1 as isize - 1;
self.scroll = self.stdout.len() as isize - self.inner_size.1 as isize - 2;
if self.scroll < 0 {
self.scroll = 0;
}