collapseos/blk/129
Virgil Dupras b22ab8437b VE: add command 'f'
Kinda proud of this one. Efficiently piggy-backing on the Block
Editor, keeping things simple, and yet, building power into the
editor.
2020-06-06 21:46:46 -04:00

14 lines
471 B
Plaintext

: $f EDPOS @ PREVPOS @ 2DUP = IF 2DROP EXIT THEN
2DUP > IF DUP pos! SWAP THEN
( p1 p2, p1 < p2 ) OVER - ( pos len ) FBUF _zbuf
SWAP _cpos FBUF ( len src dst ) ROT MOVE ;
: $R ( replace mode )
mode! 'R' EMIT
BEGIN setpos C< DUP 0xd = NOT IF
EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
THEN UNTIL mode! SPC contents ;
: handle ( c -- f )
DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
UPPER 'Q' = ;