Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/uu/sort/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
}

settings.dictionary_order = dictionary_order;
settings.ignore_non_printing = ignore_non_printing;
// -i has no effect when -d is also given, as for key options
settings.ignore_non_printing = ignore_non_printing && !dictionary_order;
settings.ignore_case = ignore_case;

let threads = match matches.get_one::<String>(options::PARALLEL) {
Expand Down
18 changes: 18 additions & 0 deletions tests/by-util/test_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,24 @@ fn test_non_printing_chars() {
.stdout_only("a👦🏻aa\naaaa\n"); // spell-checker:disable-line
}

#[test]
fn test_dictionary_order_overrides_non_printing() {
// -i has no effect with -d, so the tab is kept as a blank
for args in [
&["-d", "-i"][..],
&["-i", "-d"],
&["-di"],
&["-id"],
&["-di", "-k1"],
] {
new_ucmd!()
.args(args)
.pipe_in("\tK\n7\n")
.succeeds()
.stdout_only("\tK\n7\n");
}
}

#[test]
fn test_exponents_positive_general() {
new_ucmd!()
Expand Down
Loading