diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-08-01 10:37:06 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-08-01 11:38:19 -0400 |
commit | 5f97f327e3c0cae04790114190639cf929ec9810 (patch) | |
tree | a3535029ec25120584f29ac0b7708d34de96fad3 /src/delta.rs | |
parent | c6f66ab8fde78209d395d3502c63da66fae294e0 (diff) |
Add inspect-raw-lines {true,false} option
Fixes #72
Diffstat (limited to 'src/delta.rs')
-rw-r--r-- | src/delta.rs | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/delta.rs b/src/delta.rs index 409c1df6..0599fee0 100644 --- a/src/delta.rs +++ b/src/delta.rs @@ -6,6 +6,7 @@ use bytelines::ByteLines; use console::strip_ansi_codes; use unicode_segmentation::UnicodeSegmentation; +use crate::cli; use crate::config::Config; use crate::draw; use crate::features; @@ -502,13 +503,16 @@ fn handle_hunk_line( if let State::HunkPlus(_) = state { painter.paint_buffered_minus_and_plus_lines(); } - let state = if style::line_has_style_other_than( - raw_line, - [*style::GIT_DEFAULT_MINUS_STYLE, config.git_minus_style].iter(), - ) { - State::HunkMinus(Some(painter.prepare_raw_line(raw_line))) - } else { - State::HunkMinus(None) + let state = match config.inspect_raw_lines { + cli::InspectRawLines::True + if style::line_has_style_other_than( + raw_line, + [*style::GIT_DEFAULT_MINUS_STYLE, config.git_minus_style].iter(), + ) => + { + State::HunkMinus(Some(painter.prepare_raw_line(raw_line))) + } + _ => State::HunkMinus(None), }; painter .minus_lines @@ -516,13 +520,16 @@ fn handle_hunk_line( state } Some('+') => { - let state = if style::line_has_style_other_than( - raw_line, - [*style::GIT_DEFAULT_PLUS_STYLE, config.git_plus_style].iter(), - ) { - State::HunkPlus(Some(painter.prepare_raw_line(raw_line))) - } else { - State::HunkPlus(None) + let state = match config.inspect_raw_lines { + cli::InspectRawLines::True + if style::line_has_style_other_than( + raw_line, + [*style::GIT_DEFAULT_PLUS_STYLE, config.git_plus_style].iter(), + ) => + { + State::HunkPlus(Some(painter.prepare_raw_line(raw_line))) + } + _ => State::HunkPlus(None), }; painter .plus_lines |