Skip to content

Remove instance variable @first_char - #717

Merged
tompng merged 1 commit into
ruby:masterfrom
tompng:remove_useless_first_char
Jun 6, 2024
Merged

tompng merged 1 commit into
ruby:masterfrom
tompng:remove_useless_first_char

Conversation

@tompng

@tompng tompng commented Jun 5, 2024 •

Copy link
Copy Markdown
Member

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
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants