diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index a7ee35f3e..c4e6671c1 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -792,8 +792,8 @@ pub fn show_diff_stat( } let display_width = usize::from(ui.term_width().unwrap_or(80)) - 4; // padding - let max_bar_length = display_width - .saturating_sub(max_path_length + " | ".len() + max_diffs.to_string().len() + 1); + let max_bar_length = + display_width.saturating_sub(max_path_length + " | ".len() + max_diffs.to_string().len()); let factor = if max_diffs < max_bar_length { 1.0 } else { diff --git a/cli/tests/test_diff_command.rs b/cli/tests/test_diff_command.rs index e3b6feadb..98b33e124 100644 --- a/cli/tests/test_diff_command.rs +++ b/cli/tests/test_diff_command.rs @@ -809,7 +809,7 @@ fn test_diff_stat_long_name_or_stat() { 1 file changed, 10 insertions(+), 0 deletions(-) "###); insta::assert_snapshot!(get_stat(1, 100), @r###" - a | 100 ++++++++++++++++++++++++++++++++++++++ + a | 100 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+), 0 deletions(-) "###); insta::assert_snapshot!(get_stat(10, 1), @r###" @@ -821,7 +821,7 @@ fn test_diff_stat_long_name_or_stat() { 1 file changed, 10 insertions(+), 0 deletions(-) "###); insta::assert_snapshot!(get_stat(10, 100), @r###" - abcdefghij | 100 +++++++++++++++++++++++++++++ + abcdefghij | 100 ++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+), 0 deletions(-) "###); insta::assert_snapshot!(get_stat(100, 1), @r###"