Git · ChangesList: line counts are optional, so binary files and folders show none

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 22:55:43 -04:00
1 parent 490b0220f6
commit 4f8f3bd4c4
3 files changed
+11 -10

No files matched your search

+5 -5
View File
@@ -21,8 +21,8 @@ use crate::{
pub struct Changed {
pub path: SharedString,
pub status: GitStatus,
pub added: usize,
pub removed: usize,
/// Added and removed; None when not counted, as for a binary file or a folder.
pub lines: Option<(usize, usize)>,
}
/// What a changes list asks for a file.
@@ -234,10 +234,10 @@ impl ChangesList {
},
),
)
.child(
.children(file.lines.map(|(added, removed)| {
tabular(div().flex_none().text_color(colors.fg_subtle))
.child(format!("+{} −{}", file.added, file.removed)),
)
.child(format!("+{added} −{removed}"))
}))
.into_any_element()
}