diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-12-27 18:19:05 +0000 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-12-27 21:50:22 +0000 |
commit | f680b51646750adb9f6a9977ffb6b34dcb31801f (patch) | |
tree | ff1c0a7c5b7a09e29bd989bf353a140129662e38 /src/hunk_header.rs | |
parent | 38ed1fd07df482a26a7968639669d0191c7ae3e2 (diff) |
Simplify preparation of hunk header code fragment
Diffstat (limited to 'src/hunk_header.rs')
-rw-r--r-- | src/hunk_header.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/hunk_header.rs b/src/hunk_header.rs index ec4db03a..abf042ca 100644 --- a/src/hunk_header.rs +++ b/src/hunk_header.rs @@ -75,16 +75,12 @@ fn _write_hunk_header( config: &Config, ) -> std::io::Result<()> { let (mut draw_fn, _, decoration_ansi_term_style) = _get_draw_fn(config); - // Adjust the hunk-header-line before paint_lines. - // However in the case of color_only mode, - // we'll just use raw_line because we can't change raw_line structure. let line = if config.color_only { format!(" {}", &line) + } else if !raw_code_fragment.is_empty() { + format!("{} ", raw_code_fragment) } else { - match painter.prepare(&raw_code_fragment, false) { - s if !s.is_empty() => format!("{} ", s), - s => s, - } + "".to_string() }; // Add a blank line below the hunk-header-line for readability, unless |