ansi-php icon indicating copy to clipboard operation
ansi-php copied to clipboard

Support for DECSC/DECRC (Save/Restore cursor position)

Open nahkampf opened this issue 2 years ago • 0 comments

I needed this for a thing so I thought I'd share it upstream as well. This implements the DEC/VT100 standard for saving and restoring a cursor position (and attributes, like bold or color).

I was unable to write the practical tests for it, as it behaves differently than expected in phpunit for some reason I could not figure out, but my own usage tests seem to work fine (although DECSC/DECRC is highly terminal dependent and might be wonky in some cases - it is however according to spec).

Call saveCursorPosition() to save the position (outputs \e7) and restoreCursorPosition() (outputs \e8) to restore it.

Not implemented are the SCO/xterm methods (\e[s & \e[u), so if anyone decides to implement them perhaps we need a parameter for the save and restore methods to indicate what standard you want to use?

nahkampf avatar Feb 19 '24 08:02 nahkampf