Document irreversibility of gtk_text_buffer_set_text
authorElliott Sales de Andrade <quantum.analyst@gmail.com>
Sun, 4 Sep 2022 06:40:41 +0000 (02:40 -0400)
committerElliott Sales de Andrade <quantum.analyst@gmail.com>
Sun, 4 Sep 2022 06:47:57 +0000 (02:47 -0400)
If you've begun a user action and call `gtk_text_buffer_set_text`, you
get an unexpected warning:
```
Gtk-WARNING **: Cannot begin irreversible action while in user action
```
which can be fixed by doing the delete/insert yourself. But this is not
documented as occurring, so document it.

gtk/gtktextbuffer.c

index f4b728df11886229b03a350e96817eaa22755d12..1139e8b4688d7633fd2eb5047db3746c26b25ff0 100644 (file)
@@ -1145,7 +1145,10 @@ gtk_text_buffer_get_tag_table (GtkTextBuffer *buffer)
  * @text: UTF-8 text to insert
  * @len: length of @text in bytes
  *
- * Deletes current contents of @buffer, and inserts @text instead.
+ * Deletes current contents of @buffer, and inserts @text instead. This is
+ * automatically marked as an irreversible action in the undo stack. If you
+ * wish to mark this action as part of a larger undo operation, call
+ * [method@TextBuffer.delete] and [method@TextBuffer.insert] directly instead.
  *
  * If @len is -1, @text must be nul-terminated.
  * @text must be valid UTF-8.