VE: add H, J, K, L
This commit is contained in:
parent
c07a594e1a
commit
77aedd7338
5
blk/121
5
blk/121
@ -10,4 +10,7 @@ saved beforehand.
|
|||||||
|
|
||||||
'[' and ']' advance the selected block by modifier.
|
'[' and ']' advance the selected block by modifier.
|
||||||
|
|
||||||
'Return' resets the modifier
|
';' resets the modifier
|
||||||
|
|
||||||
|
H and L move the cursor by "modifier" characters. J and K, by
|
||||||
|
lines.
|
||||||
|
10
blk/126
10
blk/126
@ -1,14 +1,14 @@
|
|||||||
CREATE CMD 2 C, '$' C, 0 C,
|
CREATE CMD 2 C, '$' C, 0 C,
|
||||||
VARIABLE ACC
|
VARIABLE ACC
|
||||||
|
VARIABLE POS
|
||||||
: 0acc 0 ACC ! ;
|
: 0acc 0 ACC ! ;
|
||||||
|
: acc@ ACC @ 1 MAX 0acc ;
|
||||||
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ;
|
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ;
|
||||||
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ;
|
: nspcs ( n -- , spit n space ) 0 DO SPC LOOP ;
|
||||||
: aty 0 SWAP AT-XY ;
|
: aty 0 SWAP AT-XY ;
|
||||||
: clrln DUP aty COLS nspcs aty ;
|
: clrln DUP aty COLS nspcs aty ;
|
||||||
: clrscr LINES 0 DO I clrln LOOP ;
|
: clrscr LINES 0 DO I clrln LOOP ;
|
||||||
: status 0 clrln ." BLK" SPC BLK> ? SPC ACC ? ;
|
: status 0 clrln ." BLK" SPC BLK> ? SPC ACC ?
|
||||||
|
SPC POS @ 64 /MOD . ',' EMIT . ;
|
||||||
: contents 1 aty BLK> @ LIST ;
|
: contents 1 aty BLK> @ LIST ;
|
||||||
: selblk BLK@ 0acc contents ;
|
: selblk BLK@ contents ;
|
||||||
: $G ACC @ selblk ;
|
|
||||||
: $[ BLK> @ ACC @ 1 MAX - selblk ;
|
|
||||||
: $] BLK> @ ACC @ 1 MAX + selblk ;
|
|
||||||
|
12
blk/127
12
blk/127
@ -1,7 +1,15 @@
|
|||||||
|
: setpos POS @ 64 /MOD 1+ ( status line ) AT-XY ;
|
||||||
|
: pos+ POS @ + 1024 MOD POS ! ;
|
||||||
|
: cmv ( n -- , char movement ) acc@ * pos+ ;
|
||||||
|
: $; 0acc ;
|
||||||
|
: $G ACC @ selblk 0acc ;
|
||||||
|
: $[ BLK> @ acc@ - selblk ;
|
||||||
|
: $] BLK> @ acc@ + selblk ;
|
||||||
|
: $H -1 cmv ; : $L 1 cmv ; : $K -64 cmv ; : $J 64 cmv ;
|
||||||
: handle ( c -- f )
|
: handle ( c -- f )
|
||||||
UPPER DUP '0' '9' =><= IF num 0 EXIT THEN
|
UPPER DUP '0' '9' =><= IF num 0 EXIT THEN
|
||||||
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
|
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
|
||||||
'Q' = ;
|
'Q' = ;
|
||||||
: VE clrscr 0acc contents
|
: VE clrscr 0acc 0 POS ! contents
|
||||||
BEGIN status KEY handle UNTIL 18 aty ;
|
BEGIN status setpos KEY handle UNTIL 18 aty ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user