VE: replace 'W' with 'b' and implement 'W' and 'B'

Which are end-of-word movements.
This commit is contained in:
Virgil Dupras 2020-06-06 21:01:35 -04:00
parent 9d4e9ef08d
commit 204a66277e
5 changed files with 34 additions and 26 deletions

View File

@ -1,6 +1,7 @@
'H' goes to the beginning of the line, 'L' to the end.
'w' moves forward by a word. 'W' moves backward by a word.
'w' moves forward by a word. 'b' moves backward by a word.
'W' moves to end-of-word. 'B' moves backward to end-of-word.
'I', 'F' and 'E' invoke the corresponding command from the
Block Editor (B100). Refer to documentation there.

View File

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

20
blk/128
View File

@ -1,15 +1,13 @@
: _pos! 1023 MIN DUP 0< IF DROP 0 THEN EDPOS ! ;
: $w EDPOS @ BLK( + acc@ 0 DO
BEGIN C@+ WS? UNTIL BEGIN C@+ WS? NOT UNTIL LOOP
1- BLK( - 1023 MIN EDPOS ! ;
1- BLK( - _pos! ;
: $W EDPOS @ BLK( + acc@ 0 DO
1+ BEGIN C@+ WS? NOT UNTIL BEGIN C@+ WS? UNTIL LOOP
2- BLK( - _pos! ;
: $b EDPOS @ BLK( + acc@ 0 DO
1- BEGIN C@- WS? NOT UNTIL BEGIN C@- WS? UNTIL LOOP
2+ BLK( - _pos! ;
: $B EDPOS @ BLK( + acc@ 0 DO
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP
1+ BLK( - DUP 0< IF DROP 0 THEN EDPOS ! ;
: $R ( replace mode )
mode! 'R' EMIT
BEGIN setpos C< DUP 0xd = NOT IF
EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
THEN UNTIL mode! SPC contents ;
: handle ( c -- f )
DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
UPPER 'Q' = ;
1+ BLK( - _pos! ;

22
blk/129
View File

@ -1,13 +1,9 @@
: 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 ! contents
BEGIN status bufs setpos KEY handle UNTIL
0 0x08 RAM+ ! 19 aty ;
: $R ( replace mode )
mode! 'R' EMIT
BEGIN setpos C< DUP 0xd = NOT IF
EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
THEN UNTIL mode! SPC contents ;
: handle ( c -- f )
DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
UPPER 'Q' = ;

13
blk/130 Normal file
View File

@ -0,0 +1,13 @@
: 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 ! contents
BEGIN status bufs setpos KEY handle UNTIL
0 0x08 RAM+ ! 19 aty ;