[gtk: 1/2] Document irreversibility of gtk_text_buffer_set_text




commit 4cbfb69f7483e9bf84dca9fc39ba448d38040a32
Author: Elliott Sales de Andrade <quantum analyst gmail com>
Date:   Sun Sep 4 02:40:41 2022 -0400

    Document irreversibility of gtk_text_buffer_set_text
    
    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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index f4b728df11..1139e8b468 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]