Background
The escape sequences for "save cursor position" and "restore cursor position" were never standardised as part of the ANSI (or subsequent) specs, resulting in two different sequences known in some circles as "DEC" and "SCO":
- DEC:
ESC7 (save) and ESC8 (restore)
- SCO:
ESC[s (save) and ESC[u (restore)
Different terminals (and OSes) support different combinations of these sequences (one, the other, neither or both); for example the iTerm2 terminal on macOS supports both, while the built-in macOS Terminal.app only supports the DEC sequences.
Problem
From the source I see that jansi's saveCursorPosition and restoreCursorPosition methods use the SCO sequences for these operations, meaning that they won't work by default on some terminals (including, notably, macOS' built-in Terminal.app).
Proposed Solution
Add support for both variants, so that jansi consumers can determine the correct one to use (itself a thorny problem, but one that feels appropriate to punt out of the library).
Background
The escape sequences for "save cursor position" and "restore cursor position" were never standardised as part of the ANSI (or subsequent) specs, resulting in two different sequences known in some circles as "DEC" and "SCO":
ESC7(save) andESC8(restore)ESC[s(save) andESC[u(restore)Different terminals (and OSes) support different combinations of these sequences (one, the other, neither or both); for example the iTerm2 terminal on macOS supports both, while the built-in macOS Terminal.app only supports the DEC sequences.
Problem
From the source I see that
jansi'ssaveCursorPositionandrestoreCursorPositionmethods use the SCO sequences for these operations, meaning that they won't work by default on some terminals (including, notably, macOS' built-in Terminal.app).Proposed Solution
Add support for both variants, so that
jansiconsumers can determine the correct one to use (itself a thorny problem, but one that feels appropriate to punt out of the library).