Skip to content

Commit

Permalink
We still need support new and legacy behavior.
Browse files Browse the repository at this point in the history
Revert "Support for change in Windows-specific behavior at eol"

This reverts commit cad4de6.
  • Loading branch information
YO4 committed Feb 17, 2021
1 parent b98bc3c commit 646587f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lib/reline/line_editor.rb
Expand Up @@ -725,13 +725,17 @@ def just_move_cursor
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.
#
# 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)
# 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
else
Reline::IOGate.erase_after_cursor
move_cursor_down(1)
Expand All @@ -740,6 +744,10 @@ def just_move_cursor
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
Expand Down

0 comments on commit 646587f

Please sign in to comment.