aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-05-30 15:04:37 +0900
committeraycabta <aycabta@gmail.com>2019-05-30 15:04:37 +0900
commit90014dddec70219c2da800bf0d4d262bfa99c9a8 (patch)
tree78aaceb5fe5508d7ba60e66f64052dc46715d992
parenteae953ba9ff3302a698115f34893f17bf458d2ea (diff)
downloadruby-90014dddec70219c2da800bf0d4d262bfa99c9a8.tar.gz
Fix broken rendering when the last line is auto-wrapped
-rw-r--r--lib/reline/line_editor.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 1344f52d15..088d220916 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -360,10 +360,8 @@ class Reline::LineEditor
back = 0
modify_lines(new_lines).each_with_index do |line, index|
height = render_partial(prompt, prompt_width, line, false)
- if index < (new_lines.size - 1)
- move_cursor_down(1)
- back += height
- end
+ move_cursor_down(1)
+ back += height
end
move_cursor_up(back)
if @previous_line_index
@@ -380,8 +378,9 @@ class Reline::LineEditor
end
move_cursor_down(@first_line_started_from)
calculate_nearest_cursor
+ @started_from = calculate_height_by_width(@prompt_width + @cursor) - 1
move_cursor_down(@started_from)
- Reline::IOGate.move_cursor_column(prompt_width + @cursor)
+ Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
@highest_in_this = calculate_height_by_width(@prompt_width + @cursor_max)
@previous_line_index = nil
rendered = true
@@ -424,6 +423,7 @@ class Reline::LineEditor
}
end
move_cursor_down(@first_line_started_from)
+ Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
@rerender_all = false
rendered = true
end