Skip to content

Preserve CRLF boundaries when deleting comments - #3135

Open
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/rewriter-line-endings
Open

Preserve CRLF boundaries when deleting comments#3135
OskarEichler wants to merge 1 commit into
ruby:masterfrom
OskarEichler:codex/rewriter-line-endings

Conversation

@OskarEichler

Copy link
Copy Markdown

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.

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