Chaostreff-Potsdam / erika3004

18 stars 5 forks source link

ANSI Escape Sequence Proposal #22

Open sirexeclp opened 5 years ago

sirexeclp commented 5 years ago

Based on https://en.wikipedia.org/wiki/ANSI_escape_code

The following escape codes are defined:

    self.csi_codes = {
        "A": self._cursor_up
        , "B": self._cursor_down
        , "C": self._cursor_forward
        , "D": self._cursor_back
        , "E": self._cursor_next_line
        , "F": self._cursor_previous_line
        , "G": self._cursor_horizontal_absolute
        , "H": self._cursor_position
        , "J": self._erase_in_display
        , "K": self._erase_in_line
        , "S": self._scroll_up
        , "T": self._scroll_down
        , "f": self._cursor_position  # Horizontal Vertical Position: same as Cursor Position
        , "m": self._select_graphic_rendition
        , "i": self._decode_aux_port
        , "n": self._device_status_report
        , "s": self._save_cursor_position
        , "u": self._restore_cursor_position
    }

They should map to the following erika hex codes (where n is an int parameter):

Code Erika [HEX] Description
n A n 2 76H Cursor Up
n B n 2 75H Cursor Down
n C n 2 73H Cursor Forward (right)
n D n 2 74H Cursor Back (left)
n E n * 77H Cursor Next Line Beginning (same as n * \n)
n F n 2 76H + 78H Cursor Previous Line Beginning

I suggest using the following codes in addition

Code Erika [HEX] Description
a 76H halfstep up
b 75H halfstep down
c 73H halfstep right
d 74H halfstep left
v (could use fsince it's redundant with H, but would "break" the standard) 82H Microstep (1/20th row) up
e 81H Microstep (1/20th row) down
0t 7DH set default TABs
1t 7AH set TAB
2t 7BH clear TAB
3t 7CH clear all TABs
0M 80H clear margins
1M 7EH set margin left
2M 7FH set margin right
0L 84H 1x line spacing
1L 85H 1.5x line spacing
2L 86H 2x line spacing
0l (could also use alternate fonts for this or bold /faint/normal) 87H 100 chars / line (10 chars / inch)
1l 88H 120 chars / line (12 chars / inch)
2l 89H 150 chars / line (15 chars / inch)
0k 91H keyboard echo off
1k 92H keyboard echo on
ASCII [HEX] Erika[HEX] Description
20 71H Space
08 72H Back Space
0A (\n) 77H New Line (carriage return + new line)
0D(\r) 78H Carriage Return
09 (\t) 79H HT Horizontal TAB
ArchibaldBienetre commented 4 years ago

First steps are part of this PR, it seems: https://github.com/Chaostreff-Potsdam/erika3004/pull/28