Hide more of ansi

This commit is contained in:
Brad Nelson
2021-02-06 16:47:34 -08:00
parent cf056a58b6
commit 72ac2a39d3
3 changed files with 12 additions and 5 deletions

View File

@ -1,11 +1,7 @@
( ANSI Codes )
vocabulary ansi ansi definitions
: n. ( n -- ) base @ swap decimal <# #s #> type base ! ;
: esc 27 emit ; : bel 7 emit ;
: at-xy ( x y -- ) esc ." [" 1+ n. ." ;" 1+ n. ." H" ;
: page esc ." [2J" esc ." [H" ;
: normal esc ." [0m" ;
: fg ( n -- ) esc ." [38;5;" n. ." m" ;
: bg ( n -- ) esc ." [48;5;" n. ." m" ;
: clear-to-eol esc ." [0K" ;
: scroll-down esc ." D" ;
: scroll-up esc ." M" ;
@ -14,3 +10,10 @@
: terminal-save esc ." [?1049h" ;
: terminal-restore esc ." [?1049l" ;
forth definitions ansi
: fg ( n -- ) esc ." [38;5;" n. ." m" ;
: bg ( n -- ) esc ." [48;5;" n. ." m" ;
: normal esc ." [0m" ;
: at-xy ( x y -- ) esc ." [" 1+ n. ." ;" 1+ n. ." H" ;
: page esc ." [2J" esc ." [H" ;
forth

View File

@ -45,7 +45,9 @@ variable tests-found variable tests-run variable tests-passed
: check-fresh depth if }confirm ." DEPTH LEAK! " depth . 1 throw then ;
: wrap-test ( xt -- ) expect-reset >r check-fresh r> execute check-fresh expect-finish ;
: red 1 fg ; : green 2 fg ; : hr 40 for [char] - emit next cr ;
ansi
: replace-line 13 emit clear-to-eol ;
forth
: label-test ( xt -- ) replace-line >name type ;
: run-test ( xt -- ) dup label-test confirm{ ['] wrap-test catch }confirm
if drop ( cause xt restored on throw ) red ." FAILED" normal cr

View File

@ -87,7 +87,9 @@ stdout console-mode @ ENABLE_VIRTUAL_TERMINAL_PROCESSING or SetConsoleMode drop
' win-bye is bye
-1 echo !
ansi
: set-title ( a n -- ) esc ." ]0;" type bel ;
windows
s" uEforth" set-title
( Window File Specific )