From 82a6e29eaad2944eb2e1a2213a9bce17e896add4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 28 May 2023 21:47:09 -0500 Subject: initial commit --- readme | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 readme (limited to 'readme') diff --git a/readme b/readme new file mode 100644 index 0000000..a98c60b --- /dev/null +++ b/readme @@ -0,0 +1,136 @@ +YOLK --- ansi escapes for CHICKEN -*- text -*- + +yes there's already ansi-escape-sequences[1]. consider this NIH ;) +this library is based on the information a gist by fnky[2]. +at some point i should base it instead on xterm's manual[3]. + +Unless otherwise stated, all procedures and variables in this library are +strings or return strings ready for `display'. + +INSTALLATION. + +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. + +MODULES. + +(yolk common) --- common functionality + +Procedures. + +- (esc . xs) + +Return a string consisting of XS, converted to strings, prepended by ESC. + +- (csi . xs) + +Convenience function to escape XS using the csi code (ESC "["). + +- (dcs . xs) + +Convenience function to escape XS using the dcs code (ESC "P"). + +- (ocs . xs) + +Convenience function to escape XS using the ocs code (ESC "]"). + +- (parameter-assert predicate error-message) + +Convenience function. Returns a function that runs PREDICATE on its argument and +returns the argument if PREDICATE passes, or errors if not. I use this for +parameters. + +Syntax. + +- (define-esc-alt-wrapper wrapper-proc-name param-name (default-proc args ...)) + +Many terminal behaviors have multiple escape sequences that might work. This +macro defines a parameter named PARAM-NAME and a procedure named +WRAPPER-PROC-NAME that will call PARAM-NAME with ARGS ... . The user can change +which procedure to call by calling (PARAM-NAME new-proc). + +(yolk colors) --- NOT FINISHED + +There's a bug in this library. + +(yolk cursor) --- cursor movement + +Variables. + +-- cursor-home + +Move the cursor to the top-left corner (0,0). NOTE: This and the move commands +might be revised later. + +Procedures. + +-- (cursor-move x y) + +Move cursor to X, Y, counting from the top-left corner of the screen. +cursor-move is an esc-alt-wrapper that defaults to cursor-move/H ("^[[Y;XH"). + +-- (cursor-up n) +-- (cursor-down n) +-- (cursor-right n) +-- (cursor-left n) + +Move cursor up, down, left, or right by N spaces. + +-- (cursor-up-bol n) +-- (cursor-down-bol n) + +Move cursor up or down by N lines, to the beginning of the given line. + +-- (cursor-move-column n) + +Move cursor to column N. + +-- (cursor-save) +-- (cursor-restore) + +Save or restore the cursor's position on the screen. These variables are +parameters defaulting to the DEC escapes. You can set them to the SCO escapes +using (cursor-save cursor-save/sco), for example. + +(yolk erase) --- erasing the screen + +Variables. + +-- erase-screen-down +-- erase-screen-up +-- erase-screen +-- erase-saved-lines + +These erase portions of the entire screen. + +-- erase-line-right +-- erase-line-left +-- erase-line + +These erase portions of the current line. + +-- erase-line-and-return + +Convenience function to return the cursor to the beginning of the line after erasing it. + +(yolk xterm) --- xterm-specific escape sequences + +Variables. + +-- invisible-cursor +-- visible-cursor + +Make the cursor invisible or visible. + +-- save-screen +-- restore-screen + +Save or restore the screen's state. + +-- alt-buffer-enable +-- alt-buffer-disable + +Enable or disable the "alternate buffer." + +[1]: http://wiki.call-cc.org/eggref/5/ansi-escape-sequences +[2]: https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 +[3]: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html -- cgit 1.4.1-21-gabe81