Refreshing a GtkTextView



I'm trying to learn my way around the gtk widgets (using pygtk, specifically, 
though I have reproduced the problem I describe below in C) and I'm currently 
working on a simple syntax-highlighting editor.  Right now, it just turns 
everything green, but it'll get there eventually :)  

The problem I'm having is that when I insert text at the beginning or end of 
the buffer, it does not immediately turn green as it's supposed to.  Instead, 
it appears as ordinary black text, then turns green after the textview 
refreshes -- for example, from a mouse click, another typed character, or the 
cursor blinking.  Oddly enough, text inserted in the middle of the buffer 
(i.e. with at least one character on either side) does not do this.  It turns 
green immediately.

Is there some method to refresh the GtkTextView that I need to invoke after 
applying a tag?

I have tried using the queue_draw and mainiteration methods to refresh the 
view.  This causes text inserted at the end of the buffer to turn green 
immediately if there are multiple lines, but has no effect on text at the 
beginning or at the end of a one-line buffer.  Funky, eh?

The only thing I've gotten to work so far is placing the cursor where it 
already is, which is an ugly hack.

Am I overlooking a refresh method?  Or should I make this a bug report?  I 
have gtk+-2.2.1 installed.  I know 2.2.2-r1 is out, but that would require me 
to compile a new revision of xfree :)

Thanks,

Jason Stitt




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