@@ -16,6 +16,7 @@ pub struct Printer<'a> {
1616 config: &'a Config<'a>,
1717 decorations: Vec<Box<Decoration>>,
1818 panel_width: usize,
19+ line_number: usize,
1920 pub line_changes: Option<LineChanges>,
2021}
2122
@@ -64,6 +65,7 @@ impl<'a> Printer<'a> {
6465 colors,
6566 config,
6667 decorations,
68+ line_number: 0,
6769 line_changes: None,
6870 }
6971 }
@@ -108,11 +110,8 @@ impl<'a> Printer<'a> {
108110 }
109111 }
110112
111− pub fn print_line(
112− &mut self,
113− line_number: usize,
114− regions: &[(highlighting::Style, &str)],
115− ) -> Result<()> {
113+ pub fn print_line(&mut self, regions: &[(highlighting::Style, &str)]) -> Result<()> {
114+ self.line_number += 1;
116115 let mut cursor: usize = 0;
117116 let mut cursor_max: usize = self.config.term_width;
118117 let mut panel_wrap: Option<String> = None;
@@ -122,7 +121,7 @@ impl<'a> Printer<'a> {
122121 let decorations = self
123122 .decorations
124123 .iter()
125− .map(|ref d| d.generate(line_number, false, self))
124+ .map(|ref d| d.generate(self.line_number, false, self))
126125 .collect::<Vec<_>>();
127126
128127 for deco in decorations {
@@ -184,7 +183,7 @@ impl<'a> Printer<'a> {
184183 "{} ",
185184 self.decorations
186185 .iter()
187− .map(|ref d| d.generate(line_number, true, self).text)
186+ .map(|ref d| d.generate(self.line_number, true, self).text)
188187 .collect::<Vec<String>>()
189188 .join(" ")
190189 ))