Undo-redo function for formatted text

I’m looking for a way to have the undo-redo function for formatted text in a Gtk4 Gtk.TextBuffer without having to reimplement the whole gtk_text_history.

I know that, technically, tags and text are totally separate structures but, considering the existence of Gtk.TextBuffer.insert_markup(), it would make perfect sense to save the text on the undo-redo stack in markup format and just use the existing structure of the gtk_text_history to reinsert the text using Gtk.TextBuffer.insert_markup() when needed.

There probably should be a “simple” way to override how gtk_text_history works if you’re a C programmer, but as a python programmer, considering the necessary functions aren’t even exposed to bind, I have no idea the best course of action to take. this problem.

Any suggestion will be highly appreciated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.