add ; for print support and fix bug print line

This commit is contained in:
rick 2023-04-16 01:04:35 +02:00
parent 7bbda6fa66
commit bec4429c3a
Signed by: Rick
GPG key ID: 5CBE8779CD27BCBA

View file

@ -29,7 +29,7 @@ impl Buffer {
}
pub fn print(&mut self, addr: Address, print_numbers: bool) {
let last_line = self.buffer.len().saturating_sub(1);
let last_line = self.buffer.len();
match addr {
Address::Actual => self.print_line(self.current_line, print_numbers),
Address::Line(l) => self.print_line(l.saturating_sub(1), print_numbers),
@ -38,8 +38,10 @@ impl Buffer {
Address::FromTo(a, b) => self.print_range(a, b, print_numbers),
Address::FromStartTo(a) => self.print_range(0, a, print_numbers),
Address::FromToEnd(a) => self.print_range(a, last_line, print_numbers),
Address::FromActTo(a) => self.print_range(self.current_line, a, print_numbers),
Address::FromActToEnd => self.print_range(self.current_line, last_line, print_numbers),
Address::Null => println!("nul !"),
_ => println!("coucou2"),
_ => println!("pas implémenté"),
}
}