Skip to content

fold: keep zero-width characters after a newline - #15842

Open
MannXo wants to merge 1 commit into
uutils:mainfrom
MannXo:fix/15750-fold-zero-width-after-newline
Open

MannXo wants to merge 1 commit into
uutils:mainfrom
MannXo:fix/15750-fold-zero-width-after-newline

Conversation

@MannXo

@MannXo MannXo commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

In column mode fold dropped zero-width characters (U+200B, joiners, combining marks, a BOM) that came directly after a newline. The loop that attaches zero-width characters to the preceding character ran before the '\n' check, so it consumed them, and the newline branch then emitted the line and continued without pushing those bytes.

The newline check now runs before that loop, so the zero-width characters are handled with the next line as usual.

$ printf 'abc\n\xe2\x80\x8bFrom x\n' | fold | od -c
0000000   a   b   c  \n 342 200 213   F   r   o   m       x  \n

Before, 342 200 213 was missing. -b and -c were not affected.

test_zero_width_after_newline_in_column_mode fails on main.

Closes #15750

This branch has not been deployed

No deployments
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.

fold: drops zero-width characters directly after a newline

1 participant