Skip to content

Commit cad4de6

Browse files
committed
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.
1 parent 53ff2b0 commit cad4de6

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

lib/reline/line_editor.rb

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -676,17 +676,13 @@ def just_move_cursor
676676
Reline::IOGate.move_cursor_column(0)
677677
if line.nil?
678678
if calculate_width(visual_lines[index - 1], true) == Reline::IOGate.get_screen_size.last
679-
# reaches the end of line
680-
if Reline::IOGate.win?
681-
# A newline is automatically inserted if a character is rendered at
682-
# eol on command prompt.
683-
else
684-
# When the cursor is at the end of the line and erases characters
685-
# after the cursor, some terminals delete the character at the
686-
# cursor position.
687-
move_cursor_down(1)
688-
Reline::IOGate.move_cursor_column(0)
689-
end
679+
# Reaches the end of line.
680+
#
681+
# When the cursor is at the end of the line and erases characters
682+
# after the cursor, some terminals delete the character at the
683+
# cursor position.
684+
move_cursor_down(1)
685+
Reline::IOGate.move_cursor_column(0)
690686
else
691687
Reline::IOGate.erase_after_cursor
692688
move_cursor_down(1)
@@ -695,10 +691,6 @@ def just_move_cursor
695691
next
696692
end
697693
@output.write line
698-
if Reline::IOGate.win? and calculate_width(line, true) == Reline::IOGate.get_screen_size.last
699-
# A newline is automatically inserted if a character is rendered at eol on command prompt.
700-
@rest_height -= 1 if @rest_height > 0
701-
end
702694
@output.flush
703695
if @first_prompt
704696
@first_prompt = false

0 commit comments

Comments
 (0)