summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-01-14 08:56:58 +0900
committeraycabta <aycabta@gmail.com>2021-01-18 02:09:43 +0900
commit05df7e0d4a09eaacb91388f32ef557d1d5fbe082 (patch)
treedb8504d6fd5e5ac52d2900b9a2ea0f0eb1ede837
parentf3156e457d75bdcb76793e32ed5457e4157e4cf7 (diff)
[ruby/reline] Support for change in Windows-specific behavior at eol
The behavior of automatically moving the cursor to the next line when displaying a char at the eol on Windows suddenly disappeared. https://github.com/ruby/reline/commit/cad4de6ee8
-rw-r--r--lib/reline/line_editor.rb22
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 3a2e6c8f2c..92ea42fffb 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -676,17 +676,13 @@ class Reline::LineEditor
Reline::IOGate.move_cursor_column(0)
if line.nil?
if calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last
- # reaches the end of line
- if Reline::IOGate.win?
- # A newline is automatically inserted if a character is rendered at
- # eol on command prompt.
- else
- # When the cursor is at the end of the line and erases characters
- # after the cursor, some terminals delete the character at the
- # cursor position.
- move_cursor_down(1)
- Reline::IOGate.move_cursor_column(0)
- end
+ # Reaches the end of line.
+ #
+ # When the cursor is at the end of the line and erases characters
+ # after the cursor, some terminals delete the character at the
+ # cursor position.
+ move_cursor_down(1)
+ Reline::IOGate.move_cursor_column(0)
else
Reline::IOGate.erase_after_cursor
move_cursor_down(1)
@@ -695,10 +691,6 @@ class Reline::LineEditor
next
end
@output.write line
- if Reline::IOGate.win? and calculate_width(line, true) == Reline::IOGate.get_screen_size.last
- # A newline is automatically inserted if a character is rendered at eol on command prompt.
- @rest_height -= 1 if @rest_height > 0
- end
@output.flush
if @first_prompt
@first_prompt = false