diff options
Diffstat (limited to 'readme')
-rw-r--r-- | readme | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/readme b/readme new file mode 100644 index 0000000..a98c60b --- /dev/null +++ b/readme | |||
@@ -0,0 +1,136 @@ | |||
1 | YOLK --- ansi escapes for CHICKEN -*- text -*- | ||
2 | |||
3 | yes there's already ansi-escape-sequences[1]. consider this NIH ;) | ||
4 | this library is based on the information a gist by fnky[2]. | ||
5 | at some point i should base it instead on xterm's manual[3]. | ||
6 | |||
7 | Unless otherwise stated, all procedures and variables in this library are | ||
8 | strings or return strings ready for `display'. | ||
9 | |||
10 | INSTALLATION. | ||
11 | |||
12 | Run `chicken-install' in this directory or `make install', which will run it for you. You can also run `make clean' to clean the folder of build artifacts. | ||
13 | |||
14 | MODULES. | ||
15 | |||
16 | (yolk common) --- common functionality | ||
17 | |||
18 | Procedures. | ||
19 | |||
20 | - (esc . xs) | ||
21 | |||
22 | Return a string consisting of XS, converted to strings, prepended by ESC. | ||
23 | |||
24 | - (csi . xs) | ||
25 | |||
26 | Convenience function to escape XS using the csi code (ESC "["). | ||
27 | |||
28 | - (dcs . xs) | ||
29 | |||
30 | Convenience function to escape XS using the dcs code (ESC "P"). | ||
31 | |||
32 | - (ocs . xs) | ||
33 | |||
34 | Convenience function to escape XS using the ocs code (ESC "]"). | ||
35 | |||
36 | - (parameter-assert predicate error-message) | ||
37 | |||
38 | Convenience function. Returns a function that runs PREDICATE on its argument and | ||
39 | returns the argument if PREDICATE passes, or errors if not. I use this for | ||
40 | parameters. | ||
41 | |||
42 | Syntax. | ||
43 | |||
44 | - (define-esc-alt-wrapper wrapper-proc-name param-name (default-proc args ...)) | ||
45 | |||
46 | Many terminal behaviors have multiple escape sequences that might work. This | ||
47 | macro defines a parameter named PARAM-NAME and a procedure named | ||
48 | WRAPPER-PROC-NAME that will call PARAM-NAME with ARGS ... . The user can change | ||
49 | which procedure to call by calling (PARAM-NAME new-proc). | ||
50 | |||
51 | (yolk colors) --- NOT FINISHED | ||
52 | |||
53 | There's a bug in this library. | ||
54 | |||
55 | (yolk cursor) --- cursor movement | ||
56 | |||
57 | Variables. | ||
58 | |||
59 | -- cursor-home | ||
60 | |||
61 | Move the cursor to the top-left corner (0,0). NOTE: This and the move commands | ||
62 | might be revised later. | ||
63 | |||
64 | Procedures. | ||
65 | |||
66 | -- (cursor-move x y) | ||
67 | |||
68 | Move cursor to X, Y, counting from the top-left corner of the screen. | ||
69 | cursor-move is an esc-alt-wrapper that defaults to cursor-move/H ("^[[Y;XH"). | ||
70 | |||
71 | -- (cursor-up n) | ||
72 | -- (cursor-down n) | ||
73 | -- (cursor-right n) | ||
74 | -- (cursor-left n) | ||
75 | |||
76 | Move cursor up, down, left, or right by N spaces. | ||
77 | |||
78 | -- (cursor-up-bol n) | ||
79 | -- (cursor-down-bol n) | ||
80 | |||
81 | Move cursor up or down by N lines, to the beginning of the given line. | ||
82 | |||
83 | -- (cursor-move-column n) | ||
84 | |||
85 | Move cursor to column N. | ||
86 | |||
87 | -- (cursor-save) | ||
88 | -- (cursor-restore) | ||
89 | |||
90 | Save or restore the cursor's position on the screen. These variables are | ||
91 | parameters defaulting to the DEC escapes. You can set them to the SCO escapes | ||
92 | using (cursor-save cursor-save/sco), for example. | ||
93 | |||
94 | (yolk erase) --- erasing the screen | ||
95 | |||
96 | Variables. | ||
97 | |||
98 | -- erase-screen-down | ||
99 | -- erase-screen-up | ||
100 | -- erase-screen | ||
101 | -- erase-saved-lines | ||
102 | |||
103 | These erase portions of the entire screen. | ||
104 | |||
105 | -- erase-line-right | ||
106 | -- erase-line-left | ||
107 | -- erase-line | ||
108 | |||
109 | These erase portions of the current line. | ||
110 | |||
111 | -- erase-line-and-return | ||
112 | |||
113 | Convenience function to return the cursor to the beginning of the line after erasing it. | ||
114 | |||
115 | (yolk xterm) --- xterm-specific escape sequences | ||
116 | |||
117 | Variables. | ||
118 | |||
119 | -- invisible-cursor | ||
120 | -- visible-cursor | ||
121 | |||
122 | Make the cursor invisible or visible. | ||
123 | |||
124 | -- save-screen | ||
125 | -- restore-screen | ||
126 | |||
127 | Save or restore the screen's state. | ||
128 | |||
129 | -- alt-buffer-enable | ||
130 | -- alt-buffer-disable | ||
131 | |||
132 | Enable or disable the "alternate buffer." | ||
133 | |||
134 | [1]: http://wiki.call-cc.org/eggref/5/ansi-escape-sequences | ||
135 | [2]: https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 | ||
136 | [3]: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html | ||