diff options
Diffstat (limited to 'src/delta.rs')
-rw-r--r-- | src/delta.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/delta.rs b/src/delta.rs index d7724802..ac45ed0f 100644 --- a/src/delta.rs +++ b/src/delta.rs @@ -327,7 +327,6 @@ fn handle_generic_file_meta_header_line( raw_line: &str, config: &Config, ) -> std::io::Result<()> { - // FIXME: this may be able to be refactored by moving to should_handle. if config.file_style.is_omitted && !config.color_only { return Ok(()); } @@ -434,7 +433,7 @@ fn handle_hunk_header_line( }; let (raw_code_fragment, line_numbers) = parse::parse_hunk_header(&line); // Emit the hunk header, with any requested decoration - if config.hunk_header_style.is_raw { + if config.hunk_header_style.is_raw || config.color_only { if config.hunk_header_style.decoration_style != DecorationStyle::NoDecoration { writeln!(painter.writer)?; } @@ -491,7 +490,12 @@ fn handle_hunk_header_line( painter .line_numbers_data .initialize_hunk(line_numbers, plus_file.to_string()); - } else if config.line_numbers_show_first_line_number && !config.hunk_header_style.is_raw { + } else if config.line_numbers_show_first_line_number + && !config.hunk_header_style.is_raw + && !config.color_only + { + // With raw mode or color-only mode, + // we should prevent the output from creating new line for printing line number let plus_line_number = line_numbers[line_numbers.len() - 1].0; let formatted_plus_line_number = if config.hyperlinks { features::hyperlinks::format_osc8_file_hyperlink( |