commit 4cc1df77fcd7ccdb0ad586c89f220a6bfc02f5b2 parent 5d81cd85db9d5d18ad546ff953643918aeb35893 Author: Virgil Dupras <hsoft@hardcoded.net> Date: Tue, 26 Jul 2022 16:43:49 -0400 grid: make it nicer Diffstat:
M | fs/sys/grid.fs | | | 7 | ++++--- |
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/sys/grid.fs b/fs/sys/grid.fs @@ -4,12 +4,13 @@ : pcell! ( c -- ) gridpos cell! ; +: clrline ( ln -- ) COLS * COLS >r begin ( pos ) SPC over cell! 1+ next drop ; : linefeed ( -- ) - gridpos COLS / 1+ LINES mod COLS * to gridpos ; + gridpos COLS / 1+ LINES mod dup clrline COLS * to gridpos ; : (emit) ( c -- ) case 8 ( BS ) of = SPC pcell! -1 to+ gridpos endof - CR of = SPC pcell! linefeed endof + LF of = SPC pcell! linefeed endof SPC of > endof - r@ pcell! gridpos 1+ dup COLS mod if to gridpos else linefeed then + r@ pcell! gridpos 1+ dup COLS mod if to gridpos else drop linefeed then endcase ;