Delete child_anchor from textbuffer

Hi,

Does anyone know how to delete a child_anchor from a text buffer. I read
something about unreffing it, but couldn’t figure out how.

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).

Edwin


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

In [email protected]
“[ruby-gnome2-devel-en] Delete child_anchor from textbuffer.” on Sun,
24 Sep 2006 13:16:15 +0100,
Edwin [email protected] wrote:

Does anyone know how to delete a child_anchor from a text buffer. I read
something about unreffing it, but couldn’t figure out how.

Use Gtk::TextBuffer#delete.

start_iter = buffer.get_iter_at_child_anchor(anchor)
end_iter = buffer.get_iter_at_child_anchor(anchor)
end_iter.forward_char
buffer.delete(start_iter, end_iter)

Gtk::ChildAnchor is represented as a char. See:
http://developer.gnome.org/doc/API/2.4/gtk/GtkTextBuffer.html#gtk-text-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.

Thanks,

kou


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

On Sun, 24 Sep 2006 14:29:35 +0100, Kouhei S. [email protected]
wrote:

buffer.delete(start_iter, end_iter)
Thanks, this works:

But earlier I tried something very similar:

start_iter = buffer.get_iter_at_child_anchor(anchor)
end_iter = buffer.get_iter_at_offset( start_iter.offset + 1 )
buffer.delete(start_iter, end_iter)

and that didn’t work. Any idea why?

You’re right. I fixed the bug.
Great!


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

2006/9/24, Edwin [email protected]:

But earlier I tried something very similar:

start_iter = buffer.get_iter_at_child_anchor(anchor)
end_iter = buffer.get_iter_at_offset( start_iter.offset + 1 )
buffer.delete(start_iter, end_iter)

and that didn’t work. Any idea why?

Really? This works well on my environment.

Thanks,

kou


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs