Re: [gedit-list] gtk_source_buffer_iter_has_context_class problems



Chuchi Perriman wrote:
>
>
> 2010/3/2 Jesse van den Kieboom <jessevdk gnome org
> <mailto:jessevdk gnome org>>
>
>     Chuchi Perriman wrote:
>     > Hi!!
>     >
>     > I'm having problems using:
>     >
>     > gtk_source_buffer_iter_has_context_class(buffer, &copy, "char")
>     >
>     > When I use gtk_source_buffer_iter_has_context_class(buffer, &copy,
>     > "string"), gtksourceview works fine ("comment" context too).
>     >
>     > I'm trying to get a character like '(' or '\n' etc. but I cannot
>     fo it :(
>     I don't know. If you added the context classes in the lang file, it
>     should work just like for string and comment...
>
>
> I'm using the c.lang file and there is a "char" context but it doesn't
> work.
Maybe it's not what you meant, but a context _class_ is not the same as
a context. They have to be specifically assigned. This is because
contexts are used for highlighting and might have no significant
meaning, other than coloring some text. Therefore, context classes are
assigned separately (look at c.lang and the class/class-disabled
attributes on some of the contexts).
>  
>
>     >
>     > I've looked in the .lang file and I have tried with "char" and
>     > "character" context name but does't work.
>     >
>     > Can you help me?
>     >
>     > Thanks!!!
>     >
>     > PD: gtk_source_buffer_iter_has_context_class works if
>     highlighting is
>     > disabled?
>     Nope
>
>
> Doh!! I suppose it :) Then I cannot use it for the indentation :(
I don't know. We could think about this. In principle, the context
classes are decoupled from the actual highlighting. It's just that since
it was not needed before, it simply doesn't analyse the text when you
disable highlighting. We can (quite easily) disable only highlighting,
while keeping the analysis (and thus the context classes). Other than
that, we could also just for the start say that you can only have smart
indentation with highlighting enabled (maybe bit weird, but covers a
large part of the use case).

On the other hand, you might not need to use context classes for
everything. I would think that just being able to skip strings and
comments will already be pretty good. The other needed analysis of the
text (newlines, opening parenthesis) you can do using the GtkTextIter API.
>
> Thanks again Jesse
>  
>
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > gedit-list mailing list
>     > gedit-list gnome org <mailto:gedit-list gnome org>
>     > http://mail.gnome.org/mailman/listinfo/gedit-list
>     >
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gedit-list mailing list
> gedit-list gnome org
> http://mail.gnome.org/mailman/listinfo/gedit-list
>   



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