Default GtkTextBuffer handler doesn't accept arbitrary iters
Steps to reproduce
When chaining up in a TextBuffer's insert-text handler, if the iter passed to the default handler is modified, GTK complains, and there seems to be no way to revalidate said iter. Minimal example:
def do_insert_text(self, position, text, length):
position_mark = self.create_mark("test", position)
position_new = self.get_iter_at_mark(position_mark)
Gtk.TextBuffer.do_insert_text(self, position_new, text, -1)
In here the buffer isn't even modified, but getting a new iter and passing it to the default handler makes GTK to fire up the following warning:
Gtk-WARNING **: 22:04:01.122: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/paintables/widgets in the buffer have been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset)
will invalidate all outstanding iterators
Version information
GTK: 4.14.2