diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-06-21 17:12:12 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-06-25 22:27:23 -0400 |
commit | 5adc445ec38142046fc4cc4518e7019fe54f2e35 (patch) | |
tree | 5618fd68d71821795759f5172633ce0a583bb178 /src/delta.rs | |
parent | 4f1e1c7f90a20f8afe0830330e760fdceafc79ca (diff) |
Fix test: --color-only should syntax highlight
Diffstat (limited to 'src/delta.rs')
-rw-r--r-- | src/delta.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/delta.rs b/src/delta.rs index 37a799a4..05180422 100644 --- a/src/delta.rs +++ b/src/delta.rs @@ -83,7 +83,6 @@ where state = State::FileMeta; } else if (state == State::FileMeta || source == Source::DiffUnified) && (line.starts_with("--- ") || line.starts_with("rename from ")) - && should_handle(&State::FileMeta, config) { minus_file = parse::get_file_path_from_file_meta_line(&line, source == Source::GitDiff); if source == Source::DiffUnified { @@ -95,21 +94,21 @@ where &minus_file, )); } - } else if (line.starts_with("+++ ") || line.starts_with("rename to ")) - && should_handle(&State::FileMeta, config) - { + } else if line.starts_with("+++ ") || line.starts_with("rename to ") { 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( &plus_file, )); - painter.emit()?; - handle_file_meta_header_line( - &mut painter, - &minus_file, - &plus_file, - config, - source == Source::DiffUnified, - )?; + if should_handle(&State::FileMeta, config) { + painter.emit()?; + handle_file_meta_header_line( + &mut painter, + &minus_file, + &plus_file, + config, + source == Source::DiffUnified, + )?; + } } else if line.starts_with("@@") { state = State::HunkHeader; painter.set_highlighter(); |