# syntax coloring



## zerorex (Jan 18, 2003)

Hello,
    Ive been working on a text editor, and have finally been able too get 90% of what I want, the problem i have now, is the method by which i am applying my syntax coloring.  It works, but is applyed by a loop.  As the document being colored gets longer, the longer the loop takes to complete.  At this point, it gets intollerable at around 300 lines, which is a problem. 

If anyone has any advice, or suggestions, i would be much abliged. 

Z


----------



## wiz (Jan 21, 2003)

how about get it to listen to a keystroke event in the textarea. and if the series of keystroke events match a pattern, colour it!

or something like that...


----------



## wiz (Jan 21, 2003)

or simply get a seperate thread to do the colouring .


----------



## gumse (Jan 22, 2003)

You should probably just check the word you have just typed. Check the previous word when the user types a space, tab etc. or when the user wants to leave the editpoint with a mouse click.


----------



## r4bid (Jan 22, 2003)

Don't waste time checking text that has not changed...  As gumse suggested, only check the word that has just been typed or any word that has been modified by something that was just typed.


----------



## zerorex (Jan 23, 2003)

I was actually able to minimze the slow down by only treating the 1000 characters around the edit point.  I did some reading, and this seemed to be a common method.  Right now, Im looking at the possiblity of handeling the coloring in a slightly different fation, and or placing the coloring in a seperate thread as wiz suggested. 

thanks for the suggestions..

Z


----------



## cthulhu (Jan 27, 2003)

just look on www.gnustep.org .... and download the projectbuilder for gnustep...it is gpl.... the syntax highlighting there is pretty good ..... you will just need to make somes little modification to have it on your text editor


----------



## cthulhu (Jan 27, 2003)

Errata Corrige:
ftp://ftp.gnustep.org/pub/gnustep/dev-apps/


download here the project center


----------

