1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 13:18:06 +11:00

editor: implement I command

Also, made LIST properly handle full 64-chars lines not ending with
a null or CR. Previously, such a line would be accompanied by its
following line, duplicating that line's output.
This commit is contained in:
Virgil Dupras 2020-05-06 12:19:36 -04:00
parent f54b1dc504
commit 58ece9f9a1
6 changed files with 22 additions and 5 deletions

View File

@ -2,7 +2,7 @@ T ( n -- ): select line n for editing.
P xxx: put typed line on selected line. P xxx: put typed line on selected line.
U xxx: insert typed line on selected line. U xxx: insert typed line on selected line.
F xxx: find typed string in block. F xxx: find typed string in block.
I xxx: insert typed string at cursor

View File

@ -1,5 +1,5 @@
50 LOAD+ ( B152, extras ) 50 LOAD+ ( B152, extras )
1 5 LOADR+ 1 6 LOADR+
: BROWSE : BROWSE
0 ACC ! L 0 ACC ! L

View File

@ -1,5 +1,5 @@
: _type ( buf -- ) : _type ( buf -- )
C< DUP 0xd = IF DROP EXIT THEN OVER DUP _zbuf ( c a ) C< DUP 0xd = IF 2DROP EXIT THEN OVER DUP _zbuf ( c a )
BEGIN ( c a ) BEGIN ( c a )
C!+ C< SWAP C!+ C< SWAP
OVER 0x0d = UNTIL ( c a ) C! ; OVER 0x0d = UNTIL ( c a ) C! ;

15
blk/108 Normal file
View File

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

View File

@ -1,10 +1,12 @@
: .2 DUP 10 < IF SPC THEN . ; : .2 DUP 10 < IF SPC THEN . ;
: EOL? ( c -- f ) DUP 0xd = SWAP NOT OR ;
: LIST : LIST
BLK@ BLK@
16 0 DO 16 0 DO
I 1+ .2 SPC I 1+ .2 SPC
64 I * BLK( + (print) 64 I * BLK( + DUP 64 + SWAP DO
I C@ DUP EOL? IF DROP LEAVE ELSE EMIT THEN
LOOP
NL NL
LOOP LOOP
; ;

Binary file not shown.