Is there a way to set a style without getting range?

Topics: Developer Forum, User Forum
Mar 31, 2014 at 4:25 AM
Edited Mar 31, 2014 at 4:33 AM
I've noticed that GetRange performs more slowly when it gets text closer to the end of the ScintillaNET control. This becomes a problem if the text is constantly increasing in size. Is there any way to set style on text without calling GetRange? Or a faster way to use GetRange? I've tried creating a Range object and updating its Start and End but that seems to perform the same way as GetRange.

All I really need to do is colorize text differentially. I'm basically just using the ScintillaNET control as the main text window in an application that operates a lot like a telnet client (constantly receives text that could be colored differently, etc.)
Mar 31, 2014 at 6:55 PM
Answered my own question - turns out GetRange isn't the problem. I was doing a scintilla.Text.Length each time I was calling GetRange. The .Length was actually causing the performance decrease, not GetRange. So it's all good, I just figured out a different way to keep track of length dynamically.
Apr 2, 2014 at 3:07 AM
The TextLength property will get you the length of the document without having to create a string object first.

Be advised that this is the byte length, not character length... as has been explained many times in this forum.

Apr 2, 2014 at 10:55 AM
Oh ok, interesting, I could probably work with that. Thanks.