diff options
-rw-r--r-- | lib/irb/ruby-lex.rb | 6 | ||||
-rw-r--r-- | lib/reline/line_editor.rb | 8 |
2 files changed, 7 insertions, 7 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 diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index e87de6ba30..be774a3e06 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -287,7 +287,7 @@ class Reline::LineEditor back = 0 prompt_list = nil if @prompt_proc - prompt_list = @prompt_proc.(whole_lines, 0) + prompt_list = @prompt_proc.(whole_lines) prompt = prompt_list[@line_index] prompt_width = calculate_width(prompt, true) end @@ -318,7 +318,7 @@ class Reline::LineEditor end prompt_list = nil if @prompt_proc - prompt_list = @prompt_proc.(new_lines, 0) + prompt_list = @prompt_proc.(new_lines) prompt = prompt_list[@line_index] prompt_width = calculate_width(prompt, true) end @@ -387,7 +387,7 @@ class Reline::LineEditor new_buffer = whole_lines prompt_list = nil if @prompt_proc - prompt_list = @prompt_proc.(new_buffer, 0) + prompt_list = @prompt_proc.(new_buffer) prompt = prompt_list[@line_index] prompt_width = calculate_width(prompt, true) end @@ -444,7 +444,7 @@ class Reline::LineEditor if @is_multiline prompt_list = nil if @prompt_proc - prompt_list = @prompt_proc.(whole_lines, 0) + prompt_list = @prompt_proc.(whole_lines) prompt = prompt_list[@line_index] prompt_width = calculate_width(prompt, true) end |