Skip to content

ls: avoid leading quote-alignment space for colored names#12433

Open
paolo-losi wants to merge 1 commit into
uutils:mainfrom
paolo-losi:fix-ls-color-quoted-leading-space
Open

ls: avoid leading quote-alignment space for colored names#12433
paolo-losi wants to merge 1 commit into
uutils:mainfrom
paolo-losi:fix-ls-color-quoted-leading-space

Conversation

@paolo-losi
Copy link
Copy Markdown

Summary

  • Strip leading ANSI CSI sequences before checking whether a displayed name visibly starts with a quote.
  • Use the same quote-prefix predicate for column and long-format quote alignment.
  • Add regression coverage for --color=always with quoted names in both column and long output.

Fixes #12432.

Tests

cargo fmt --check
cargo test --test tests test_ls_color_does_not_make_quoted_names_align_as_unquoted
cargo test --test tests test_ls_align_unquoted
cargo test --test tests test_ls_color

When color is enabled, displayed names can start with ANSI escape sequences before their visible quote. Strip leading ANSI sequences before deciding whether GNU-style quote alignment needs to add a leading space.\n\nFixes uutils#12432.
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cut/cut-huge-range is now passing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ls: --color=always adds a leading space before first entry on each output line

1 participant