mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:18:07 +11:00
VE: add backspace support in replace mode
This commit is contained in:
parent
dc368597a6
commit
1871c46614
4
blk/130
4
blk/130
@ -4,7 +4,8 @@
|
||||
SWAP _cpos FBUF ( len src dst ) ROT MOVE ;
|
||||
: $R ( replace mode )
|
||||
mode! 'R' EMIT
|
||||
BEGIN setpos KEY DUP 0x20 >= IF
|
||||
BEGIN setpos KEY DUP BS? IF -1 EDPOS +! DROP 0 THEN
|
||||
DUP 0x20 >= IF
|
||||
DUP EMIT EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0
|
||||
THEN UNTIL mode! SPC contents ;
|
||||
: $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN
|
||||
@ -13,4 +14,3 @@
|
||||
: $D $H 64 icpy
|
||||
acc@ 0 DO 16 EDPOS @ 64 / DO i _mvln- LOOP LOOP
|
||||
BLK!! contents ;
|
||||
|
||||
|
6
blk/387
6
blk/387
@ -1,16 +1,16 @@
|
||||
( handle backspace: go back one char in IN>, if possible, then
|
||||
emit BS + SPC + BS )
|
||||
: (inbs)
|
||||
: _bs
|
||||
( already at IN( ? )
|
||||
IN> @ IN( = IF EXIT THEN
|
||||
IN> @ 1- IN> !
|
||||
BS SPC BS
|
||||
;
|
||||
( del is same as backspace )
|
||||
: BS? DUP 0x7f = SWAP 0x8 = OR ;
|
||||
|
||||
: KEY
|
||||
85 RAM+ @ ( (key) override )
|
||||
?DUP IF EXECUTE ELSE (key) THEN ;
|
||||
|
||||
|
||||
( cont.: read one char into input buffer and returns whether we
|
||||
should continue, that is, whether CR was not met. )
|
||||
|
3
blk/388
3
blk/388
@ -1,10 +1,9 @@
|
||||
: (rdlnc) ( -- c )
|
||||
( buffer overflow? same as if we typed a newline )
|
||||
IN> @ IN) = IF 0x0a ELSE KEY THEN ( c )
|
||||
DUP 0x7f = IF DROP 0x8 THEN ( del? same as backspace )
|
||||
DUP 0x0a = IF DROP 0xd THEN ( lf? same as cr )
|
||||
( bacspace? handle and exit )
|
||||
DUP 0x8 = IF (inbs) EXIT THEN
|
||||
DUP BS? IF _bs EXIT THEN
|
||||
( echo back )
|
||||
DUP EMIT ( c )
|
||||
( write and advance )
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user