From b22ab8437b4275e3a47a97ea9792d597f5ed3abd Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 6 Jun 2020 21:46:46 -0400 Subject: [PATCH] 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. --- blk/122 | 11 +++++++---- blk/123 | 4 ++++ blk/126 | 3 +++ blk/127 | 3 +-- blk/128 | 9 ++++----- blk/129 | 4 ++++ blk/130 | 2 +- 7 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 blk/123 diff --git a/blk/122 b/blk/122 index 5228e15..09101ca 100644 --- a/blk/122 +++ b/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.) diff --git a/blk/123 b/blk/123 new file mode 100644 index 0000000..7175e0b --- /dev/null +++ b/blk/123 @@ -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. + diff --git a/blk/126 b/blk/126 index 4a8dfba..1a3fe80 100644 --- a/blk/126 +++ b/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 ! ; diff --git a/blk/127 b/blk/127 index e54cd14..3d4ad1d 100644 --- a/blk/127 +++ b/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 ; diff --git a/blk/128 b/blk/128 index 30ad6b6..8536a4b 100644 --- a/blk/128 +++ b/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! ; diff --git a/blk/129 b/blk/129 index 4c1b4c0..af7af36 100644 --- a/blk/129 +++ b/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 diff --git a/blk/130 b/blk/130 index 12d168b..c538f7e 100644 --- a/blk/130 +++ b/blk/130 @@ -7,7 +7,7 @@ 2 aty ." F: " FBUF bufp ; : c