mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-29 00:22:26 +01:00
Only leave space for git diff markers if any line is modified (#3406)
Previously, setting `--style=changes` would always print a 2-space indent, even if the file was unmodified. This changes the style to only print an indent if there is at least one +/- git marker in the sidebar.
This commit is contained in:
@@ -227,7 +227,9 @@ impl<'a> InteractivePrinter<'a> {
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
{
|
||||
if config.style_components.changes() {
|
||||
if config.style_components.changes()
|
||||
&& line_changes.as_ref().is_some_and(|c| !c.is_empty())
|
||||
{
|
||||
decorations.push(Box::new(LineChangesDecoration::new(&colors)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user