Set title on windows, reset state on error.

This commit is contained in:
Brad Nelson
2021-01-04 20:22:49 -08:00
parent 4693c30ab3
commit 169c0831b1
3 changed files with 5 additions and 2 deletions

View File

@ -197,5 +197,6 @@ create input-buffer input-limit allot
#tib ! 'tib ! 0 >in ! evaluate-buffer #tib ! 'tib ! 0 >in ! evaluate-buffer
r> >in ! r> #tib ! r> 'tib ! ; r> >in ! r> #tib ! r> 'tib ! ;
: query begin ['] evaluate-buffer catch : query begin ['] evaluate-buffer catch
if ." ERROR" cr then prompt refill drop again ; if 0 state ! sp0 sp! rp0 rp! ." ERROR" cr then
prompt refill drop again ;
: ok ." uEForth" cr prompt refill drop query ; : ok ." uEForth" cr prompt refill drop query ;

View File

@ -1,6 +1,6 @@
( Terminal handling ) ( Terminal handling )
: n. ( n -- ) base @ swap decimal <# #s #> type base ! ; : n. ( n -- ) base @ swap decimal <# #s #> type base ! ;
: esc 27 emit ; : esc 27 emit ; : bel 7 emit ;
: at-xy ( x y -- ) esc ." [" 1+ n. ." ;" 1+ n. ." H" ; : at-xy ( x y -- ) esc ." [" 1+ n. ." ;" 1+ n. ." H" ;
: page esc ." [2J" esc ." [H" ; : page esc ." [2J" esc ." [H" ;
: normal esc ." [0m" ; : normal esc ." [0m" ;

View File

@ -65,3 +65,5 @@ stdout console-mode @ ENABLE_VIRTUAL_TERMINAL_PROCESSING or SetConsoleMode drop
: win-bye ( -- ) 0 ExitProcess drop ; : win-bye ( -- ) 0 ExitProcess drop ;
' win-bye is bye ' win-bye is bye
: set-title ( a n -- ) esc ." ]0;" type bel ;
s" uEforth" set-title