fold:Add support for -c short option and fix character mode tab handling#10530
Merged
ChrisDryden merged 1 commit intouutils:mainfrom Jan 28, 2026
Merged
fold:Add support for -c short option and fix character mode tab handling#10530ChrisDryden merged 1 commit intouutils:mainfrom
ChrisDryden merged 1 commit intouutils:mainfrom
Conversation
This commit adds the `-c` short option for the `--characters` flag and fixes tab handling in character mode. Previously, tabs were only handled in column mode, but now they are properly processed in both character and column modes. The character mode now correctly advances to the next tab stop, handles carriage returns, and backspace characters. Tests have been added to verify the new functionality.
|
GNU testsuite comparison: |
Collaborator
|
This is a blocker for the write-error gnu test, adding this functionality should unblock being able to get that test to pass |
ChrisDryden
reviewed
Jan 28, 2026
| *ctx.col_count = ctx.col_count.saturating_sub(1); | ||
| idx += 1; | ||
| } | ||
| TAB if ctx.mode == WidthMode::Columns => { |
Collaborator
There was a problem hiding this comment.
Was doing some research to see why this wasn't included in the original implementation and it appears that this was only introduced in 9.7
Collaborator
|
Thanks! |
Collaborator
|
Darn, I'm realizing now that the change can be made much less verbose now because the Columns now matches identically the code in Characters, I should have caught that before but I will make a follow up. |
This was referenced Jan 28, 2026
Collaborator
|
Created this as a follow up: #10533 |
oech3
pushed a commit
to oech3/coreutils
that referenced
this pull request
Jan 29, 2026
…utils#10530) This commit adds the `-c` short option for the `--characters` flag and fixes tab handling in character mode. Previously, tabs were only handled in column mode, but now they are properly processed in both character and column modes. The character mode now correctly advances to the next tab stop, handles carriage returns, and backspace characters. Tests have been added to verify the new functionality.
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.
Summary
This commit adds the
-cshort option for the--charactersflag and fixes tab handling in character mode. Previously, tabs were only handled in column mode, but now they are properly processed in both character and column modes. The character mode now correctly advances to the next tab stop, handles carriage returns, and backspace characters. Tests have been added to verify the new functionality.related
#10270