I've noticed the same thing in the past. After a little experimentation, I believe that it has nothing to do with the line length, but happens when there are more than four keywords in the line. Try this, for example:
oval rect line from paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul paul line
If you type lines following this, they won't be syntax colored, but if you take away one of the keywords from that long line, the following lines will become colorized. Then you can put back the removed word, and the colorization will stay, but new lines typed will again be uncolorized.
I had a look at the source, and I'm not positive, but I think there is a bug.
PyDETextView.PyDETextStorageDelegate._colorize punts after colorizing more than 4 tokens, and I think it doesn't properly schedule a new pass for colorization after that.
Boy, even more weirdness:
If you have a line with four keywords, the next line will only colorize one keyword, then all colorization stops.
oval line from rect oval line
oval line from rect oval ovalHowever, if you type the keyword on the next line, then add something at the beginning of the line that also needs to be colorized, colorization will resume normally. The best way to see this may be using a comment:
If the next line is a comment, it will get colorized, but stop colorization after that.
oval line from rect #nothing ovalHowever, if you type the comment first, then add a keyword at the beginning of that line, colorization resumes normally.
oval line from rect rect #this comment has to be typed before rect oval
We're aware of problems with PyDETextView but haven't got the time and resources to look into it as we're working hard on NodeBox 2 at the moment.
I love the fact that you're putting effort in this issue. If you have a concrete workaround I'll be glad to include it in the source.
All the best,
Frederik
I've encountered similar problems, but by cutting and repasting the code it sorts itself out.
Thanks, Frederik. I know you're focussed on NB2; I didn't really figure this was on your radar. I'll put looking into it on my own to-do list, and let you know if I figure anything out!
Code coloring
Posted by Pachicito on Dec 31, 2009Hello,
I'm running NodeBox on Snow Leopard and every once in a while I seem to run into this problem. After a long line of code, the subsequent lines no longer format the code with colors. All the code is just regular black text. The code still runs fine, but it makes coding and debugging more difficult. Any help is greatly appreciated.
example of long line: boxes.append(Box(random(WIDTH), random(HEIGHT), random(1.0), 1.0, 1.0, 40))
Everything after this line is plain text.
Thanks