Heh-heh, yes that for loop does look better :-) I'll use that. Textview is awesome and will save me thousands of lines of code, but not being able to apply a tag to an iter -- that has been a big drawback for me. You can discover a tag at an iter, but only apply/remove it to a range. It would be great to be able to apply a style tag at an iter (including in a blank line) and then have text inserted their use that tag.
One more suggestion for GTK Textview -- this is about the margin and indent tags. I found that you can apply those tags anywhere in a line and even multiple times. So in a 100-char line, you can have chars 33-45 with an indent of 100px, and chars 63-88 with an indent of -50px, etc. And in addition various left-margins. When you move the cursor through such a line, the cursor bounces around like crazy and the line is reformatted back and forth. I cannot imagine why anyone would want this. Such tags should only apply to whole lines, and only one indent or left-margin tag per line. As it is, the applied indent and margin tags are hard to manage and cause too much trouble. On Tue, Aug 15, 2017 at 11:34 AM, <[email protected]> wrote: > > > Hi Doug, > > I made a bit of a pointer mess there. Not the best of answers or way to go > about iterating through a list. Looking at some GTK code, this is better > done with a for loop. As usual, you don't want to move the pointer you get > from gtk_text_iter_get_tags() and then free it. This will cause you grief > later on along with buggy code that may not be so easy to debug. > > Very glad you got things working well even with a less than good answer. > Need to be careful of the pointers myself. > > Eric > > > GSList *tlist=NULL; > GSList *p=NULL; > tlist=gtk_text_iter_get_tags(&start); > g_print("List %p p %p\n", tlist, p); > for(p=tlist;p;p=p->next) > { > gchar *string=NULL; > g_object_get(G_OBJECT(p->data), "name", &string, NULL); > g_print("p %p %s\n", p, string); > g_free(string); > } > > g_print("List %p\n", tlist); > if(tlist!=NULL) g_slist_free(tlist); > -- Doug McCasland <[email protected]> _______________________________________________ gtk-app-devel-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
