Re: syntax highlighting



There is no in built helper routines to do syntax highlighting in GtkText.
The best you could do would be connect to the insert_text signal, and look
for spaces or other word boundary in that text.  Then call 
gtk_editable_get_chars to get some of the preceding text, so you can find
the start of the word.  Then check if it matches something from a keywords
list.  Now you can call gtk_editable_delete_text on that word, and
reinsert it with gtk_text_insert, setting the correct colour.  I don't
know of any easier way to do this.

James Henstridge.

--
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/


On Thu, 18 Feb 1999, Rodrigo Moya wrote:

> Hi all!
> 
> Could somebody point me to an example on how to do syntax highlighting in a
> GtkText widget? or, if not possible with this widget, to another widget
> class to do so?
> 
> Thanks
> 
> 
> -- 
> To unsubscribe: mail gnome-devel-list-request@gnome.org with "unsubscribe"
> as the Subject.
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]