A very long day yesterday working on #380 
<https://github.com/leo-editor/leo-editor/issues/380>. Rev 4b5b744 is, I 
think, significantly better than previous versions, so I have chosen to 
push it for your testing, despite problems discussed below.

I am eating my own dog food, and will push corrections for any serious 
problems immediately. It's likely that I'll find problems before you do, 
but do please report any problem not discussed here.

The colorizer now handles interspersed @language, @color, @nocolor, 
@nocolor-node, @killcolor directives well when initially colorizing a node. 
In the majority of cases, that's all that is needed.

Deleting @nocolor directives is still a problem, as is inserting and 
deleting @language directives. The symptom of these problems is that 
QSyntaxHighlighter doesn't call Leo's colorizer for enough lines. Probably 
a subtle bug in Leo's code, or a misunderstanding of how QSyntaxHighlighter 
works. I *might* be a bug in the Qt code, but that's unlikely.

This is an extremely hard problem, much harder than the problem pyzo has 
solved. I am considering adding a recolor command that would force a full 
recolor.  That might also be useful for debugging.

Edward

P.S.  A few technical notes.  Studying pyzo's code has not helped (because 
Leo must solve a harder problem), but studying pyzo's *behavior* has been 
useful.

Pyzo treats docstrings like Leo presently treats all forms of strings.  
Typing """ or ''' causes the "polarity" of all following code to switch.  
There is *no* reasonable alternative to this behavior.  Not colorizing 
unterminated docstrings at all would be off-putting, and once colorizing 
begins, there is no feasible way to know when to end the colorizing.

pyzo has no problem distinguishing docstrings from regular strings.  Leo's 
general pattern-based matchers do. I will likely add a hack to the 
match_span matcher and its restart method so that Leo can use pyzo's scheme 
of marking unterminated single-quoted strings with dotted underlines.

EKR

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to