- Circular Buffer for Scrollback: Use a circular
buffer to avoid memory copies when scrolling
- Dirty Rectangle Tracking: Only redraw changed
regions of the screen
- Attribute Packing: Pack cell attributes into a
single byte
- Unicode Handling: Use UTF-8 for input, store as
codepoints internally
5.3 Memory Constraints
- Maximum terminal size: 80x60 (4800 cells)
- Maximum scrollback: 1000 lines (4.8M cells worst case)
- With attribute packing: ~8 bytes per cell = 38.4KB for 80x60 +
3.84MB scrollback
- Mitigation: Limit scrollback to 256 lines (983KB)
or use compression