Re: GtkSourceView: newbie questions

Paolo Maggi <[email protected]>
Newsgroups gmane.comp.gnome.devtools
Message-ID <[email protected]>
Hi,

> I am new to this list, so please excuse me if these questions are somewhat  
> dumb...

I will try to reply to some of your questions.

> 
> Unfortunately, I have some problems implementing it (see attached  
> screenshot):
> 
> (1) I use gtk_pattern_tag_new() with the pattern
> (^|[[:space:]])_[[:alnum:]]([^_]|\n)*[[:alnum:]]_
> to highlight underlined text (replace the "_" by "*" and "/" to get bold  
> and italic, respectively). For me, the underlying regex mechanism failes  
> for national characters:

I think the problem is due to the fact you use [:alnum:].
I think you should try to match all characters except _

> (2) The pattern above never matches if it contains a newline (hard line  
> break), although it is explicitly included. This is probabely a feature of  
> the regex engine. Would it be possible to add multiline matching through  
> the api?

Multiline matching is not supported. In this case you could try to match
two different regex: "_[^_]*($|_)"  and "^[^_]*_". 
This clearly does not work if the underlined text spans 3 or more lines.

> 
> (3) Sometimes the pattern above is not found if the matched part (i.e. the  
> part between the "_"'s) is wrapped. The following is *sometimes*  
> reproducible:
> - enter text with a highlighted phrase which is wrapped on the screen (has  
> a "soft" newline in it);
> - enter some text above it, and either the part on the first or on the  
> second line will loose the special attribute;
> - adding and erasing a space within the pattern will restore the attribute.
> I activated gtk_text_view_set_wrap_mode(text_view, GTK_WRAP_WORD_CHAR) on  
> the GtkTextView. Any ideas?

No idea. It may be a repainting problem. Please, file a bug in bugzilla.

> 
> (4) Sometimes, more than /one/ pattern should match and add highlighting,  
> e.g. *bold* in a quoted line (see shot). In that case, the quoted line was  
> found by using gtk_line_comment_tag_new() with
> ^([ \\t]*[|>:}#]){2}
> and the bold face as above. Is it possible to tweak GtkSourceView somehow  
> so this case would be treated properly, i.e. the full line has a different  
> foreground colour *and* the word in the red box is bold?

This is not possible. It will be possible in the future.

Regards,
Paolo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.