Re: "apply-tag": how to change behavior?
- From: Havoc Pennington <hp redhat com>
- To: Allin Cottrell <cottrell wfu edu>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: "apply-tag": how to change behavior?
- Date: Tue, 10 Jun 2003 14:36:38 -0400
On Tue, Jun 10, 2003 at 12:10:53PM -0400, Allin Cottrell wrote:
I'm working on a simple built-in editor for my program, using a
GtkTextView. I'd like to add dynamic syntax highlighting (simple
example: if a line begins with '#' it's a comment and will be shown in
a different color).
I think the functions I want are gtk_text_buffer_apply_tag() and
gtk_text_buffer_remove_tag(), but I don't want the default behavior of
applying a tag to a specified start-end range, rather I want the tag
to apply "from now until further notice" as the user types.
I guess that to achieve this I need to catch the "apply-tag" signal
for the text buffer and customize the response, but I'm having
difficulty figuring out what the response should look like.
One way you might do this is to connect_after() to insert_text and
have the signal handler apply the tag to the just-inserted text.
You can't really change what apply_tag does, because that will break
most of the API.
You might also look at just using the gtksourceview library, it's
required for gedit and seems like a pretty complete syntax
highlighting solution.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]