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

Remove instance variable @first_char #717

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

tompng
Copy link
Member

@tompng tompng commented Jun 5, 2024

When Reline reads EOF, Reline.readline should return nil if and only if input is empty.

Readline

$ printf "a\b" | ruby -rreadline -e "p Readline.readline"
nil
$ printf "" | ruby -rreadline -e "p Readline.readline" 
nil
$ printf "a" | ruby -rreadline -e "p Readline.readline" 
a
"a"

Reline

$ printf "" | ruby -Ilib -rreline -e "p Reline.readline" 
nil
$ printf "a\b" | ruby -Ilib -rreline -e "p Reline.readline"
nil # it was ""

We don't need @first_char. We just need current_input.empty? check.

When Reline reads EOF, Reline.readline should return nil if and only if input is empty
@tompng tompng merged commit cc74b36 into ruby:master Jun 6, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Jun 6, 2024
(ruby/reline#717)

When Reline reads EOF, Reline.readline should return nil if and only if input is empty

ruby/reline@cc74b3686a
@tompng tompng deleted the remove_useless_first_char branch June 6, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants