contour-terminal / contour

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

Add SGRSAVE and SGRRESTORE VT sequences to save and restore SGR state #1474

Closed christianparpart closed 4 months ago

christianparpart commented 4 months ago

Closes #1473 but does not implement #1473. This is because XTPUSHSGR / XTPOPSGR are conceptionally plain wrong.

However, having the ability to save and restore all SGR attribs at once is a really good idea that does suffice the general use-cases.

Having a stack only works around poor application implementations. This includes pushing specific SGR attribs alone.

This is why SGRSAVE and SGRRESTORE are simply saving and restoring the all the SGR attributes, including colors, and all other SGR attributes.

The chosen VT sequences intentionally conflict with XTPUSHSGR / XTPOPSGR because:

  1. the trivial case is semantically the same (no parameters given)
  2. providing parameters is fundamentally wrong
  3. adding yet another stack is fundamentally wrong

Checklist