1 | import { csi } from '../util/csi.js'
|
2 |
|
3 | export class Cursor {
|
4 | static goto = (x, y) => csi(`${++x};${++y}H`)
|
5 | static up = (d) => csi(d + 'A')
|
6 | static down = (d) => csi(d + 'B')
|
7 | static right = (d) => csi(d + 'C')
|
8 | static left = (d) => csi(d + 'D')
|
9 | static prevLine = (d) => csi(d + 'E')
|
10 | static nextLine = (d) => csi(d + 'F')
|
11 | static charTo = (d) => csi(d + 'G')
|
12 | static QUERY_POS = csi("6n") // Where is the cursor? Use `ESC [ 6 n`. And answers: `ESC [ Cy ; Cx R`.
|
13 | static SHOW = csi("?25h") // "Show the cursor." //
|
14 | static HIDE = csi("?25l") // "Hide the cursor." //
|
15 | static SAVE = csi("s") // "Save the cursor." //
|
16 | static RESTORE = csi("u") // "Restore the cursor." //
|
17 | static BLINK_BLOCK = csi("\x31 q") // "Change the cursor style to blinking block" //
|
18 | static STEADY_BLOCK = csi("\x32 q") // "Change the cursor style to steady block" //
|
19 | static BLINK_UNDERLINE = csi("\x33 q") // "Change the cursor style to blinking underline" //
|
20 | static STEADY_UNDERLINE = csi("\x34 q") // "Change the cursor style to steady underline" //
|
21 | static BLINK_BAR = csi("\x35 q") // "Change the cursor style to blinking bar" //
|
22 | static STEADY_BAR = csi("\x36 q") // "Change the cursor style to steady bar" //
|
23 | }
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|