Skip to content

Preserve original line endings with preserve_blank_lines - #107

Open
Aschenbath wants to merge 1 commit into
ppannuto:mainfrom
Aschenbath:fix/oss20next-20261125-3592-titlecase-newlines
Open

Aschenbath wants to merge 1 commit into
ppannuto:mainfrom
Aschenbath:fix/oss20next-20261125-3592-titlecase-newlines

Conversation

@Aschenbath

Copy link
Copy Markdown

With preserve_blank_lines=True, each CRLF currently becomes two LF separators, inserting blank lines into Windows text. Capture CRLF, CR and LF as complete separators and reinsert each original separator after casing its line. The default mode continues collapsing blank lines and normalizing line endings as before.

Closes #103. This follows the maintainer's request on the now-closed #104 to preserve the original line-ending bytes rather than normalize them. Thanks to @afonsojanu for the report and earlier fix proposal. The regression tests cover all three newline styles, mixed styles, leading/trailing and consecutive separators, empty input, and the default behavior.

Validation on Windows/Python 3.12.12: the new cases produce 10 failing subtests on the baseline; the full suite passes with both the optional regex backend and the standard-library re fallback (16 tests, one pre-existing skip per backend). Source and wheel builds and git diff --check pass. Other Python versions were not run.

AI assistance: implementation and tests were developed with OpenAI Codex; all reported checks were executed.

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.

preserve_blank_lines=True counts each CRLF as two line breaks

1 participant