[ruby/reline] We still need support new and legacy behavior.

Revert "Support for change in Windows-specific behavior at eol"

This reverts commit cad4de6ee841b43f3f0e441626f9415c3eda0f82.

https://github.com/ruby/reline/commit/646587fc2c
This commit is contained in:
Yoshinao Muramatu 2021-02-17 23:28:47 +09:00 committed by aycabta
parent 7aa3bc8403
commit 38cefac7ce

View File

@ -725,13 +725,17 @@ class Reline::LineEditor
Reline::IOGate.move_cursor_column(0) Reline::IOGate.move_cursor_column(0)
if line.nil? if line.nil?
if calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last if calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last
# Reaches the end of line. # reaches the end of line
# if Reline::IOGate.win?
# When the cursor is at the end of the line and erases characters # A newline is automatically inserted if a character is rendered at
# after the cursor, some terminals delete the character at the # eol on command prompt.
# cursor position. else
move_cursor_down(1) # When the cursor is at the end of the line and erases characters
Reline::IOGate.move_cursor_column(0) # after the cursor, some terminals delete the character at the
# cursor position.
move_cursor_down(1)
Reline::IOGate.move_cursor_column(0)
end
else else
Reline::IOGate.erase_after_cursor Reline::IOGate.erase_after_cursor
move_cursor_down(1) move_cursor_down(1)
@ -740,6 +744,10 @@ class Reline::LineEditor
next next
end end
@output.write line @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 @output.flush
if @first_prompt if @first_prompt
@first_prompt = false @first_prompt = false