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

VE: add 'o' and 'O'

This commit is contained in:
Virgil Dupras 2020-06-07 07:25:02 -04:00
parent c6016cd429
commit 15acf30ca3
10 changed files with 64 additions and 60 deletions

View File

@ -1,5 +1,5 @@
: U : _U ( U without P, used in VE )
15 EDPOS @ 64 / - 0 DO 15 EDPOS @ 64 / - 0 DO
14 I - _mvln+ 14 I - _mvln+
LOOP P LOOP ;
; : U _U P ;

View File

@ -6,11 +6,11 @@
'I', 'F' and 'E' invoke the corresponding command from the 'I', 'F' and 'E' invoke the corresponding command from the
Block Editor (B100). Refer to documentation there. Block Editor (B100). Refer to documentation there.
'o' inserts a blank line after the cursor. 'O', before.
'f' puts the contents of your previous cursor movement into the 'f' puts the contents of your previous cursor movement into the
find buffer. If that movement was a forward movement, it brings find buffer. If that movement was a forward movement, it brings
the cursor back where it was. This allows for an efficient the cursor back where it was. This allows for an efficient
combination of movements and 'E'. For example, if you want to combination of movements and 'E'. For example, if you want to
delete the next word, you type 'w', then 'f', then check your delete the next word, you type 'w', then 'f', then check your
"F" buffer to be sure, then press 'E'. "F" buffer to be sure, then press 'E'. (cont.)
'X' deletes "modifier" characters following cursor. (cont.)

View File

@ -1,4 +1,5 @@
'X' deletes "modifier" characters following cursor.
'R' goes into replace mode at current cursor position. 'R' goes into replace mode at current cursor position.
Following keystrokes replace current character and advance Following keystrokes replace current character and advance
cursor. Press return to return to normal mode. cursor. Press return to return to normal mode.

View File

@ -1,3 +1,3 @@
'? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 ) '? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 )
-23 LOAD+ ( B102, block editor ) -23 LOAD+ ( B102, block editor )
1 5 LOADR+ 1 6 LOADR+

View File

@ -11,5 +11,3 @@ VARIABLE PREVPOS
: contents 3 aty BLK> @ LIST ; : contents 3 aty BLK> @ LIST ;
: selblk BLK@ contents ; : selblk BLK@ contents ;
: mode! ( c -- ) 63 0 AT-XY ; : mode! ( c -- ) 63 0 AT-XY ;
: pos! EDPOS @ PREVPOS !
1023 MIN DUP 0< IF DROP 0 THEN EDPOS ! ;

15
blk/127
View File

@ -1,14 +1,5 @@
: setpos EDPOS @ 64 /MOD : pos! ( newpos -- ) EDPOS @ PREVPOS !
DUP 0< IF DROP 0 THEN 1023 MIN EDPOS ! ;
: setpos ( -- ) EDPOS @ 64 /MOD
3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ; 3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ;
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ; : cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;
: $; 0acc ;
: $g ACC @ selblk 0acc ;
: $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ;
: $I mode! 'I' EMIT 3 1 AT-XY _I contents mode! SPC ;
: $F mode! 'F' EMIT 3 2 AT-XY _F setpos mode! SPC ;
: $E E contents ;
: $X acc@ X contents ;
: $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ;
: $H 0acc EDPOS @ 0x3c0 AND pos! ;
: $L 0acc EDPOS @ 0x3f OR pos! ;

24
blk/128
View File

@ -1,12 +1,12 @@
: $w EDPOS @ BLK( + acc@ 0 DO : $; 0acc ;
BEGIN C@+ WS? UNTIL BEGIN C@+ WS? NOT UNTIL LOOP : $g ACC @ selblk 0acc ;
1- BLK( - pos! ; : $[ BLK> @ acc@ - selblk ;
: $W EDPOS @ BLK( + acc@ 0 DO : $] BLK> @ acc@ + selblk ;
1+ BEGIN C@+ WS? NOT UNTIL BEGIN C@+ WS? UNTIL LOOP : $I mode! 'I' EMIT 3 1 AT-XY _I contents mode! SPC ;
2- BLK( - pos! ; : $F mode! 'F' EMIT 3 2 AT-XY _F setpos mode! SPC ;
: $b EDPOS @ BLK( + acc@ 0 DO : $E E contents ;
1- BEGIN C@- WS? NOT UNTIL BEGIN C@- WS? UNTIL LOOP : $X acc@ X contents ;
2+ BLK( - pos! ; : $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ;
: $B EDPOS @ BLK( + acc@ 0 DO : $H 0acc EDPOS @ 0x3c0 AND pos! ;
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP : $L 0acc EDPOS @ 0x3f OR pos! ;
1+ BLK( - pos! ;

25
blk/129
View File

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

25
blk/130
View File

@ -1,13 +1,12 @@
: bufp ( buf -- ) : $f EDPOS @ PREVPOS @ 2DUP = IF 2DROP EXIT THEN
DUP 64 + SWAP DO 2DUP > IF DUP pos! SWAP THEN
i C@ DUP 0x20 < IF DROP 0x20 THEN EMIT ( p1 p2, p1 < p2 ) OVER - 64 MIN ( pos len ) FBUF _zbuf
LOOP ; SWAP _cpos FBUF ( len src dst ) ROT MOVE ;
: bufs : $R ( replace mode )
1 aty ." I: " IBUF bufp mode! 'R' EMIT
2 aty ." F: " FBUF bufp ; BEGIN setpos C< DUP 0xd = NOT IF
: c<over KEY DUP EMIT DUP 0x0a = IF DROP 0x0d THEN ; EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
: VE ['] c<over 0x08 ( C< override ) RAM+ ! THEN UNTIL mode! SPC contents ;
clrscr 0acc 0 EDPOS ! 0 PREVPOS ! contents : $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN
BEGIN status bufs setpos KEY handle UNTIL _U EDPOS @ 0x3c0 AND DUP pos! _cpos _zbuf contents ;
0 0x08 RAM+ ! 19 aty ; : $o EDPOS @ 64 < IF EXIT THEN EDPOS @ 64 + EDPOS ! $O ;

16
blk/131 Normal file
View File

@ -0,0 +1,16 @@
: handle ( c -- f )
DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
UPPER 'Q' = ;
: 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 ! 0 PREVPOS ! contents
BEGIN status bufs setpos KEY handle UNTIL
0 0x08 RAM+ ! 19 aty ;