1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 23:28:05 +11:00

VE: disallow buffer overflow during typing

When reaching the end of the buffer when typing in IBUF or FBUF, stop
typing instead of overflowing.
This commit is contained in:
Virgil Dupras 2020-06-11 14:48:18 -04:00
parent 394f962510
commit e83d5073ba

View File

@ -6,5 +6,5 @@
: buftype ( buf ln -- ) : buftype ( buf ln -- )
3 OVER AT-XY C< DUP 0xd = IF 2DROP DROP EXIT THEN 3 OVER AT-XY C< DUP 0xd = IF 2DROP DROP EXIT THEN
( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c ) ( buf ln c ) 63 nspcs SWAP 4 SWAP AT-XY ( buf c )
SWAP DUP _zbuf BEGIN ( c a ) SWAP DUP _zbuf C!+ DUP 63 + SWAP DO
C!+ C< TUCK 0x0d = UNTIL ( c a ) C! ; C< DUP 0x0d = IF LEAVE THEN i C! LOOP ;