mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[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.
cad4de6ee8
This commit is contained in:
parent
f3156e457d
commit
05df7e0d4a
1 changed files with 7 additions and 15 deletions
|
@ -676,17 +676,13 @@ 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?
|
#
|
||||||
# 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
|
# When the cursor is at the end of the line and erases characters
|
||||||
# after the cursor, some terminals delete the character at the
|
# after the cursor, some terminals delete the character at the
|
||||||
# cursor position.
|
# cursor position.
|
||||||
move_cursor_down(1)
|
move_cursor_down(1)
|
||||||
Reline::IOGate.move_cursor_column(0)
|
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)
|
||||||
|
@ -695,10 +691,6 @@ 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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue