alec

Abstraction Layer for Escape Codes
git clone git://git.dimitrijedobrota.com/alec.git
Log | Files | Refs

rules (2131B)


      1 // Move cursor up/down/frwd/back
      2 
      3     cursor_up
      4     int n
      5     limit_pos
      6     n, 'A'
      7 
      8     cursor_down
      9     int n
     10     limit_pos
     11     n, 'B'
     12 
     13     cursor_frwd
     14     int n
     15     limit_pos
     16     n, 'C'
     17 
     18     cursor_back
     19     int n
     20     limit_pos
     21     n, 'D'
     22 
     23 // Move cursor to the next/prev line
     24 
     25     cursor_line_next
     26     int n
     27     limit_pos
     28     n, 'E'
     29 
     30     cursor_line_prev
     31     int n
     32     limit_pos
     33     n, 'F'
     34 
     35 // Set cursor to specific column
     36 
     37     cursor_column
     38     int n
     39     limit_pos
     40     n, 'G'
     41 
     42 // Erase functions
     43 
     44     erase_display
     45     MOTION m
     46     |
     47     (int)m, 'J'
     48 
     49     erase_line
     50     MOTION m
     51     |
     52     (int)m, 'K'
     53 
     54 // Scroll up/down
     55 
     56     scroll_up
     57     int n
     58     limit_pos
     59     n, 'S'
     60 
     61     scroll_down
     62     int n
     63     limit_pos
     64     n, 'T'
     65 
     66 // Set cursor to a specific position
     67 
     68     cursor_position
     69     int n, int m
     70     limit_pos
     71     n, ';', m, 'H'
     72 
     73 // color
     74 
     75 // palet colors
     76 
     77     foreground
     78     COLOR color
     79     |
     80     (int)color + 30, 'm'
     81 
     82     background
     83     COLOR color
     84     |
     85     (int)color + 40, 'm'
     86 
     87 // 256-color palette
     88 
     89     foreground
     90     int idx
     91     limit_256
     92     38, ';', 5, ';', idx, 'm'
     93 
     94     background
     95     int idx
     96     limit_256
     97     48, ';', 5, ';', idx, 'm'
     98 
     99 // RGB colors
    100 
    101     foreground
    102     int R, int G, int B
    103     limit_256
    104     38, ';', 5, ';', R, ';', G, ';', B, 'm'
    105 
    106     background
    107     int R, int G, int B
    108     limit_256
    109     48, ';', 5, ';', R, ';', G, ';', B, 'm'
    110 
    111 // Set/reset text decorators
    112 
    113     decor_set
    114     DECOR decor
    115     |
    116     (int)decor, 'm'
    117 
    118     decor_reset
    119     DECOR decor
    120     |
    121     (int)decor + 20, 'm'
    122 
    123 // Save/load cursor position;
    124 
    125     cursor_save
    126     |
    127     |
    128     's'
    129 
    130     cursor_load
    131     |
    132     |
    133     'u'
    134 
    135 // Set screen modes
    136 
    137     screen_mode_set
    138     int n
    139     limit_pos
    140     '=', n, 'h'
    141 
    142     screen_mode_reset
    143     int n
    144     limit_pos
    145     '=', n, 'l'
    146 
    147 // Private screen modes supported by most terminals
    148 
    149 // Save/load screen
    150 
    151     screen_show
    152     |
    153     |
    154     "?47h"
    155 
    156     screen_hide
    157     |
    158     |
    159     "?47l"
    160 
    161 // Show/hide cursor
    162 
    163     cursor_show
    164     |
    165     |
    166     "?25h"
    167 
    168     cursor_hide
    169     |
    170     |
    171     "?25l"
    172 
    173 // Show/hide alternate buffer
    174 
    175     abuf_show
    176     |
    177     |
    178     "?1049h"
    179 
    180     abuf_hide
    181     |
    182     |
    183     "?1049l"