Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strip end of line CR from show_source #1037

Open
YO4 opened this issue Nov 21, 2024 · 0 comments
Open

strip end of line CR from show_source #1037

YO4 opened this issue Nov 21, 2024 · 0 comments

Comments

@YO4
Copy link
Contributor

YO4 commented Nov 21, 2024

Description

The ruby parser considers CR to be a whitespace character, but IRB does not seem to do that.
This may result in an extra ^M at the end of a line when viewing the source from IRB.

How to reproduce

Save the following source code in CRLF newline on Windows and execute it on WSL.

def desc
  "this file has CRLF newline"
end
binding.irb
$ ruby /mnt/r/crlf.rb

From: /mnt/r/crlf.rb @ line 4 :

    1: def desc^M
    2:   "this file has CRLF newline"^M
    3: end^M
 => 4: binding.irb^M

irb(main):001> show_source "desc"

From: /mnt/r/crlf.rb:1

def desc^M
  "this file has CRLF newline"^M
end^M

=> nil
irb(main):002>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant