diff options
author | tomoya ishida <tomoyapenguin@gmail.com> | 2023-01-03 04:25:07 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-01-02 19:25:11 +0000 |
commit | 34f8ca1714a91e4e051ef80f22df2d0e5e0acfae (patch) | |
tree | 49f02e987d273b90399ab2c66dc61f21b9342e3d /lib/irb/ruby-lex.rb | |
parent | 5be0d42d2c4dc765230c76738289560f9ee37f09 (diff) |
[ruby/irb] Fix prompt and code mismatch
(https://github.com/ruby/irb/pull/386)
* fix prompt and code mismatch
* Add test for prompt and code mismatch bug
https://github.com/ruby/irb/commit/a5765d8177
Co-authored-by: Stan Lo <stan001212@gmail.com>
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r-- | lib/irb/ruby-lex.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 04d9bceb07..c3171f486c 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -96,7 +96,8 @@ class RubyLex if t.tok.include?("\n") t_str = t.tok t_str.each_line("\n") do |s| - code << s << "\n" + code << s + next unless s.include?("\n") ltype, indent, continue, code_block_open = check_state(code, partial_tokens, context: context) result << @prompt.call(ltype, indent, continue || code_block_open, @line_no + line_num_offset) line_num_offset += 1 |