1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-30 20:08:06 +11:00

ed: make X and E cut to IBUF

This allows cut&paste similar to VI's
This commit is contained in:
Virgil Dupras 2020-06-09 22:09:15 -04:00
parent f90e03b0cb
commit 1adfd0c1a6
2 changed files with 9 additions and 6 deletions

View File

@ -12,4 +12,5 @@ F xxx: find typed FBUF in block, starting from current
position+1. If not found, don't move. position+1. If not found, don't move.
I xxx: insert typed IBUF at cursor. "I" shadows core word. Use I xxx: insert typed IBUF at cursor. "I" shadows core word. Use
"i" to access it. "i" to access it.
E: From cursor, delete X characters, X = length of FBUF. X ( n -- ): Delete X chars after cursor and place in IBUF.
E: Run X with n = length of FBUF.

12
blk/112
View File

@ -1,8 +1,10 @@
: X ( len -- , delete len chars after curpos ) : icpy ( n -- copy n chars from cursor to IBUF )
EDPOS @ _cpos 2DUP + ( l a1 a1+l ) IBUF _zbuf EDPOS @ _cpos IBUF ( n a buf ) ROT MOVE ;
SWAP _rbufsz MOVE ( l ) : X ( n -- )
( get to next line - l ) DUP icpy EDPOS @ _cpos 2DUP + ( n a1 a1+n )
DUP EDPOS @ 0xffc0 AND 0x40 + -^ _cpos ( l a ) SWAP _rbufsz MOVE ( n )
( get to next line - n )
DUP EDPOS @ 0xffc0 AND 0x40 + -^ _cpos ( n a )
SWAP 0 FILL SWAP 0 FILL
EDPOS @ 64 / _pln ; EDPOS @ 64 / _pln ;
: E FBUF _blen X ; : E FBUF _blen X ;