diff options
| -rw-r--r-- | lib/reline/line_editor.rb | 2 | ||||
| -rw-r--r-- | test/reline/yamatanooroti/test_rendering.rb | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index 84cd8a063e..31640fd743 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -704,8 +704,8 @@ class Reline::LineEditor @highest_in_this = height end move_cursor_up(@started_from) - cursor_up_from_last_line = height - 1 - @started_from @started_from = calculate_height_by_width(prompt_width + @cursor) - 1 + cursor_up_from_last_line = height - 1 - @started_from end if Reline::Unicode::CSI_REGEXP.match?(prompt + line_to_render) @output.write "\e[0m" # clear character decorations diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb index b583f8ddac..22c9316429 100644 --- a/test/reline/yamatanooroti/test_rendering.rb +++ b/test/reline/yamatanooroti/test_rendering.rb @@ -678,6 +678,20 @@ begin EOC end + def test_autowrap_in_the_middle_of_a_line + start_terminal(5, 20, %W{ruby -I#{@pwd}/lib #{@pwd}/bin/multiline_repl}, startup_message: 'Multiline REPL.') + write("def abcdefg; end\C-b\C-b\C-b\C-b\C-b") + %w{h i}.each do |c| + write(c) + end + close + assert_screen(<<~EOC) + Multiline REPL. + prompt> def abcdefgh + i; end + EOC + end + private def write_inputrc(content) File.open(@inputrc_file, 'w') do |f| f.write content |
