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 visual behavior are easy to compare.
Use This Demo When You Need…
A support example for diagnosing
updateScreen()behavior and performance tradeoffs.A visual comparison of overwrite versus clear refresh strategies.
A reference for line buffering, safe margins, and smart back-buffer 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.
Captured Output (80x25)
╭──────────────────────────────────────────────────────────────────────────────╮ │ Screen Update Demo | refresh mode: Overwrite │ │ │ │ ┌───────────────────────┐ ┌───────────────────────────────────────────────┐ │ │ │ Refresh Mode │ │ Sparse animation field | frame 00007 | line │ │ │ │ │ │ │ │ │ │ Overwrite │ │ . . . . . . . . . . . │ │ │ │Last Update....... │ │ . . . . . . . . . . . │ │ │ │0.766 ms │ │ . . . . . . . . . . . │ │ │ │Average Update.... │ │ . . . . . . . . . . . . │ │ │ │0.768 ms │ │ . . . . . . . . . . . │ │ │ │Overwrite Mode....[✓] │ │ . . . . . . . . . . . │ │ │ │Line Buffer.......[✓] │ │ --------------------------------------------- │ │ │ │Back Buffer.......[✓] │ │ . . . . . . . . . . . . │ │ │ │Safe Margin.......[✕] │ │ . . . . . . . . . . . │ │ │ │ │ │ *. . . . . . . . . . . │ │ │ │ │ │ . * * @ . . . . . . . . . │ │ │ │ │ │ . . . . . . . . . . . . │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └───────────────────────┘ └───────────────────────────────────────────────┘ │ │ │ │ [O] overwrite [L] line buf [B] back buf [S] safe margin [Q] quit │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯
Features Demonstrated
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
and demo/update-screen-modes/src/UpdateScreenModesState.hpp.