diff --git a/ueforth/common/ansi.fs b/ueforth/common/ansi.fs index c997724..10b1353 100644 --- a/ueforth/common/ansi.fs +++ b/ueforth/common/ansi.fs @@ -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 diff --git a/ueforth/common/testing.fs b/ueforth/common/testing.fs index 5167677..1d7abd9 100644 --- a/ueforth/common/testing.fs +++ b/ueforth/common/testing.fs @@ -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 diff --git a/ueforth/windows/windows.fs b/ueforth/windows/windows.fs index 28b2896..ce7b6da 100644 --- a/ueforth/windows/windows.fs +++ b/ueforth/windows/windows.fs @@ -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 )