Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2675,20 +2675,10 @@ fn display_grid(
.map(|s| s.to_string_lossy().into_owned())
.collect();

// Determine whether to use tabs for separation based on whether any entry ends with '/'.
// If any entry ends with '/', it indicates that the -F flag is likely used to classify directories.
let use_tabs = names.iter().any(|name| name.ends_with('/'));

let filling = if use_tabs {
Filling::Text("\t".to_string())
} else {
Filling::Spaces(2)
};

let grid = Grid::new(
names,
GridOptions {
filling,
filling: Filling::Spaces(2),
direction,
width: width as usize,
},
Expand Down
4 changes: 2 additions & 2 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4786,7 +4786,7 @@ fn test_ls_subdired_complex() {
}

#[test]
fn test_ls_cf_output_should_be_delimited_by_tab() {
fn test_ls_cf_output_should_be_delimited_by_spaces() {
let (at, mut ucmd) = at_and_ucmd!();

at.mkdir("e");
Expand All @@ -4795,7 +4795,7 @@ fn test_ls_cf_output_should_be_delimited_by_tab() {

ucmd.args(&["-CF", "e"])
.succeeds()
.stdout_is("a2345/\tb/\n");
.stdout_is("a2345/ b/\n");
}

#[cfg(all(unix, feature = "dd"))]
Expand Down
Loading