mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 04:38:05 +11:00
VE: add command 'f'
Kinda proud of this one. Efficiently piggy-backing on the Block Editor, keeping things simple, and yet, building power into the editor.
This commit is contained in:
parent
204a66277e
commit
b22ab8437b
11
blk/122
11
blk/122
@ -6,8 +6,11 @@
|
||||
'I', 'F' and 'E' invoke the corresponding command from the
|
||||
Block Editor (B100). Refer to documentation there.
|
||||
|
||||
'X' deletes "modifier" characters following cursor.
|
||||
'f' puts the contents of your previous cursor movement into the
|
||||
find buffer. If that movement was a forward movement, it brings
|
||||
the cursor back where it was. This allows for an efficient
|
||||
combination of movements and 'E'. For example, if you want to
|
||||
delete the next word, you type 'w', then 'f', then check your
|
||||
"F" buffer to be sure, then press 'E'.
|
||||
|
||||
'R' goes into replace mode at current cursor position.
|
||||
Following keystrokes replace current character and advance
|
||||
cursor. Press return to return to normal mode.
|
||||
'X' deletes "modifier" characters following cursor. (cont.)
|
||||
|
4
blk/123
Normal file
4
blk/123
Normal file
@ -0,0 +1,4 @@
|
||||
'R' goes into replace mode at current cursor position.
|
||||
Following keystrokes replace current character and advance
|
||||
cursor. Press return to return to normal mode.
|
||||
|
3
blk/126
3
blk/126
@ -1,4 +1,5 @@
|
||||
CREATE CMD 2 C, '$' C, 0 C,
|
||||
VARIABLE PREVPOS
|
||||
: 0acc 0 ACC ! ;
|
||||
: acc@ ACC @ 1 MAX 0acc ;
|
||||
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ;
|
||||
@ -10,3 +11,5 @@ CREATE CMD 2 C, '$' C, 0 C,
|
||||
: contents 3 aty BLK> @ LIST ;
|
||||
: selblk BLK@ contents ;
|
||||
: mode! ( c -- ) 63 0 AT-XY ;
|
||||
: pos! EDPOS @ PREVPOS !
|
||||
1023 MIN DUP 0< IF DROP 0 THEN EDPOS ! ;
|
||||
|
3
blk/127
3
blk/127
@ -1,7 +1,6 @@
|
||||
: setpos EDPOS @ 64 /MOD
|
||||
3 + ( header ) SWAP 3 + ( gutter ) SWAP AT-XY ;
|
||||
: pos+ EDPOS @ + 1024 MOD EDPOS ! ;
|
||||
: cmv ( n -- , char movement ) acc@ * pos+ ;
|
||||
: cmv ( n -- , char movement ) acc@ * EDPOS @ + pos! ;
|
||||
: $; 0acc ;
|
||||
: $g ACC @ selblk 0acc ;
|
||||
: $[ BLK> @ acc@ - selblk ;
|
||||
|
9
blk/128
9
blk/128
@ -1,13 +1,12 @@
|
||||
: _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( - _pos! ;
|
||||
1- BLK( - pos! ;
|
||||
: $W EDPOS @ BLK( + acc@ 0 DO
|
||||
1+ BEGIN C@+ WS? NOT UNTIL BEGIN C@+ WS? UNTIL LOOP
|
||||
2- BLK( - _pos! ;
|
||||
2- BLK( - pos! ;
|
||||
: $b EDPOS @ BLK( + acc@ 0 DO
|
||||
1- BEGIN C@- WS? NOT UNTIL BEGIN C@- WS? UNTIL LOOP
|
||||
2+ BLK( - _pos! ;
|
||||
2+ BLK( - pos! ;
|
||||
: $B EDPOS @ BLK( + acc@ 0 DO
|
||||
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP
|
||||
1+ BLK( - _pos! ;
|
||||
1+ BLK( - pos! ;
|
||||
|
4
blk/129
4
blk/129
@ -1,3 +1,7 @@
|
||||
: $f EDPOS @ PREVPOS @ 2DUP = IF 2DROP EXIT THEN
|
||||
2DUP > IF DUP pos! SWAP THEN
|
||||
( p1 p2, p1 < p2 ) OVER - ( pos len ) FBUF _zbuf
|
||||
SWAP _cpos FBUF ( len src dst ) ROT MOVE ;
|
||||
: $R ( replace mode )
|
||||
mode! 'R' EMIT
|
||||
BEGIN setpos C< DUP 0xd = NOT IF
|
||||
|
Loading…
Reference in New Issue
Block a user