Skip to content

Commit 3a7019b

Browse files
committed
Reset @rest_height when clear screen
1 parent 1f21280 commit 3a7019b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/reline/line_editor.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ def just_move_cursor
813813
end
814814
move_cursor_up(back)
815815
move_cursor_down(@first_line_started_from + @started_from)
816+
@rest_height = (Reline::IOGate.get_screen_size.first - 1) - Reline::IOGate.cursor_pos.y
816817
Reline::IOGate.move_cursor_column((prompt_width + @cursor) % @screen_size.last)
817818
end
818819

test/reline/yamatanooroti/test_rendering.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,17 @@ def test_dynamic_prompt_returns_empty
719719
EOC
720720
end
721721

722+
def test_reset_rest_height_when_clear_screen
723+
start_terminal(5, 20, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl}, startup_message: 'Multiline REPL.')
724+
write("\n\n\n\C-l3\n")
725+
close
726+
assert_screen(<<~EOC)
727+
prompt> 3
728+
=> 3
729+
prompt>
730+
EOC
731+
end
732+
722733
private def write_inputrc(content)
723734
File.open(@inputrc_file, 'w') do |f|
724735
f.write content

0 commit comments

Comments
 (0)