Discussion:
Iterate efficiently over Scintillas Text
Charly Dante
2014-02-27 12:23:29 UTC
Permalink
Hi,

I have a question regarding the Scintilla Edits Control Text. I use the
UpdateUI event to perform Brace-Highlighting. To search and handle nested
Braces, I need to iterate backwards over the text of the current line. At
the moment I use this method to get the text of the edit control:

length = SendMessage(scintillaWindow, SCI_GETLENGTH, 0, 0) + 1;
const char* sciText = new const char[length];
SendMessage(AppWindows::sciEditHwnd, SCI_GETTEXT, length, (LPARAM)sciText);

I wounder if this is the preferable solution? I found in the documentation
also the SCI_GETCHARAT message, which could also be used to do this without
allocating a new array on the heap... However, is this message also suited
for iterating over text, which would mean that it is called very often in a
loop? Also I found SCI_GETCHARACTERPOINTER message in the documentation,
so...

What is the best and most efficient way to iterate over the text of the
Scintilla control?

Thanks in advance and Best Regards,
CD
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-02-27 21:45:41 UTC
Permalink
What is the best and most efficient way to iterate over the text of the Scintilla control?
There are multiple good ways to iterate over Scintilla text. Try SCI_GETCHARAT and if that is too slow then implement a buffered reader like SciTE's TextReader class.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Charly Dante
2014-02-28 10:49:00 UTC
Permalink
The TextReader class looks very interesting, that was the keyword I was
looking for.

Thanks!
Post by Charly Dante
Post by Charly Dante
What is the best and most efficient way to iterate over the text of the
Scintilla control?
There are multiple good ways to iterate over Scintilla text. Try
SCI_GETCHARAT and if that is too slow then implement a buffered reader like
SciTE’s TextReader class.
Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...