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

VE: add W and S movements

This commit is contained in:
Virgil Dupras 2020-06-04 17:22:07 -04:00
parent 77aedd7338
commit 11843cc613
5 changed files with 16 additions and 10 deletions

View File

@ -13,4 +13,4 @@ saved beforehand.
';' resets the modifier ';' resets the modifier
H and L move the cursor by "modifier" characters. J and K, by H and L move the cursor by "modifier" characters. J and K, by
lines. lines. (cont.)

1
blk/122 Normal file
View File

@ -0,0 +1 @@
W moves forward by a word. S moves backward by a word.

View File

@ -1,2 +1,2 @@
'? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 ) '? UPPER NOT [IF] 33 LOAD+ [THEN] DROP ( B158 )
1 2 LOADR+ 1 3 LOADR+

14
blk/127
View File

@ -1,4 +1,5 @@
: setpos POS @ 64 /MOD 1+ ( status line ) AT-XY ; : setpos POS @ 64 /MOD
1+ ( status line ) SWAP 3 + ( gutter ) SWAP AT-XY ;
: pos+ POS @ + 1024 MOD POS ! ; : pos+ POS @ + 1024 MOD POS ! ;
: cmv ( n -- , char movement ) acc@ * pos+ ; : cmv ( n -- , char movement ) acc@ * pos+ ;
: $; 0acc ; : $; 0acc ;
@ -6,10 +7,7 @@
: $[ BLK> @ acc@ - selblk ; : $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ; : $] BLK> @ acc@ + selblk ;
: $H -1 cmv ; : $L 1 cmv ; : $K -64 cmv ; : $J 64 cmv ; : $H -1 cmv ; : $L 1 cmv ; : $K -64 cmv ; : $J 64 cmv ;
: handle ( c -- f ) : $W POS @ BLK( + BEGIN C@+ WS? UNTIL BEGIN C@+ WS? NOT UNTIL
UPPER DUP '0' '9' =><= IF num 0 EXIT THEN 1- BLK( - 1023 MIN POS ! ;
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN : $S POS @ BLK( + BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL
'Q' = ; 1+ BLK( - DUP 0< IF DROP 0 THEN POS ! ;
: VE clrscr 0acc 0 POS ! contents
BEGIN status setpos KEY handle UNTIL 18 aty ;

7
blk/128 Normal file
View File

@ -0,0 +1,7 @@
: handle ( c -- f )
UPPER DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
'Q' = ;
: VE clrscr 0acc 0 POS ! contents
BEGIN status setpos KEY handle UNTIL 18 aty ;