@@ -22,21 +22,19 @@ pub struct BufferComponent<'a> {
23impl BufferComponent<'_> {
23impl BufferComponent<'_> {
24 pub fn render(&self) {
24 pub fn render(&self) {
25− let mut line_count = 0;
26− for line in &self.contents {
25+ for (n, line) in self.contents.iter().enumerate() {
29 SetForegroundColor(Color::DarkCyan),
28 SetForegroundColor(Color::DarkCyan),
30− cursor::MoveTo(self.x, self.y + line_count),
29+ cursor::MoveTo(self.x, self.y + n as u16),
31− Print((line_count + 1).to_string())
30+ Print((n + 1).to_string())
35 SetForegroundColor(Color::Reset),
34 SetForegroundColor(Color::Reset),
36− cursor::MoveTo(self.x + 2, self.y + line_count),
35+ cursor::MoveTo(self.x + 2, self.y + n as u16),
37 Print(line)
36 Print(line)
@@ -129,7 +127,6 @@ impl Editor {
130 Some(Ok(_)) => {
128 Some(Ok(_)) => {
131 // unhandled event
129 // unhandled event
134 Some(Err(x)) => panic!(x),
131 Some(Err(x)) => panic!(x),
135 None => break,
132 None => break,