I have written a code editor which of course include syntax highlighting.
for the most part it works great. Highlighting is updated in real time while the user types etc.
But here is the problem. If I load (or paste) a large amount of text, it attempts to update the highlighting immediatley . It can highlight the current edit area very quickly, but this is at most a few hundred characters, so its not a problem (like 0.03seconds)
And once the load or paste is completed, keeping the highlight up to date is fine.
Its just during the load/paste the CPU goes to 100%, memory gets consumed (currently using 4.6g, while pasting a 1.5m piece of text)
So what I am trying to figure out, is how best to
a) detect the app is about to embark on a large highlight (I can do this)
b) somehow keep track of areas NOT highlighted, and just do it when it becomes visibile
c) any other idea?
Its not important that text the has not yet been seen be highlighted, but it would need to be as it is scrolled into view etc.