This is not that easy, because your lines can have variable number of characters and could range from a single linefeed to a huge number of characters. You could maintain your data in an array of strings, one element per line.
If all your lines have fixed lenght, you could just calculate the string subsets to keep and things will be a bit easier. Still this will be a lot of data shuffling.
Maybe you could also keep a helper integer array that keeps track of the characters/line. This will also let you calculate how to truncate whenever a line needs to be discarded.
There are many ways to optimize that. You could also simply stream to disk and read a few lines back into an indicator. Use a scroll control to read back earlier data. This would eliminate having thousands of lines in an indicator.