summaryrefslogtreecommitdiffstats
path: root/src/config.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-17 09:34:44 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-17 15:07:56 -0400
commitc2bf4cd2ec0c947f1a3651a66678dd55f3c9c7a3 (patch)
tree0cf784142dccc25dd72f9e96a3d1934927417bf7 /src/config.rs
parent7bea5722dfcca915a241b15ec0d4d8729e81565a (diff)
Highlight whitespace errors
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs
index 794acc7d..e05d7b8c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -72,6 +72,7 @@ pub struct Config {
pub tab_width: usize,
pub true_color: bool,
pub tokenization_regex: Regex,
+ pub whitespace_error_style: Style,
pub zero_style: Style,
}
@@ -215,6 +216,7 @@ impl From<cli::Opt> for Config {
plus_emph_style,
plus_non_emph_style,
plus_empty_line_marker_style,
+ whitespace_error_style,
) = make_hunk_styles(&opt, is_light_mode, true_color);
let (commit_style, file_style, hunk_header_style) =
@@ -300,6 +302,7 @@ impl From<cli::Opt> for Config {
tab_width: opt.tab_width,
tokenization_regex,
true_color,
+ whitespace_error_style,
zero_style,
}
}
@@ -319,6 +322,7 @@ fn make_hunk_styles<'a>(
Style,
Style,
Style,
+ Style,
) {
let minus_style = Style::from_str(
&opt.minus_style,
@@ -416,6 +420,15 @@ fn make_hunk_styles<'a>(
false,
);
+ let whitespace_error_style = Style::from_str(
+ &opt.whitespace_error_style,
+ None,
+ None,
+ None,
+ true_color,
+ false,
+ );
+
(
minus_style,
minus_emph_style,
@@ -426,6 +439,7 @@ fn make_hunk_styles<'a>(
plus_emph_style,
plus_non_emph_style,
plus_empty_line_marker_style,
+ whitespace_error_style,
)
}