TextEditor: saving styles, limiting buffer length

Hello,

I have two questions related to the TextEditor:

  1. I have a TextEditor will multiple font styles and colours, depending on what is displayed (think: IRC style kind of text). This part works very fine. However, the TextEditor instance can be deleted if the user wants to, to be opened again later. I want to display it as it was when the user left. I can copy the text all right and put it back, BUT all the styling is gone! I cannot find a way to store/restore it easily. Does JUCE provide such help?

  2. I’d like to limit the TextEditor length (a few kb for example), but in case of overflow, delete the beginning (like a circular buffer would do automatically). I guess all I can do is check the length and remove the first lines by myself (with awkward use of caret and cut())?

Thanks.