Pasting huge content on Text Editor takes time


#1

Hi,
I am using text editor for showing/editing some content which may go beyond 10000 lines. We do have an option to copy and paste also. So when we paste a 10000 line content , it takes more than 15 secs. Checked in Juce Font demo as well. One of the line which takes more time is
In TextEditor.cpp if (isMultiLine()) newText = newText.replace ("\r\n", "\n");

What would be the effect if we don’t have this only for Multiline. I assumed it could be used by the logic for caret positioning, but in textatom it looks like there is a check for both \r and \n for newline.

So please clarify what would be the effect of commenting this line.


#2

Yep, the TextEditor was never designed to scale to really large files. The CodeEditorComponent does that, but not TextEditor. Could be something we optimise in the future, but no immediate plans to do that.

Not sure TBH, it may be an obsolete check. Would need to test with various input strings and see what happens.