1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-10-06 08:20:56 +11:00
collapseos/blk/108
Virgil Dupras 4af93d53e3 VE: add I command
Also, add insert and find buffers to the header, making it 3 lines
high.

Also, fix the "I" overshadowing word which wasn't operating on the
proper RSP level.

Also, fix I which didn't mark the block as dirty.
2020-06-04 22:54:27 -04:00

17 lines
536 B
Plaintext

: _blen ( buf -- length of str in buf )
DUP BEGIN C@+ EOL? UNTIL -^ 1- ;
: _rbufsz ( size of linebuf to the right of curpos )
EDPOS @ 64 MOD 63 -^ ;
: i COMPILE I ; IMMEDIATE ( save overshadowed )
: I
IBUF _type _rbufsz IBUF _blen 2DUP > IF
TUCK - ( ilen chars-to-move )
SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
3 PICK MOVE- ( ctm ilen )
NIP ( ilen )
ELSE DROP ( ilen becomes rbuffsize )
THEN
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
BLK!! EDPOS +! EDPOS @ 64 / _pln
;