contour-terminal / contour

Modern C++ Terminal Emulator
http://contour-terminal.org/
Apache License 2.0
2.31k stars 100 forks source link

Implement xterm's VT extension XTPUSHSGR / XTPOPSGR #1473

Closed christianparpart closed 4 months ago

christianparpart commented 4 months ago

I need this functionality internally actually for #1459 (#687). At least it would be helpful to have to conveniently push/pop SGR values while constructing the indicator status line segments.

CSI # {
CSI Pm # {
          Push video attributes onto stack (XTPUSHSGR), xterm.  The
          optional parameters correspond to the SGR encoding for video
          attributes, except for colors (which do not have a unique SGR
          code):
            Ps = 1  ⇒  Bold.
            Ps = 2  ⇒  Faint.
            Ps = 3  ⇒  Italicized.
            Ps = 4  ⇒  Underlined.
            Ps = 5  ⇒  Blink.
            Ps = 7  ⇒  Inverse.
            Ps = 8  ⇒  Invisible.
            Ps = 9  ⇒  Crossed-out characters.
            Ps = 2 1  ⇒  Doubly-underlined.
            Ps = 3 0  ⇒  Foreground color.
            Ps = 3 1  ⇒  Background color.

          If no parameters are given, all of the video attributes are
          saved.  The stack is limited to 10 levels.
CSI # }   Pop video attributes from stack (XTPOPSGR), xterm.  Popping
          restores the video-attributes which were saved using XTPUSHSGR
          to their previous state.