Skip to content

If you backspace over the INPUT prompt "? " and enter text it hangs or throws a JS exception #47

@mobluse

Description

@mobluse

If you backspace over the INPUT prompt "? " and enter text it hangs or throws a JS exception. Run the test program below and press BACKSPACE once and then e.g. P and Enter; the browser tab hangs after a while. If you delete more before entering text, you get: "EXCEPTION RangeError: Invalid string length". I think it would be better if backing over the prompt was disallowed (as it is in your pcbasic) or it didn't hang or threw an exception, but instead sent the typed characters and ignored more backspaces than was needed. Now there is a great risk that a user hangs a program that they have worked with, to get a result, for a long time.
2022-02-06-001601_710x904_scrot

1000 A=100: GOTO 20: REM INPUT TEST
1010 INPUT "ENTER A STRING";A$
1020 PRINT "THE STRING IS: ";A$
1030 GOTO 1010
30000 REM DEMONSTRATES A BUG IN INPUT
30010 REM ENTER BACKSPACE AND A CHARACTER AND ENTER: IT HANGS.
30030 REM ENTER SEVERAL BACKSPACES AND A CHARACTER: A JS EXCEPTION.
30040 REM WHAT I EXPECTED: EITHER THAT BACKSPACE WOULDN'T BACK
30050 REM OVER THE PROMPT "? ", OR THAT IT WOULD ACCEPT THE TYPED
30060 REM CHARACTERS AS INPUT.

I use Chromium Version 92.0.4515.98 (Official Build) Built on Raspbian , running on Raspbian 10 (32-bit), on Raspberry Pi 4 B 8 GiB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions