Page overload if you paste too much text in the regex box
Bug Description
Page and browser (and OS) overload if you paste too much text in the regex box
Reproduction steps
largetext.txt Paste the content of this file in the regex box.
Expected Outcome
Probably a character limit in the regex box, for stability reasons Edit: character limit check when text gets pasted
Other details
In the file there are 9.3 milion characters. I somehow pasted by mistake way more than that like 100 and the OS started lagging badly too. I suggest to put a 100k character limit to the regex box or something to prevent the browser to collapse. I am not sure if putting a character check limit would make the match time slower; if so please find another solution.
Browser
Firefox
OS
Windows 10
Maybe a character-limit-check ONLY upon the action of "pasting" text.
When you say regex box do you mean the regular expression input or test string textarea?
regular expression box.
The string box can take a lot of text, no problem.
I see. I pasted the text you linked in Brave and it chewed up 8GB of RAM, was responsive for a couple seconds, then the tab crashed: Error code: Out of Memory but the OS is fine. I'm assuming it has to do with the fact that I have plenty of system memory.
This is somewhat a limitation of codemirror, and my own doing.
- It's all a single line, which makes it very hard to handle for codemirror
- The explanation box becomes absolutely massive, which again, requires a lot of resources.
I don't want to add unnecessary artificial limitations to the app, but I agree that this behavior is not ideal. I will experiment a little bit and see what I can do to make this smoother.
Maybe limit the explaination box only. If the amount of text in the explaination box starts to exceed a number, add a "load more" and warning. Not sure if the majoroty of the overload is given from the regex box tho.
I elected to intercept the paste if it's large and warn the user, see screenshot.