summaryrefslogtreecommitdiffstats
path: root/src/delta.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-05-30 13:10:30 -0400
committerDan Davison <dandavison7@gmail.com>2020-05-30 16:55:38 -0400
commit7e65f14cbe2ec9ec42c5e7ebbdf299908afa031e (patch)
treea6c4949f4e8dfadb1a9db91202789c6ff897352d /src/delta.rs
parente0d047f3553de06fb4d345f4839199d8e40f1b79 (diff)
Implement --file-style raw with decoration
`--file-style raw` doesn't have any effect currently (unlike `--hunk-style raw`), but this commit ensures that it doesn't erroneously remove the decoration.
Diffstat (limited to 'src/delta.rs')
-rw-r--r--src/delta.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/delta.rs b/src/delta.rs
index a56b1d21..caed2534 100644
--- a/src/delta.rs
+++ b/src/delta.rs
@@ -83,7 +83,7 @@ where
state = State::FileMeta;
} else if (state == State::FileMeta || source == Source::DiffUnified)
&& (line.starts_with("--- ") || line.starts_with("rename from "))
- && !config.file_style.is_raw
+ && should_handle(&State::FileMeta, config)
{
minus_file = parse::get_file_path_from_file_meta_line(&line, source == Source::GitDiff);
if source == Source::DiffUnified {
@@ -96,7 +96,7 @@ where
));
}
} else if (line.starts_with("+++ ") || line.starts_with("rename to "))
- && !config.file_style.is_raw
+ && should_handle(&State::FileMeta, config)
{
plus_file = parse::get_file_path_from_file_meta_line(&line, source == Source::GitDiff);
painter.set_syntax(parse::get_file_extension_from_file_meta_line_file_path(
@@ -137,7 +137,7 @@ where
state = State::FileMeta;
painter.paint_buffered_lines();
- if !config.file_style.is_raw {
+ if should_handle(&State::FileMeta, config) {
painter.emit()?;
handle_generic_file_meta_header_line(&mut painter, &raw_line, config)?;
continue;
@@ -150,7 +150,7 @@ where
continue;
}
- if state == State::FileMeta && !config.file_style.is_raw {
+ if state == State::FileMeta && should_handle(&State::FileMeta, config) {
// The file metadata section is 4 lines. Skip them under non-plain file-styles.
continue;
} else {