A virtual terminal buffer for testing terminal output.
Captures all writes, tracks cursor position, and parses ANSI escape sequences
including SGR (Select Graphic Rendition) codes for style tracking.
Asserts a test terminal buffer matches the expected output.
Each element of the expected vector represents a row.
Trailing whitespace is ignored on each line.