Update Screen Modes
update-screen-modes demonstrates how Terminal::updateScreen() behaves
when you toggle overwrite mode, line buffering, safe margins, and the smart
back buffer. It combines a small status dashboard with a sparse animation
field so the redraw cost and the visual behavior are easy to compare.
This is the best demo to study when you want to understand the practical tradeoffs between clear-and-redraw rendering and smart overwrite updates.
Run the Demo
Start the demo from the build directory:
$ ./cmake-build-debug/demo-apps/update-screen-modes
Use O to toggle overwrite mode, L to toggle line buffering, B to
toggle the back buffer, S to toggle safe margins, and Q to quit.
ANSI Output Example
The following capture shows the default overwrite-mode dashboard:
╭─────────────────────────────────────────────────────────────────────────────────────────────╮ │ Screen Update Demo | refresh mode: Overwrite │ │ │ │ ┌────────────────────────────┐ ┌─────────────────────────────────────────────────────────┐ │ │ │ Refresh Mode │ │ Sparse animation field | frame 00011 | line buffer: on │ │ │ │ │ │ │ │ │ │ Overwrite │ │ . . . . . . . . . . . . . . │ │ │ │Last Update....... 0.903 ms │ │ . . . . . . . . . . . . . . │ │ │ │Average Update.... 0.569 ms │ │ . . . . . . . . . . . . . . │ │ │ │Overwrite Mode....[✓] │ │ . . . . . . . . . . . . . │ │ │ │Line Buffer.......[✓] │ │ . . . . . . . . . . . . . . │ │ │ │Back Buffer.......[✓] │ │ -----------@------------------------------------------- │ │ │ │Safe Margins......[✓] │ │ . . .* . . . . . . . . . . . │ │ │ │ │ │ . * . . . . . . . . . . . │ │ │ │ │ │ *.* *. . . . . . . . . . . . . │ │ │ │ │ │ . . . . . . . . . . . . . . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └────────────────────────────┘ └─────────────────────────────────────────────────────────┘ │ │ │ │ [O] overwrite [L] line buf [B] back buf [S] margins [Q] quit │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────╯
Features Shown
This demo focuses on runtime screen-update behavior:
Terminal::RefreshMode::OverwriteversusClear.Line buffering, safe margins, and smart back-buffer updates.
Timing feedback for repeated
updateScreen()calls.A sparse animation field that makes redraw strategy visible.
Relevant Source Files
If you want to explore the implementation, start with:
demo/update-screen-modes/src/UpdateScreenModesApp.cpp
demo/update-screen-modes/src/UpdateScreenModesState.hpp
These files contain the interactive toggle handling and the small state model used to compare refresh settings.