about summary refs log tree commit diff stats
path: root/yolk.cursor.ss
diff options
context:
space:
mode:
Diffstat (limited to 'yolk.cursor.ss')
-rw-r--r--yolk.cursor.ss60
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)