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.
This commit is contained in:
Virgil Dupras 2020-06-04 22:54:27 -04:00
parent e36080d7b8
commit 4af93d53e3
5 changed files with 20 additions and 6 deletions

View File

@ -2,7 +2,7 @@
DUP BEGIN C@+ EOL? UNTIL -^ 1- ;
: _rbufsz ( size of linebuf to the right of curpos )
EDPOS @ 64 MOD 63 -^ ;
: i I ; ( save overshoadowed )
: i COMPILE I ; IMMEDIATE ( save overshadowed )
: I
IBUF _type _rbufsz IBUF _blen 2DUP > IF
TUCK - ( ilen chars-to-move )
@ -12,5 +12,5 @@
ELSE DROP ( ilen becomes rbuffsize )
THEN
DUP IBUF EDPOS @ _cpos ROT MOVE ( ilen )
EDPOS +! EDPOS @ 64 / _pln
BLK!! EDPOS +! EDPOS @ 64 / _pln
;

View File

@ -1,3 +1,6 @@
'H' goes to the beginning of the line, 'L' to the end.
'w' moves forward by a word. 'W' moves backward by a word.
'I' inserts text by calling the "I" command from the Block
editor.

View File

@ -9,5 +9,5 @@ VARIABLE MODE VARIABLE MODEC
: clrscr LINES 0 DO i clrln LOOP ;
: status 0 clrln ." BLK" SPC BLK> ? SPC ACC ?
SPC EDPOS @ 64 /MOD . ',' EMIT . SPC MODEC C@ EMIT ;
: contents 1 aty BLK> @ LIST ;
: contents 3 aty BLK> @ LIST ;
: selblk BLK@ contents ;

View File

@ -1,11 +1,12 @@
: setpos EDPOS @ 64 /MOD
1+ ( status line ) SWAP 3 + ( gutter ) SWAP AT-XY ;
3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ;
: pos+ EDPOS @ + 1024 MOD EDPOS ! ;
: cmv ( n -- , char movement ) acc@ * pos+ ;
: $; 0acc ;
: $g ACC @ selblk 0acc ;
: $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ;
: $I 3 1 AT-XY I contents ;
: $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ;
: $H 0acc EDPOS @ 0x3c0 AND EDPOS ! ;
: $L 0acc EDPOS @ 0x3f OR EDPOS ! ;

14
blk/129
View File

@ -1,3 +1,13 @@
: VE clrscr 0acc 0 EDPOS ! modeM contents
BEGIN status setpos KEY MODE @ EXECUTE UNTIL 18 aty ;
: bufp ( buf -- )
DUP 64 + SWAP DO
i C@ DUP 0x20 < IF DROP 0x20 THEN EMIT
LOOP ;
: bufs
1 aty ." I: " IBUF bufp
2 aty ." F: " FBUF bufp ;
: c<over KEY DUP EMIT DUP 0x0a = IF DROP 0x0d THEN ;
: VE ['] c<over 0x08 ( C< override ) RAM+ !
clrscr 0acc 0 EDPOS ! modeM contents
BEGIN status bufs setpos KEY MODE @ EXECUTE UNTIL
0 0x08 RAM+ ! 19 aty ;