UNPKG

1.35 kBJavaScriptView Raw
1import { csi } from '../util/csi.js'
2
3export 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 QUERY_POS = csi("6n") // Where is the cursor? Use `ESC [ 6 n`. And answers: `ESC [ Cy ; Cx R`.
10 static HIDE = csi("?25l") // "Hide the cursor." //
11 static SHOW = csi("?25h") // "Show the cursor." //
12 static RESTORE = csi("u") // "Restore the cursor." //
13 static SAVE = csi("s") // "Save the cursor." //
14 static BLINK_BLOCK = csi("\x31 q") // "Change the cursor style to blinking block" //
15 static STEADY_BLOCK = csi("\x32 q") // "Change the cursor style to steady block" //
16 static BLINK_UNDERLINE = csi("\x33 q") // "Change the cursor style to blinking underline" //
17 static STEADY_UNDERLINE = csi("\x34 q") // "Change the cursor style to steady underline" //
18 static BLINK_BAR = csi("\x35 q") // "Change the cursor style to blinking bar" //
19 static STEADY_BAR = csi("\x36 q") // "Change the cursor style to steady bar" //
20}
21
22
23
24
25
26
27
28
29
30
31
32