ColorizeScript challenge

Geoff Canyon gcanyon at inspiredlogic.com
Thu Apr 27 06:42:31 CDT 2006


On Apr 26, 2006, at 11:46 PM, Brian Yennie wrote:

> I've been silently following this thread, and one more out-of-the- 
> box idea comes to mind. What about just colorizing the lines of the  
> script currently visible in the editor, and updating when the user  
> scrolls? If that limited the whole job to say, 50 lines of script,  
> would the original slower, simpler version of the script suffice?
>
> It might not give live scrolling in color - but the update could  
> still be snappy enough to not slow down anyone actually reading the  
> script?

My current effort does roughly 400 lines per tick on a 1ghz machine,  
not counting setting the htmlText. (note that it doesn't handle block  
comments, among other things)

More importantly, it seems to scale linearly. Colorizing a script  
four times as long as the libURL script takes four times as long as  
the libURL script.

Given that, it would be nice to be able to handle truly mammoth  
scripts. I think you're right that it would require some sort of  
color-on-the-fly-as-you-scroll method. Given the speeds we've  
reached, live colorization while scrolling doesn't seem out of the  
question.

regards,

gc


More information about the metacard mailing list