Attempt to fix things

This commit is contained in:
Thomas Forgione 2023-10-24 16:40:08 +02:00
parent 848a848d9d
commit cd867b6c87
1 changed files with 11 additions and 3 deletions

View File

@ -280,7 +280,6 @@ impl Tile {
.replace_range((cursor - 2)..(cursor + counter), ""); .replace_range((cursor - 2)..(cursor + counter), "");
self.len -= 2 + counter; self.len -= 2 + counter;
self.cursor = None; self.cursor = None;
self.column_number = 0;
self.counting = true; self.counting = true;
continue; continue;
} }
@ -310,10 +309,19 @@ impl Tile {
None None
} else { } else {
// TODO fix utf8 // TODO fix utf8
self.stdout.replace_range(index..index + 1, &c.to_string()); if index >= self.stdout.len() {
if index + 1 == self.len { self.stdout.push(c);
if self.counting {
self.column_number += 1;
if self.column_number == self.inner_size.0 + 1 {
self.column_number = 0;
self.number_lines += 1;
}
}
self.len += 1;
None None
} else { } else {
self.stdout.replace_range(index..index + 1, &c.to_string());
Some(index + 1) Some(index + 1)
} }
} }