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