Best way to create a large read-only text buffer?

I’m writing a “console” for my application to capture the verbose output of my kernel and also allow the user to execute commands. So I want to have a read-only TextEditor for displaying the text. What’s the best way to do this so that when it grows past a certain number of lines, I can trim the first few lines from the beginning to keep it under a specific size?

Or should I be using a different Component for this?

For the user entering commands, that is done with a small, separate single line TextEditor at the bottom of the window.

Whenever I’ve done this, Ive wrapped a StringArray in a Logger.

Whenever text is added, it calls addLines on the Array (which automatically turns it into multiple lines if it has breaks), and then removes strings from the start if the count exceeds the maximum specified. A TextEditor can then be set to display the result of the array’s joinIntoString() (using a newline as a separator) from an async notification.

You don’t need to wrap it in a logger of course, but it makes it easy to set it as a default output if you do.

Duh…I should have known Juce would already have exactly the functionality I need…in a class named, appropriately enough “Logger”.

I should point out that the functionality I described isn’t actually handled by the Logger - that’s what you’d need to implement. The Logger class is just an abstract interface useful for things like this.

[just reread my post, and saw how it reads as if I’m describing what a logger does, when I’m actually describing what I made my class do - which just happened to also be a logger]

LOL…yeah man deceptive advertising! I just looked at Logger…

but still, useful advice. I will provide my own Logger, and also your tips about StringArray and joinIntoString() are exactly what I needed, thanks!