save and restore sgr
1:contour 2:configure 3:reference github ↗
save and restore sgr

Save and Restore SGR attributes.#

Feature detection#

Use SGRSAVE (CSI # {) save the currently set SGR attributes, and SGRRESTORE (CSI # }) to restore the previously saved SGR attributes.

Relation to xterm's XTPUSHSGR / XTPOPSGR#

Both, XTPUSHSGR and XTPOPSGR are in its most basic form equivalent to SGRSAVE and SGRRESTORE, but the xterm extensions push and pop using a stack rather than save and restore using a simple storage location, and the xterm equivalent does allow pushing/popping only certain SGR attributes.

This is needless functionality that should not be implemented by a terminal but rather in the applications itself.

NORMAL reference › save and restore sgr