diff options
author | aycabta <aycabta@gmail.com> | 2019-05-30 18:20:59 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-05-30 18:21:09 +0900 |
commit | fcca39fa73607e6acf2aea00fd8bf746023955dc (patch) | |
tree | 2a9794d27676cb44753fe3c7c8089827a429e9f8 | |
parent | 106843d839cb5779c7e2761b826aea78bd9a7e63 (diff) | |
download | ruby-fcca39fa73607e6acf2aea00fd8bf746023955dc.tar.gz |
Fix strange vertical cursor moving when adding a newline at bottom
-rw-r--r-- | lib/reline/line_editor.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb index e84d087ac1..805053fbff 100644 --- a/lib/reline/line_editor.rb +++ b/lib/reline/line_editor.rb @@ -360,8 +360,12 @@ class Reline::LineEditor back = 0 modify_lines(new_lines).each_with_index do |line, index| height = render_partial(prompt, prompt_width, line, false) - move_cursor_down(1) - back += height + if index < (new_lines.size - 1) + scroll_down(1) + back += height + else + back += height - 1 + end end move_cursor_up(back) if @previous_line_index |