This gives us backspace handling. Also, remove all usages of C< which allows us to remove the C<* override.pull/116/head
@@ -4,10 +4,11 @@ | |||||
3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ; | 3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ; | ||||
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ; | : cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ; | ||||
: buftype ( buf ln -- ) | : buftype ( buf ln -- ) | ||||
3 OVER AT-XY C< DUP 0xd = IF 2DROP DROP EXIT THEN | |||||
( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c ) | |||||
SWAP DUP _zbuf C!+ DUP 63 + SWAP DO | |||||
C< DUP 0x0d = IF LEAVE THEN i C! LOOP ; | |||||
3 OVER AT-XY KEY DUP EMIT | |||||
DUP 0x20 < IF 2DROP DROP EXIT THEN | |||||
( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c ) SWAP C!+ | |||||
IN( _zbuf (rdln) IN( SWAP 63 MOVE ; | |||||
@@ -4,8 +4,8 @@ | |||||
SWAP _cpos FBUF ( len src dst ) ROT MOVE ; | SWAP _cpos FBUF ( len src dst ) ROT MOVE ; | ||||
: $R ( replace mode ) | : $R ( replace mode ) | ||||
mode! 'R' EMIT | mode! 'R' EMIT | ||||
BEGIN setpos C< DUP 0xd = NOT IF | |||||
EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0 | |||||
BEGIN setpos KEY DUP 0x20 >= IF | |||||
DUP EMIT EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0 | |||||
THEN UNTIL mode! SPC contents ; | THEN UNTIL mode! SPC contents ; | ||||
: $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN | : $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN | ||||
_U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf BLK!! contents ; | _U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf BLK!! contents ; | ||||
@@ -7,10 +7,10 @@ | |||||
: bufs | : bufs | ||||
1 aty ." I: " IBUF bufp | 1 aty ." I: " IBUF bufp | ||||
2 aty ." F: " FBUF bufp 0 3 gutter ; | 2 aty ." F: " FBUF bufp 0 3 gutter ; | ||||
: c<over KEY DUP EMIT DUP 0x0a = IF DROP 0x0d THEN ; | |||||
: VE ['] c<over 0x08 ( C< override ) RAM+ ! | |||||
: VE | |||||
clrscr 0 ACC ! 0 PREVPOS ! contents | clrscr 0 ACC ! 0 PREVPOS ! contents | ||||
BEGIN status bufs setpos KEY handle UNTIL | BEGIN status bufs setpos KEY handle UNTIL | ||||
0 0x08 RAM+ ! 19 aty ; | |||||
19 aty ; | |||||