ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: allow diff stat bar to be one character longer

I think the `+ 1` here came from an old iteration of this feature
where there was a single space before each line.
This commit is contained in:
Martin von Zweigbergk 2023-08-30 16:47:07 -07:00 committed by Martin von Zweigbergk
parent 939528122d
commit 5ce4ed45de
2 changed files with 4 additions and 4 deletions

View file

@ -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 {

View file

@ -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###"