Skip to content

Normalize line endings with a precompiled pattern - #408

Merged
tsegismont merged 1 commit into
eclipse-vertx:masterfrom
tsegismont:improve-line-break-conversion
Nov 30, 2026
Merged

tsegismont merged 1 commit into
eclipse-vertx:masterfrom
tsegismont:improve-line-break-conversion

Conversation

@tsegismont

Copy link
Copy Markdown
Member

The pattern matches CRLF, CR and LF atomically, which makes the conversion idempotent: content that already contains the local line endings, for example when a generator uses println or embeds the system line separator, is normalized instead of being corrupted with doubled carriage returns.

The no-op fast path for LF systems is removed: it was only correct under the assumption that generators never emit the platform line separator, which cannot be guaranteed for the render() SPI.

The pattern matches CRLF, CR and LF atomically, which makes the
conversion idempotent: content that already contains the local line
endings, for example when a generator uses println or embeds the
system line separator, is normalized instead of being corrupted with
doubled carriage returns.

The no-op fast path for LF systems is removed: it was only correct
under the assumption that generators never emit the platform line
separator, which cannot be guaranteed for the render() SPI.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
@tsegismont
tsegismont merged commit bb7d1bf into eclipse-vertx:master Nov 30, 2026
5 checks passed
@tsegismont
tsegismont deleted the improve-line-break-conversion branch November 30, 2026 18:00
tsegismont added a commit that referenced this pull request Nov 30, 2026
The pattern matches CRLF, CR and LF atomically, which makes the
conversion idempotent: content that already contains the local line
endings, for example when a generator uses println or embeds the
system line separator, is normalized instead of being corrupted with
doubled carriage returns.

The no-op fast path for LF systems is removed: it was only correct
under the assumption that generators never emit the platform line
separator, which cannot be guaranteed for the render() SPI.


(cherry picked from commit bb7d1bf)

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
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.

1 participant