@@ -80,7 +80,7 @@ pub struct InteractivePrinter<'a> {
8080 pub line_changes: Option<LineChanges>,
8181 highlighter: Option<HighlightLines<'a>>,
8282 syntax_set: &'a SyntaxSet,
83− background_highlight: Option<Color>,
83+ background_color_highlight: Option<Color>,
8484}
8585
8686impl<'a> InteractivePrinter<'a> {
@@ -92,7 +92,7 @@ impl<'a> InteractivePrinter<'a> {
9292 ) -> Self {
9393 let theme = assets.get_theme(&config.theme);
9494
95− let background_highlight = theme.settings.line_highlight;
95+ let background_color_highlight = theme.settings.line_highlight;
9696
9797 let colors = if config.colored_output {
9898 Colors::colored(theme, config.true_color)
@@ -160,7 +160,7 @@ impl<'a> InteractivePrinter<'a> {
160160 line_changes,
161161 highlighter,
162162 syntax_set: &assets.syntax_set,
163− background_highlight,
163+ background_color_highlight,
164164 }
165165 }
166166
@@ -292,6 +292,19 @@ impl<'a> Printer for InteractivePrinter<'a> {
292292 let mut cursor_total: usize = 0;
293293 let mut panel_wrap: Option<String> = None;
294294
295+ // Line highlighting
296+ let background_color = if self
297+ .config
298+ .highlight_lines
299+ .iter()
300+ .find(|&&l| l == line_number)
301+ .is_some()
302+ {
303+ self.background_color_highlight
304+ } else {
305+ None
306+ };
307+
295308 // Line decorations.
296309 if self.panel_width > 0 {
297310 let decorations = self
@@ -306,12 +319,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
306319 }
307320 }
308321
309− // Line highlighting
310− let background = self.config.highlight_line
311− .filter(|line| *line == line_number)
312− .map(|_| self.background_highlight)
313− .unwrap();
314−
315322 // Line contents.
316323 if self.config.output_wrap == OutputWrap::None {
317324 let true_color = self.config.true_color;
@@ -324,7 +331,14 @@ impl<'a> Printer for InteractivePrinter<'a> {
324331 write!(
325332 handle,
326333 "{}",
327− as_terminal_escaped(style, text_trimmed, true_color, colored_output, italics, background)
334+ as_terminal_escaped(
335+ style,
336+ text_trimmed,
337+ true_color,
338+ colored_output,
339+ italics,
340+ background_color
341+ )
328342 )?;
329343 write!(handle, "{}", &text[text_trimmed.len()..])?;
330344 }
@@ -382,7 +396,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
382396 self.config.true_color,
383397 self.config.colored_output,
384398 self.config.use_italic_text,
385− background
399+ background_color
386400 )
387401 )?;
388402 break;
@@ -423,7 +437,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
423437 self.config.true_color,
424438 self.config.colored_output,
425439 self.config.use_italic_text,
426− background
440+ background_color
427441 ),
428442 panel_wrap.clone().unwrap()
429443 )?;