Skip to content

Preserve CRLF boundaries when deleting comments - #3135

Merged
soutaro merged 2 commits into
ruby:masterfrom
OskarEichler:codex/rewriter-line-endings
Sep 7, 2026
Merged

Preserve CRLF boundaries when deleting comments#3135
soutaro merged 2 commits into
ruby:masterfrom
OskarEichler:codex/rewriter-line-endings

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

Rewriter#delete_comment currently assumes every comment line ends with exactly one byte. That removes LF correctly, but removes only the carriage return from CRLF input and leaves a blank LF line behind. It can also extend one byte past a comment at EOF.

This change advances over the actual optional carriage-return and newline bytes instead of adding one unconditionally.

Verification

  • external LF, CRLF, and comment-at-EOF boundary models
  • Rewriter tests: 20/20
  • RDoc annotator tests: 10 tests / 13 assertions
  • complete signature validation and native extension compilation
  • release-based gem build/install: 568 files; native parser, schemas, and rewrite behavior pass

The behavior for ordinary LF comments remains unchanged.

@soutaro soutaro self-assigned this Sep 7, 2026
@soutaro
soutaro enabled auto-merge September 7, 2026 07:58
@soutaro
soutaro added this pull request to the merge queue Sep 7, 2026
Merged via the queue into ruby:master with commit 33c1624 Sep 7, 2026
24 checks passed
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