diff options
author | Case Duckworth | 2023-05-28 21:47:09 -0500 |
---|---|---|
committer | Case Duckworth | 2023-05-28 21:47:09 -0500 |
commit | 82a6e29eaad2944eb2e1a2213a9bce17e896add4 (patch) | |
tree | ebedbf6e65bb222d2ce76b491cccb51eca479d00 /yolk.cursor.ss | |
download | yolk-82a6e29eaad2944eb2e1a2213a9bce17e896add4.tar.gz yolk-82a6e29eaad2944eb2e1a2213a9bce17e896add4.zip |
initial commit
Diffstat (limited to 'yolk.cursor.ss')
-rw-r--r-- | yolk.cursor.ss | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/yolk.cursor.ss b/yolk.cursor.ss new file mode 100644 index 0000000..a61aa2f --- /dev/null +++ b/yolk.cursor.ss | |||
@@ -0,0 +1,60 @@ | |||
1 | ;;; (yolk cursor) --- move the cursor around the terminal | ||
2 | |||
3 | (import (scheme base) | ||
4 | (scheme case-lambda) | ||
5 | (yolk common)) | ||
6 | |||
7 | (define cursor-home | ||
8 | (csi "H")) | ||
9 | |||
10 | (define (cursor-move/H x y) | ||
11 | (csi y ";" x "H")) | ||
12 | |||
13 | (define (cursor-move/f x y) | ||
14 | (csi y ";" x "f")) | ||
15 | |||
16 | (define-esc-alt-wrapper cursor-move cursor-move-proc | ||
17 | (cursor-move/H x y)) | ||
18 | |||
19 | (define (cursor-up n) | ||
20 | (csi n "A")) | ||
21 | |||
22 | (define (cursor-down n) | ||
23 | (csi n "B")) | ||
24 | |||
25 | (define (cursor-right n) | ||
26 | (csi n "C")) | ||
27 | |||
28 | (define (cursor-left n) | ||
29 | (csi n "D")) | ||
30 | |||
31 | (define (cursor-down-bol n) | ||
32 | (csi n "E")) | ||
33 | |||
34 | (define (cursor-up-bol n) | ||
35 | (csi n "F")) | ||
36 | |||
37 | (define (cursor-move-column n) | ||
38 | (csi n "G")) | ||
39 | |||
40 | (define cursor-save/dec | ||
41 | (esc 7)) | ||
42 | |||
43 | (define cursor-restore/dec | ||
44 | (esc 8)) | ||
45 | |||
46 | (define cursor-save/sco | ||
47 | (csi "s")) | ||
48 | |||
49 | (define cursor-restore/sco | ||
50 | (csi "u")) | ||
51 | |||
52 | (define cursor-save | ||
53 | (make-parameter cursor-save/dec | ||
54 | (parameter-assert string? "Not a string"))) | ||
55 | |||
56 | (define cursor-restore | ||
57 | (make-parameter cursor-restore/dec | ||
58 | (parameter-assert string? "Not a string"))) | ||
59 | |||
60 | ;; (define (get-cursor-postion) ...) ; (csi "6n"), reports as (csi r;cR) | ||