On Thu, Mar 19, 2009 at 5:54 AM, Ville M. Vainio <[email protected]> wrote:

>
> On Thu, Mar 19, 2009 at 12:48 PM, Edward K. Ream <[email protected]>
> wrote:
>
> > recolor already contains commented-out code to do this.  You can try to
> put
> > this code back in: I think you will see problems, but I don't recall what
> > they were.
>
> I have some time this evening, I'll try it.


I like your spirit.  Let me give you some hints.  If these work, great.  If
not, I'll attempt a fix between Leo 4.6 b1 and 4.6 final.

Most of the complexities of handling @killcolor, @nocolor and @color resides
in setCurrentState and its helper, compute state name.  This state name gets
turned into an int to be passed to and from QSyntaxHighlighter, but you
should be able to ignore that.  The point is that that state names are a
concatenation of the color-directive state and pattern matcher state.

For example, when @killcolor is in effect, the state will be something like:

killcolor.match_at_killcolor:@killcolor

To see this, enable tracing in setCurrentState.

Important: this kind of state is *not* optional.  It is necessary so that
text changes that affect color directives are handled correctly.

Enough of background.  There are two possible ways in recolor to attempt to
shortcut coloring when @killcolor is in effect:

1.  Test self.all_s.startswith('@killcolor')

The problem with using all_s may be keeping it up to date.  We don't want to
call w.getAllText on every call to recolor!

2.  Let b = self.getPrevState()  Test b.stateName.startswith('@killcolor')

BTW, at present recolor probably does not use b.stateName at all.

I am not going to do either of these myself just now, because experience has
shown that "five minutes" work on the colorizer tends to turn into five
hours :-)  I've got to tear myself away from such fun and fix the remaining
urgent bugs that must be fixed before b1.

HTH.

Edward

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to