diff options
author | aycabta <aycabta@gmail.com> | 2019-06-16 14:46:22 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-06-16 14:46:28 +0900 |
commit | 2fb1564c02899c73519164ddf3f2430dfbc8f3d6 (patch) | |
tree | a214d8e8730d08e3fd6f9ff9109a9abc0686fc52 /lib/irb/ruby-lex.rb | |
parent | 17e6536fe0c6a7d213f500827346cacc210c536e (diff) | |
download | ruby-2fb1564c02899c73519164ddf3f2430dfbc8f3d6.tar.gz |
Implement line_no correctly
Diffstat (limited to 'lib/irb/ruby-lex.rb')
-rw-r--r-- | lib/irb/ruby-lex.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 2c2dfd850a..5f138701ef 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -42,13 +42,13 @@ class RubyLex end end if @io.respond_to?(:dynamic_prompt) - @io.dynamic_prompt do |lines, base_line_no| + @io.dynamic_prompt do |lines| lines << '' if lines.empty? result = [] lines.each_index { |i| c = lines[0..i].map{ |l| l + "\n" }.join ltype, indent, continue, code_block_open = check_state(c) - result << @prompt.call(ltype, indent, continue, base_line_no + i) + result << @prompt.call(ltype, indent, continue, @line_no + i) } result end @@ -104,7 +104,7 @@ class RubyLex unless l = lex throw :TERM_INPUT if @line == '' else - @line_no += 1 + @line_no += l.count("\n") next if l == "\n" @line.concat l if @code_block_open or @ltype or @continue or @indent > 0 |