on master help sign in
Remove term_width from Printer, its options owns it.
49223eeConnor Kuehl
src/printer.rs+1−3
@@ -10,7 +10,6 @@ const PANEL_WIDTH: usize = 7;
10pub struct Printer<'a> {
10pub struct Printer<'a> {
11 handle: &'a mut Write,
11 handle: &'a mut Write,
12 colors: Colors,
12 colors: Colors,
13− term_width: usize,
14 options: &'a Options<'a>,
13 options: &'a Options<'a>,
15 pub line_changes: Option<LineChanges>,
14 pub line_changes: Option<LineChanges>,
16}
15}
@@ -26,7 +25,6 @@ impl<'a> Printer<'a> {
26 Printer {
25 Printer {
27 handle,
26 handle,
28 colors,
27 colors,
29− term_width: options.term_width,
30 options,
28 options,
31 line_changes: None,
29 line_changes: None,
32 }
30 }
@@ -137,7 +135,7 @@ impl<'a> Printer<'a> {
137 }
135 }
138
136
139 fn print_horizontal_line(&mut self, grid_char: char) -> Result<()> {
137 fn print_horizontal_line(&mut self, grid_char: char) -> Result<()> {
140− let hline = "─".repeat(self.term_width - (PANEL_WIDTH + 1));
138+ let hline = "─".repeat(self.options.term_width - (PANEL_WIDTH + 1));
141 let hline = format!("{}{}{}", "─".repeat(PANEL_WIDTH), grid_char, hline);
139 let hline = format!("{}{}{}", "─".repeat(PANEL_WIDTH), grid_char, hline);
142
140
143 writeln!(self.handle, "{}", self.colors.grid.paint(hline))?;
141 writeln!(self.handle, "{}", self.colors.grid.paint(hline))?;