1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 05:28:05 +11:00

editor: simplify I with the use of MOVE-

Also, delay the shadowing of DO..LOOP's I for as long as possible.
This commit is contained in:
Virgil Dupras 2020-05-06 21:10:27 -04:00
parent eaeb138a0c
commit feb0411530
2 changed files with 11 additions and 12 deletions

View File

@ -12,5 +12,5 @@
ENDCASE ENDCASE
AGAIN AGAIN
; ;
( I masks DO..LOOP's I. Do it as late as possible. )
: I _I ;

19
blk/108
View File

@ -1,16 +1,15 @@
: _ilen ( length of str in IBUF ) : _ilen ( length of str in IBUF )
IBUF BEGIN C@+ EOL? UNTIL IBUF - 1- ; IBUF BEGIN C@+ EOL? UNTIL IBUF - 1- ;
: I : _I
IBUF _type EDPOS @ 64 /MOD ( cno lno ) IBUF _type EDPOS @ 64 MOD ( cno )
1+ 64 * _cpos ( cno next-line-ptr ) 63 -^ _ilen ( rbuffsize ilen )
SWAP 63 -^ _ilen ( nlp nb-of-chars-to-move ilen )
2DUP > IF 2DUP > IF
SWAP OVER - 1+ ( nlp ilen nbc ) 0 DO ( a ilen ) SWAP OVER - ( ilen chars-to-move )
SWAP 1- 2DUP -^ ( ilen a-1 a-ilen-1 ) C@ OVER C! SWAP EDPOS @ _cpos 2DUP + ( ctm ilen a a+ilen )
SWAP ( a ilen ) 3 PICK MOVE- ( ctm ilen )
LOOP SWAP DROP ( ilen )
ELSE DROP ( ilen becomes nbc ) ELSE DROP ( ilen becomes rbuffsize )
THEN THEN
SWAP DROP DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen ) DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
EDPOS +! EDPOS @ 64 / _pln EDPOS +! EDPOS @ 64 / _pln
; ;