Method: TTY::Reader#clear_display
- Defined in:
- lib/tty/reader.rb
#clear_display(line, screen_width) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Clear display for the current line input
Handles clearing input that is longer than the current terminal width which allows copy & pasting long strings.
343 344 345 346 347 348 349 350 |
# File 'lib/tty/reader.rb', line 343 def clear_display(line, screen_width) total_lines = count_screen_lines(line.size, screen_width) current_line = count_screen_lines(line.prompt_size + line.cursor, screen_width) lines_down = total_lines - current_line output.print(cursor.down(lines_down)) unless lines_down.zero? output.print(cursor.clear_lines(total_lines)) end |