diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-06-01 21:38:11 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-06-01 21:38:11 +0200 |
commit | 3bdc5e083f9f3063c59ffed18fe062c9a9e166dd (patch) | |
tree | b69bb127ac4ec9e4388c269c1fa5b2b5f72c6295 /module/terminal/escape.scm | |
parent | Work on cloning events through editor. (diff) | |
download | calp-3bdc5e083f9f3063c59ffed18fe062c9a9e166dd.tar.gz calp-3bdc5e083f9f3063c59ffed18fe062c9a9e166dd.tar.xz |
Rename {terminal => vulgar}.
Diffstat (limited to 'module/terminal/escape.scm')
-rw-r--r-- | module/terminal/escape.scm | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/module/terminal/escape.scm b/module/terminal/escape.scm deleted file mode 100644 index a16df594..00000000 --- a/module/terminal/escape.scm +++ /dev/null @@ -1,42 +0,0 @@ -;;; Module for terminal (ANSI) escape codes. - -(define-module (terminal escape) - #:use-module (srfi srfi-60) - #:use-module (terminal termios) - #:use-module (util) - #:export (with-vulgar)) - -(define-public (cls) - (display "\x1b[H") ; Move cursor to the origin - (display "\x1b[J") ; Clear everything after cursor - ) - -;;; I don't curse, I'm just vulgar. - -(define-syntax with-vulgar - (syntax-rules () - ((_ thunk) - (let* ((ifd (current-input-port)) - (ofd (current-output-port)) - (iattr (make-termios)) - (oattr (make-termios)) - iattr* oattr*) - (dynamic-wind - (lambda () - (tcgetattr! iattr ifd) - (tcgetattr! oattr ofd) - - ;; Store current settings to enable resetting the terminal later - (set! iattr* (copy-termios iattr)) - (set! oattr* (copy-termios oattr)) - - (let ((bits (bitwise-not (bitwise-ior ECHO ICANON)))) - (set! (lflag iattr) (bitwise-and (lflag iattr) bits)) - (set! (lflag oattr) (bitwise-and (lflag oattr) bits))) - - (tcsetattr! iattr ifd) - (tcsetattr! oattr ofd)) - thunk - (lambda () - (tcsetattr! iattr* ifd) - (tcsetattr! oattr* ofd))))))) |