diff --git a/lib/rbs/rewriter.rb b/lib/rbs/rewriter.rb index ec1b1d94d..285c7dc53 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