Skip to content

Provide DEC sequences for save & restore cursor position operations #226

@pmonks

Description

@pmonks

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions