Skip to content

Commit 0a77f75

Browse files
committed
Fix bug infinite loop when pasting multilines fo code in Ruby 2.6
Fix bug infinite loop when pasting multilines fo code in Ruby 2.6. This is not reproduced in Ruby 2.7. Changes added in https://github.com/ruby/irb/pull/242/files#diff-612b926e42ed78aed1a889ac1944f7d22229b3a489cc08f837a7f75eca3d3399R155 are also reflected in Ruby 2.6.
1 parent bd597bc commit 0a77f75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/irb/ruby-lex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def self.ripper_lex_without_warning(code, context: nil)
165165
end
166166
end
167167
else
168-
tokens = lexer.parse
168+
tokens = lexer.parse.reject { |it| it.pos.first == 0 }
169169
end
170170
end
171171
tokens

0 commit comments

Comments
 (0)