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:
parent
f54b1dc504
commit
58ece9f9a1
2
blk/101
2
blk/101
@ -2,7 +2,7 @@ T ( n -- ): select line n for editing.
|
||||
P xxx: put typed line on selected line.
|
||||
U xxx: insert typed line on selected line.
|
||||
F xxx: find typed string in block.
|
||||
|
||||
I xxx: insert typed string at cursor
|
||||
|
||||
|
||||
|
||||
|
2
blk/102
2
blk/102
@ -1,5 +1,5 @@
|
||||
50 LOAD+ ( B152, extras )
|
||||
1 5 LOADR+
|
||||
1 6 LOADR+
|
||||
|
||||
: BROWSE
|
||||
0 ACC ! L
|
||||
|
2
blk/105
2
blk/105
@ -1,5 +1,5 @@
|
||||
: _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 )
|
||||
C!+ C< SWAP
|
||||
OVER 0x0d = UNTIL ( c a ) C! ;
|
||||
|
15
blk/108
Normal file
15
blk/108
Normal 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
|
||||
;
|
6
blk/456
6
blk/456
@ -1,10 +1,12 @@
|
||||
: .2 DUP 10 < IF SPC THEN . ;
|
||||
|
||||
: EOL? ( c -- f ) DUP 0xd = SWAP NOT OR ;
|
||||
: LIST
|
||||
BLK@
|
||||
16 0 DO
|
||||
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
|
||||
LOOP
|
||||
;
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user