Skip to content

Commit

Permalink
[ruby/reline] Show all lines higher than the screen when finished
Browse files Browse the repository at this point in the history
On Unix-like OSes, logs prior to the screen are not editable. When the code
is higher than the screen, the code is only shown on the screen until input
is finished, but when it is finished, all lines are outputted.

ruby/reline@8cd9132a39
  • Loading branch information
aycabta committed Feb 6, 2021
1 parent 03523fd commit bd0f8b3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/reline/line_editor.rb
Expand Up @@ -388,6 +388,19 @@ def rerender
@cleared = false
return
end
if @is_multiline and finished? and @scroll_partial_screen
# Re-output all code higher than the screen when finished.
Reline::IOGate.move_cursor_up(@first_line_started_from + @started_from - @scroll_partial_screen)
Reline::IOGate.move_cursor_column(0)
@scroll_partial_screen = nil
prompt, prompt_width, prompt_list = check_multiline_prompt(whole_lines, prompt)
modify_lines(whole_lines).each_with_index do |line, index|
@output.write "#{prompt_list ? prompt_list[index] : prompt}#{line}\n"
Reline::IOGate.erase_after_cursor
end
@output.flush
return
end
new_highest_in_this = calculate_height_by_width(prompt_width + calculate_width(@line.nil? ? '' : @line))
# FIXME: end of logical line sometimes breaks
rendered = false
Expand Down

0 comments on commit bd0f8b3

Please sign in to comment.