This looks like a great day for Leo.  Here is the checkin log for 5820:

QQQ
Wrote and tested an incremental colorer. _reformatBlocks now only colors 
100 lines at a time, and then waits a full second.

The result is instant response, no matter how large the text.

It may be better to wait only 0.5 sec.  [done in 5821]
This should halve the time to complete the drawing, while still allowing 
instant responsiveness.

All unit tests pass, which is an excellent test of coloring.
QQQ

The code is simple.  The crucial _reformatBlocks method, which is itself a 
helper for the contentsChange (note: no final 'd') event handler, now only 
colors 100 lines at a time.  If more lines remain, common code in  
_boundedReformatBlocks sets some ivars, and sets a single-shot that will 
call a new _idleReformatBlocks, which does exactly the same thing, again 
using _boundedReformatBlocks.

To the first and second approximations, the absolute slowdown in the Python 
version of the QSyntaxHighlighter class doesn't matter.  The reason is that 
*Leo's* syntax coloring code (the code called by rehighlight) is already 
much slower than the C++ code.  In any case, Leo now *appears* to color 
large text faster, even though it really doesn't.  Sweet.

Despite initial testing, race conditions could conceivably cause hard 
Python crashes.  But the necessary guards are simple: _reformatBlocks 
clears the new ivars, so even if _idleReformatBlocks gets called "by 
mistake" later, nothing bad will happen.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to