1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-06 03:30:55 +11:00
collapseos/blk/130
Virgil Dupras 74e211eeda Fix bugs in ed's U and VE's O/o
U didn't properly handle inserting on the last line and O's bounds
checks didn't make sense.
2020-06-28 20:34:39 -04:00

16 lines
606 B
Plaintext

: $f EDPOS @ PREVPOS @ 2DUP = IF 2DROP EXIT THEN
2DUP > IF DUP pos! SWAP THEN
( p1 p2, p1 < p2 ) OVER - 64 MIN ( pos len ) FBUF _zbuf
SWAP _cpos FBUF ( len src dst ) ROT MOVE ;
: $R ( replace mode )
mode! 'R' EMIT
BEGIN setpos KEY DUP BS? IF -1 EDPOS +! DROP 0 THEN
DUP 0x20 >= IF
DUP EMIT EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
THEN UNTIL mode! SPC contents ;
: $O _U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf BLK!! contents ;
: $o EDPOS @ 0x3c0 < IF EDPOS @ 64 + EDPOS ! $O THEN ;
: $D $H 64 icpy
acc@ 0 DO 16 EDPOS @ 64 / DO I _mvln- LOOP LOOP
BLK!! contents ;