<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am using QScintilla 2.8.4 in my project, together with my own custom lexer. I do this by reimplementing QsciLexerCustom and QsciLexerCustom::styleText() in particular. Now, this is all working fine, except when scrolling down a big file, in which case calls to styleText() become increasingly slower. Say that I open a big file and that I am at the ‘top’ of the file, then there will be a call to styleText() to style the part of the file that is visible in the QScintilla editor. So far so good. Now, say that I scroll down the file by pressing the down key, with the view of reaching the end of the file. As expected, this will result in successive calls to styleText(). However, what I didn’t expect is that the ‘start’ value (passed to styleText()) remains constant (in my quick tests, on Windows, it remains equal to 0 while it goes from 0 to 64 on OS X). The ‘end’ value, however, does increase as you would expect, which means that the further down the file you get, the longer the amount of text styleText() wants you to style. So, could it be that there is an issue with QScintilla somewhere? For now, to avoid this big slow down, I am overriding the ‘start’ value as follows: <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> start = qMax(start, editor()->positionFromLineIndex(editor()->SendScintilla(QsciScintilla::SCI_GETFIRSTVISIBLELINE), 0));<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I wish I didn’t have to do this, but at least it does speed up the styling quite a bit.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Otherwise, on a somewhat related note, I noticed that, more often than not, styleText() gets called when there seems to be no need for it to be called. For example, if I open a file (no matter the size) and don’t move the caret or anything, then styleText() will get continuously called with the same ‘start’ value and an ‘end’ value that takes one of two values.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Cheers, Alan.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>PS: just in case, my current lexer code can be found at <a href="https://github.com/opencor/opencor/blob/master/src/plugins/editing/PrettyCellMLView/src/prettycellmlviewlexer.cpp">https://github.com/opencor/opencor/blob/master/src/plugins/editing/PrettyCellMLView/src/prettycellmlviewlexer.cpp</a>.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>