Changeset View
Changeset View
Standalone View
Standalone View
stand/forth/screen.4th
Show All 33 Lines | |||||
: ho ( -- ) escc [char] H emit ; | : ho ( -- ) escc [char] H emit ; | ||||
\ Clear from current position to end of display ( Esc-[J ) | \ Clear from current position to end of display ( Esc-[J ) | ||||
: cld ( -- ) escc [char] J emit ; | : cld ( -- ) escc [char] J emit ; | ||||
\ clear screen | \ clear screen | ||||
: clear ( -- ) ho cld ; | : clear ( -- ) ho cld ; | ||||
\ reset to initial state | |||||
: ris ( -- ) 27 emit [char] c emit ; | |||||
imp: The reset sequence is ESC c, not ESC [ c.
https://en.wikipedia.org/wiki/ANSI_escape_code | |||||
Done Inline ActionsOops, I will change this to : ris ( -- ) 27 emit [char] c emit ; freqlabs: Oops, I will change this to
```
: ris ( -- ) 27 emit [char] c emit ;
``` | |||||
\ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH ) | \ move cursor to x rows, y cols (1-based coords) ( Esc-[%d;%dH ) | ||||
: at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ; | : at-xy ( x y -- ) escc .# [char] ; emit .# [char] H emit ; | ||||
\ Set foreground color ( Esc-[3%dm ) | \ Set foreground color ( Esc-[3%dm ) | ||||
: fg ( x -- ) escc 3 .# .# [char] m emit ; | : fg ( x -- ) escc 3 .# .# [char] m emit ; | ||||
\ Set background color ( Esc-[4%dm ) | \ Set background color ( Esc-[4%dm ) | ||||
: bg ( x -- ) escc 4 .# .# [char] m emit ; | : bg ( x -- ) escc 4 .# .# [char] m emit ; | ||||
Show All 25 Lines |
The reset sequence is ESC c, not ESC [ c.
https://en.wikipedia.org/wiki/ANSI_escape_code