How is CodeEditorComponent optimized for source code?

The documentation says that it's designed to handle editing of very large files. Thanks to this example in one of my books, I want to experiment and try to create a text editor from scratch and I'm curious how this is done in JUCE from a higher level perspective. 

Well, all the code is there for you to see! :)

The main optimisation is just in modelling it as lines rather than iterating it as a block of text.

Haha. I know, I know. It's just a lot easier trying to get a higher level explanation than trying to understand all the code. :) The code does help a lot though. I've learned a lot from reading JUCE source code.

That's actually how the console "text editor" example in Programming Principles and Practice using C++ is done, I think. It has a Document class that uses a std::list of Lines (alias for a std::vector<char>) and has a neat iterator for iterating through the Document. I thought it was a really neat example for learning STL containers and algorithms and it really made me want to give making a graphical text editor a try.

Anyways, thanks for the reply. I'll definitely be looking at the JUCE source code for ideas.