From: Edwin <ed...@tk...> - 2006-09-24 15:00:11
|
On Sun, 24 Sep 2006 14:29:35 +0100, Kouhei Sutou <ko...@co...> wrot= e: > Edwin <ed...@tk...> wrote: > >> Does anyone know how to delete a child_anchor from a text buffer. I r= ead >> something about unreffing it, but couldn't figure out how. > > Use Gtk::TextBuffer#delete. > > start_iter =3D buffer.get_iter_at_child_anchor(anchor) > end_iter =3D buffer.get_iter_at_child_anchor(anchor) > end_iter.forward_char > buffer.delete(start_iter, end_iter) Thanks, this works: But earlier I tried something very similar: start_iter =3D buffer.get_iter_at_child_anchor(anchor) end_iter =3D buffer.get_iter_at_offset( start_iter.offset + 1 ) buffer.delete(start_iter, end_iter) and that didn't work. Any idea why? > > Gtk::ChildAnchor is represented as a char. See: > http://developer.gnome.org/doc/API/2.4/gtk/GtkTextBuffer.html#gtk-te= xt-buffer-insert-child-anchor > >> On a related note there seems to be a bug in get_iter_at_child_anchor= . = >> In >> contrast to the documentation I need to provide two arguments to the >> method, although as far as I can tell it only uses the first argument= = >> (the >> anchor). > > You're right. I fixed the bug. Great! |