aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-09-11 05:48:59 +0900
committeraycabta <aycabta@gmail.com>2020-09-12 08:35:52 +0900
commitce389ade45f412351d7c91db60eaa5e19fcd8c5f (patch)
treeaaa4abb58aa3099ff0f13d772a7adc8040c981a7 /lib
parent9baf1bd0a444d052aff8963630d11176e34271ef (diff)
downloadruby-ce389ade45f412351d7c91db60eaa5e19fcd8c5f.tar.gz
[ruby/reline] Move cursor to currect vertical pos after rendering a logical line
https://github.com/ruby/reline/commit/9b932df544
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index ede913292f..edea2fa3d7 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -524,12 +524,14 @@ class Reline::LineEditor
end
Reline::IOGate.erase_after_cursor
if with_control
- move_cursor_up(height - 1)
+ # Just after rendring, so the cursor is on the last line.
if finished?
- move_cursor_down(@started_from)
+ Reline::IOGate.move_cursor_column(0)
+ else
+ # Moves up from bottom of lines to the cursor position.
+ move_cursor_up(height - 1 - @started_from)
+ Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
end
- move_cursor_down(@started_from)
- Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
end
height
end