Repository navigation
fix(ls): respect line_ending in display_grid when using --zero with column formats - #15505
Open
adamvalves wants to merge 3 commits into
Open
adamvalves wants to merge 3 commits into
adamvalves wants to merge 3 commits into
Conversation
…olumn formats When using --zero with -C or -x, lines were terminated by newline instead of NUL because display_grid did not take line_ending into account. Fixes uutils#14774
sylvestre
reviewed
Oct 18, 2026
| LineEnding::Newline => write!(out, "{grid}")?, | ||
| LineEnding::Nul => { | ||
| let grid_str = grid.to_string(); | ||
| let nul_str = grid_str.replace('\n', "\0"); |
Contributor
There was a problem hiding this comment.
this also replaces newlines inside filenames, e.g. 1\ntest-zero with --zero -C (show-control-chars is on with --zero).
could you please only replace the row terminators?
sylvestre
reviewed
Oct 18, 2026
| for opt in ["-C", "-x"] { | ||
| scene | ||
| .ucmd() | ||
| .args(&["--zero", opt, "-w", "80"]) |
Contributor
There was a problem hiding this comment.
please also test with a smaller -w to get several rows, so we check every line ends with \0
sylvestre
reviewed
Oct 18, 2026
| .ucmd() | ||
| .args(&["--zero", opt, "-w", "80"]) | ||
| .succeeds() | ||
| .stdout_only("0-test-zero\t2-test-zero\t3-test-zero\x00"); |
Contributor
There was a problem hiding this comment.
please add the same -C / -x check in the unix block below, with the 1\ntest-zero file
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14774
Summary of changes
config.line_endingtodisplay_gridinFormat::ColumnsandFormat::Across.LineEnding::Nulis active, format grid rows with\0instead of\n.--zerocombined with-Cand-x.