From c2c279b5fb8b79d5ce2991682ca6a0c5958f87c3 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Tue, 16 Jun 2020 21:15:56 -0400 Subject: Highlight added/removed empty lines if they would be invisible Thanks @phillipwood --- src/style.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/style.rs') diff --git a/src/style.rs b/src/style.rs index 6b11725f..7e7bea35 100644 --- a/src/style.rs +++ b/src/style.rs @@ -49,6 +49,14 @@ impl Style { } } + pub fn has_background_color(&self) -> bool { + if self.ansi_term_style.is_reverse { + self.ansi_term_style.foreground.is_some() + } else { + self.ansi_term_style.background.is_some() + } + } + /// Construct Style from style and decoration-style strings supplied on command line, together /// with defaults. A style string is a space-separated string containing 0, 1, or 2 colors /// (foreground and then background) and an arbitrary number of style attributes. See `delta -- cgit v1.2.3