From 66e559d35e5fbd5968571f6b60b2953642043610 Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Sun, 30 Aug 2026 06:26:15 +0200 Subject: [PATCH] Preserve CRLF boundaries when deleting comments --- lib/rbs/rewriter.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rbs/rewriter.rb b/lib/rbs/rewriter.rb index ec1b1d94d2..285c7dc535 100644 --- a/lib/rbs/rewriter.rb +++ b/lib/rbs/rewriter.rb @@ -43,7 +43,9 @@ def replace_comment(comment, content:) def delete_comment(comment) location = comment.location or raise "Comment must have a location" line_start = location.start_pos - location.start_column - line_end = location.end_pos + 1 + line_end = location.end_pos + line_end += 1 if buffer.content[line_end] == "\r" + line_end += 1 if buffer.content[line_end] == "\n" loc = Location.new(buffer, line_start, line_end) rewrite(loc, "") end