Skip to content

Commit

Permalink
ls --dired: v9.5 --hyperlink is ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Mar 30, 2024
1 parent 4345173 commit ac662ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,7 @@ impl PathData {
}

fn show_dir_name(path_data: &PathData, out: &mut BufWriter<Stdout>, config: &Config) {
if config.hyperlink {
if config.hyperlink && !config.dired {
let name = escape_name(&path_data.display_name, &config.quoting_style);
let hyperlink = create_hyperlink(&name, path_data);
write!(out, "{}:", hyperlink).unwrap();
Expand Down Expand Up @@ -3148,7 +3148,7 @@ fn display_item_name(
// infer it because the color codes mess up term_grid's width calculation.
let mut width = name.width();

if config.hyperlink {
if config.hyperlink && !config.dired {
name = create_hyperlink(&name, path);
}

Expand Down
15 changes: 15 additions & 0 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3683,6 +3683,21 @@ fn test_ls_dired_implies_long() {
.stdout_contains("//DIRED-OPTIONS// --quoting-style");
}

#[test]
fn test_ls_dired_hyperlink_disabled() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.mkdir("dir");
at.touch("dir/a");
scene
.ucmd()
.arg("--dired")
.arg("--hyperlink")
.arg("-R")
.succeeds()
.stdout_contains(" ./dir:");
}

#[test]
fn test_ls_dired_and_zero_are_incompatible() {
let scene = TestScenario::new(util_name!());
Expand Down

0 comments on commit ac662ad

Please sign in to comment.