Remove term_width from Printer, its options owns it.

This commit is contained in:
Connor Kuehl 2018-05-08 12:51:52 -07:00 committed by David Peter
parent 7dc7133b3c
commit 49223eed06

View file

@ -10,7 +10,6 @@ const PANEL_WIDTH: usize = 7;
pub struct Printer<'a> {
handle: &'a mut Write,
colors: Colors,
term_width: usize,
options: &'a Options<'a>,
pub line_changes: Option<LineChanges>,
}
@ -26,7 +25,6 @@ impl<'a> Printer<'a> {
Printer {
handle,
colors,
term_width: options.term_width,
options,
line_changes: None,
}
@ -137,7 +135,7 @@ impl<'a> Printer<'a> {
}
fn print_horizontal_line(&mut self, grid_char: char) -> Result<()> {
let hline = "".repeat(self.term_width - (PANEL_WIDTH + 1));
let hline = "".repeat(self.options.term_width - (PANEL_WIDTH + 1));
let hline = format!("{}{}{}", "".repeat(PANEL_WIDTH), grid_char, hline);
writeln!(self.handle, "{}", self.colors.grid.paint(hline))?;