ScreenParser

A ScreenParser object.

class ansiparser.screen_parser.ScreenParser(screen_height=24, screen_width=80)
put(string: str) None

Add new strings to screen_buffer

parse() None

Remove the current screen_buffer and parse it.

full() bool

If the current parsed screen is full.

clear() None

clear current parsed_screen and index

finished() bool

If the current screen buffer is finished (encountered ‘clear entire screen’).

buffer_empty() bool

if screen_buffer is empty

clear_buffer() None

clear screen_buffer

clear_old_buffer() None

Clear the old (finished) screen_buffer.

get_parsed_screen() list

return underlying current parsed_screen

peek_string() str

Peek at the current buffer; parse the string only and remove all ANSI sequences.

to_formatted_string(peek=False) list[str]

Convert the current parsed_screen to a formatted string. If peek is True, peek at the current buffer and convert it to a formatted string.

to_html(peek=False) list[str]

Convert the current parsed_screen to HTML. If peek is True, peek at the current buffer and convert it to HTML.