Skip to content

fold:Add support for -c short option and fix character mode tab handling#10530

Merged
ChrisDryden merged 1 commit intouutils:mainfrom
mattsu2020:fold_c
Jan 28, 2026
Merged

fold:Add support for -c short option and fix character mode tab handling#10530
ChrisDryden merged 1 commit intouutils:mainfrom
mattsu2020:fold_c

Conversation

@mattsu2020
Copy link
Contributor

@mattsu2020 mattsu2020 commented Jan 28, 2026

Summary

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.

related
#10270

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.
@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@ChrisDryden
Copy link
Collaborator

This is a blocker for the write-error gnu test, adding this functionality should unblock being able to get that test to pass

*ctx.col_count = ctx.col_count.saturating_sub(1);
idx += 1;
}
TAB if ctx.mode == WidthMode::Columns => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@ChrisDryden ChrisDryden merged commit aee49f1 into uutils:main Jan 28, 2026
103 of 129 checks passed
@ChrisDryden
Copy link
Collaborator

Thanks!

@ChrisDryden
Copy link
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.

@ChrisDryden
Copy link
Collaborator

Created this as a follow up: #10533

@mattsu2020 mattsu2020 deleted the fold_c branch January 28, 2026 23:08
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.
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.

2 participants