Stores attributed text for display in a
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
Derives from
<gobject>
.This class defines the following slots:
tag-table
- Text Tag Table
text
- Current text of the buffer
has-selection
- Whether the buffer has some text currently selected
cursor-position
- The position of the insert mark (as offset from the beginning of the buffer)
copy-target-list
- The list of targets this buffer supports for clipboard copying and DND source
paste-target-list
- The list of targets this buffer supports for clipboard pasting and DND destination
The changed signal is emitted when the content of a
<gtk-text-buffer>
has changed.
<gtk-text-iter>
) (arg1 <gchararray>
) (arg2 <gint>
)The insert_text signal is emitted to insert text in a
<gtk-text-buffer>
. Insertion actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the location iter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text.
See also:
gtk-text-buffer-insert
,gtk-text-buffer-insert-range
.
<gtk-text-iter>
) (arg1 <gdk-pixbuf>
)The insert_pixbuf signal is emitted to insert a
<gdk-pixbuf>
in a<gtk-text-buffer>
. Insertion actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the location iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted pixbuf.
See also:
gtk-text-buffer-insert-pixbuf
.
<gtk-text-iter>
) (arg1 <gtk-text-child-anchor>
)The insert_child_anchor signal is emitted to insert a
<gtk-text-child-anchor>
in a<gtk-text-buffer>
. Insertion actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the location iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted anchor.
See also:
gtk-text-buffer-insert-child-anchor
.
<gtk-text-iter>
) (arg1 <gtk-text-iter>
)The delete_range signal is emitted to delete a range from a
<gtk-text-buffer>
.Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them). The default signal handler revalidates the start and end iters to both point point to the location where text was deleted. Handlers which run after the default handler (see
g-signal-connect-after
) do not have access to the deleted text.See also:
gtk-text-buffer-delete
.
The modified_changed signal is emitted when the modified bit of a
<gtk-text-buffer>
flips.See also:
gtk-text-buffer-set-modified
.
<gtk-text-iter>
) (arg1 <gtk-text-mark>
)The mark_set signal is emitted as notification after a
<gtk-text-mark>
is set.See also:
gtk-text-buffer-create-mark
,gtk-text-buffer-move-mark
.
<gtk-text-mark>
)The mark_deleted signal is emitted as notification after a
<gtk-text-mark>
is deleted.See also:
gtk-text-buffer-delete-mark
.
<gtk-text-tag>
) (arg1 <gtk-text-iter>
) (arg2 <gtk-text-iter>
)The apply_tag signal is emitted to apply a tag to a range of text in a
<gtk-text-buffer>
. Applying actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them).
See also:
gtk-text-buffer-apply-tag
,gtk-text-buffer-insert-with-tags
,gtk-text-buffer-insert-range
.
<gtk-text-tag>
) (arg1 <gtk-text-iter>
) (arg2 <gtk-text-iter>
)The remove_tag signal is emitted to remove all occurrences of tag from a range of text in a
<gtk-text-buffer>
. Removal actually occurs in the default handler.Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them).
See also:
gtk-text-buffer-remove-tag
.
The begin_user_action signal is emitted at the beginning of a single user-visible operation on a
<gtk-text-buffer>
.See also:
gtk-text-buffer-begin-user-action
,gtk-text-buffer-insert-interactive
,gtk-text-buffer-insert-range-interactive
,gtk-text-buffer-delete-interactive
,gtk-text-buffer-backspace
,gtk-text-buffer-delete-selection
.
The end_user_action signal is emitted at the end of a single user-visible operation
<gtk-text-buffer>
.See also:
gtk-text-buffer-end-user-action
,gtk-text-buffer-insert-interactive
,gtk-text-buffer-insert-range-interactive
,gtk-text-buffer-delete-interactive
,gtk-text-buffer-backspace
,gtk-text-buffer-delete-selection
,gtk-text-buffer-backspace
.
<gtk-text-tag-table>
) ⇒ (ret <gtk-text-buffer>
)Creates a new text buffer.
- table
- a tag table, or NULL to create a new one
- ret
- a new text buffer
<gtk-text-buffer>
) ⇒ (ret int
)Obtains the number of lines in the buffer. This value is cached, so the function is very fast.
- buffer
- a
<gtk-text-buffer>
- ret
- number of lines in the buffer
<gtk-text-buffer>
) ⇒ (ret int
)Gets the number of characters in the buffer; note that characters and bytes are not the same, you can't e.g. expect the contents of the buffer in string form to be this many bytes long. The character count is cached, so this function is very fast.
- buffer
- a
<gtk-text-buffer>
- ret
- number of characters in the buffer
<gtk-text-buffer>
) ⇒ (ret <gtk-text-tag-table>
)Get the
<gtk-text-tag-table>
associated with this buffer.
- buffer
- a
<gtk-text-buffer>
- ret
- the buffer's tag table
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (stext scm
)Inserts len bytes of text at position iter. If len is -1, text must be nul-terminated and will be inserted in its entirety. Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. iter is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text.
- buffer
- a
<gtk-text-buffer>
- iter
- a position in the buffer
- text
- UTF-8 format text to insert
- len
- length of text in bytes, or -1
<gtk-text-buffer>
) (stext scm
)Simply calls
gtk-text-buffer-insert
, using the current cursor position as the insertion point.
- buffer
- a
<gtk-text-buffer>
- text
- some text in UTF-8 format
- len
- length of text, in bytes
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (stext scm
) (default_editable bool
) ⇒ (ret bool
)Like
gtk-text-buffer-insert
, but the insertion will not occur if iter is at a non-editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive).default-editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of
gtk-text-view-get-editable
is appropriate here.
- buffer
- a
<gtk-text-buffer>
- iter
- a position in buffer
- text
- some UTF-8 text
- len
- length of text in bytes, or -1
- default-editable
- default editability of buffer
- ret
- whether text was actually inserted
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Copies text, tags, and pixbufs between start and end (the order of start and end doesn't matter) and inserts the copy at iter. Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from buffer, the two buffers must share the same tag table.
Implemented via emissions of the insert_text and apply_tag signals, so expect those.
- buffer
- a
<gtk-text-buffer>
- iter
- a position in buffer
- start
- a position in a
<gtk-text-buffer>
- end
- another position in the same buffer as start
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (stext scm
) (tag_list glist-of
)Inserts text into buffer at iter, applying the list of tags to the newly-inserted text. The last tag specified must be NULL to terminate the list. Equivalent to calling
gtk-text-buffer-insert
, thengtk-text-buffer-apply-tag
on the inserted text;gtk-text-buffer-insert-with-tags
is just a convenience function.
- buffer
- a
<gtk-text-buffer>
- iter
- an iterator in buffer
- text
- UTF-8 text
- len
- length of text, or -1
- first-tag
- first tag to apply to text
- ...
- NULL-terminated list of tags to apply
<gtk-text-buffer>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Deletes text between start and end. The order of start and end is not actually relevant;
gtk-text-buffer-delete
will reorder them. This function actually emits the "delete_range" signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the start and end will be re-initialized to point to the location where text was deleted.
- buffer
- a
<gtk-text-buffer>
- start
- a position in buffer
- end
- another position in buffer
<gtk-text-buffer>
) (start_iter <gtk-text-iter>
) (end_iter <gtk-text-iter>
) (default_editable bool
) ⇒ (ret bool
)Deletes all editable text in the given range. Calls
gtk-text-buffer-delete
for each editable sub-range of [start,end). start and end are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted.
- buffer
- a
<gtk-text-buffer>
- start-iter
- start of range to delete
- end-iter
- end of range
- default-editable
- whether the buffer is editable by default
- ret
- whether some text was actually deleted
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (interactive bool
) (default_editable bool
) ⇒ (ret bool
)Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter. In the normal case a single character will be deleted, but when combining accents are involved, more than one character can be deleted, and when precomposed character and accent combinations are involved, less than one character will be deleted.
Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the iter will be re-initialized to point to the location where text was deleted.
- buffer
- a
<gtk-text-buffer>
- iter
- a position in buffer
- interactive
- whether the deletion is caused by user interaction
- default-editable
- whether the buffer is editable by default
- ret
- ‘
#t
’ if the buffer was modifiedSince 2.6
<gtk-text-buffer>
) (stext scm
)Deletes current contents of buffer, and inserts text instead. If len is -1, text must be nul-terminated. text must be valid UTF-8.
- buffer
- a
<gtk-text-buffer>
- text
- UTF-8 text to insert
- len
- length of text in bytes
<gtk-text-buffer>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
) (include_hidden_chars bool
) ⇒ (ret mchars
)Returns the text in the range [start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include-hidden-chars is ‘
#f
’. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast withgtk-text-buffer-get-slice
.
- buffer
- a
<gtk-text-buffer>
- start
- start of a range
- end
- end of a range
- include-hidden-chars
- whether to include invisible text
- ret
- an allocated UTF-8 string
<gtk-text-buffer>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
) (include_hidden_chars bool
) ⇒ (ret mchars
)Returns the text in the range [start,end). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if include-hidden-chars is ‘
#f
’. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast withgtk-text-buffer-get-text
. Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer.
- buffer
- a
<gtk-text-buffer>
- start
- start of a range
- end
- end of a range
- include-hidden-chars
- whether to include invisible text
- ret
- an allocated UTF-8 string
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (pixbuf <gdk-pixbuf>
)Inserts an image into the text buffer at iter. The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for pixbufs, but the "text" variants do not. e.g. see
gtk-text-buffer-get-slice
andgtk-text-buffer-get-text
.
- buffer
- a
<gtk-text-buffer>
- iter
- location to insert the pixbuf
- pixbuf
- a
<gdk-pixbuf>
<gtk-text-buffer>
) (iter <gtk-text-iter>
) (anchor <gtk-text-child-anchor>
)Inserts a child widget anchor into the text buffer at iter. The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode "object replacement character" 0xFFFC. Note that the "slice" variants for obtaining portions of the buffer as a string include this character for child anchors, but the "text" variants do not. e.g. see
gtk-text-buffer-get-slice
andgtk-text-buffer-get-text
. Considergtk-text-buffer-create-child-anchor
as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion.
- buffer
- a
<gtk-text-buffer>
- iter
- location to insert the anchor
- anchor
- a
<gtk-text-child-anchor>
<gtk-text-buffer>
) (iter <gtk-text-iter>
) ⇒ (ret <gtk-text-child-anchor>
)This is a convenience function which simply creates a child anchor with
gtk-text-child-anchor-new
and inserts it into the buffer withgtk-text-buffer-insert-child-anchor
. The new anchor is owned by the buffer; no reference count is returned to the caller ofgtk-text-buffer-create-child-anchor
.
- buffer
- a
<gtk-text-buffer>
- iter
- location in the buffer
- ret
- the created child anchor
<gtk-text-buffer>
) (mark_name mchars
) (where <gtk-text-iter>
) (left_gravity bool
) ⇒ (ret <gtk-text-mark>
)Creates a mark at position where. If mark-name is ‘
#f
’, the mark is anonymous; otherwise, the mark can be retrieved by name usinggtk-text-buffer-get-mark
. If a mark has left gravity, and text is inserted at the mark's current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (left-gravity = ‘#f
’), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you're typing).The caller of this function does not own a reference to the returned
<gtk-text-mark>
, so you can ignore the return value if you like. Marks are owned by the buffer and go away when the buffer does.Emits the "mark_set" signal as notification of the mark's initial placement.
- buffer
- a
<gtk-text-buffer>
- mark-name
- name for mark, or ‘
#f
’- where
- location to place mark
- left-gravity
- whether the mark has left gravity
- ret
- the new
<gtk-text-mark>
object
<gtk-text-buffer>
) (mark <gtk-text-mark>
) (where <gtk-text-iter>
)Moves mark to the new location where. Emits the "mark_set" signal as notification of the move.
- buffer
- a
<gtk-text-buffer>
- mark
- a
<gtk-text-mark>
- where
- new location for mark in buffer
<gtk-text-buffer>
) (name mchars
) (where <gtk-text-iter>
)Moves the mark named name (which must exist) to location where. See
gtk-text-buffer-move-mark
for details.
- buffer
- a
<gtk-text-buffer>
- name
- name of a mark
- where
- new location for mark
<gtk-text-buffer>
) (mark <gtk-text-mark>
)Deletes mark, so that it's no longer located anywhere in the buffer. Removes the reference the buffer holds to the mark, so if you haven't called
g-object-ref
on the mark, it will be freed. Even if the mark isn't freed, most operations on mark become invalid. There is no way to undelete a mark.gtk-text-mark-get-deleted
will return TRUE after this function has been called on a mark;gtk-text-mark-get-deleted
indicates that a mark no longer belongs to a buffer. The "mark_deleted" signal will be emitted as notification after the mark is deleted.
- buffer
- a
<gtk-text-buffer>
- mark
- a
<gtk-text-mark>
in buffer
<gtk-text-buffer>
) (name mchars
)Deletes the mark named name; the mark must exist. See
gtk-text-buffer-delete-mark
for details.
- buffer
- a
<gtk-text-buffer>
- name
- name of a mark in buffer
<gtk-text-buffer>
) (name mchars
) ⇒ (ret <gtk-text-mark>
)Returns the mark named name in buffer buffer, or NULL if no such mark exists in the buffer.
- buffer
- a
<gtk-text-buffer>
- name
- a mark name
- ret
- a
<gtk-text-mark>
, or NULL
<gtk-text-buffer>
) ⇒ (ret <gtk-text-mark>
)Returns the mark that represents the cursor (insertion point). Equivalent to calling
gtk-text-buffer-get-mark
to get the mark named "insert", but very slightly more efficient, and involves less typing.
- buffer
- a
<gtk-text-buffer>
- ret
- insertion point mark
<gtk-text-buffer>
) ⇒ (ret <gtk-text-mark>
)Returns the mark that represents the selection bound. Equivalent to calling
gtk-text-buffer-get-mark
to get the mark named "selection_bound", but very slightly more efficient, and involves less typing.The currently-selected text in buffer is the region between the "selection_bound" and "insert" marks. If "selection_bound" and "insert" are in the same place, then there is no current selection.
gtk-text-buffer-get-selection-bounds
is another convenient function for handling the selection, if you just want to know whether there's a selection and what its bounds are.
- buffer
- a
<gtk-text-buffer>
- ret
- selection bound mark
<gtk-text-buffer>
) ⇒ (ret bool
)Indicates whether the buffer has some text currently selected.
- buffer
- a
<gtk-text-buffer>
- ret
- ‘
#t
’ if the there is text selectedSince 2.10
<gtk-text-buffer>
) (where <gtk-text-iter>
)This function moves the "insert" and "selection_bound" marks simultaneously. If you move them to the same place in two steps with
gtk-text-buffer-move-mark
, you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.
- buffer
- a
<gtk-text-buffer>
- where
- where to put the cursor
<gtk-text-buffer>
) (ins <gtk-text-iter>
) (bound <gtk-text-iter>
)This function moves the "insert" and "selection_bound" marks simultaneously. If you move them in two steps with
gtk-text-buffer-move-mark
, you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.
- buffer
- a
<gtk-text-buffer>
- ins
- where to put the "insert" mark
- bound
- where to put the "selection_bound" mark
Since 2.4
<gtk-text-buffer>
) (tag <gtk-text-tag>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Emits the "apply_tag" signal on buffer. The default handler for the signal applies tag to the given range. start and end do not have to be in order.
- buffer
- a
<gtk-text-buffer>
- tag
- a
<gtk-text-tag>
- start
- one bound of range to be tagged
- end
- other bound of range to be tagged
<gtk-text-buffer>
) (tag <gtk-text-tag>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Emits the "remove_tag" signal. The default handler for the signal removes all occurrences of tag from the given range. start and end don't have to be in order.
- buffer
- a
<gtk-text-buffer>
- tag
- a
<gtk-text-tag>
- start
- one bound of range to be untagged
- end
- other bound of range to be untagged
<gtk-text-buffer>
) (name mchars
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Calls
gtk-text-tag-table-lookup
on the buffer's tag table to get a<gtk-text-tag>
, then callsgtk-text-buffer-apply-tag
.
- buffer
- a
<gtk-text-buffer>
- name
- name of a named
<gtk-text-tag>
- start
- one bound of range to be tagged
- end
- other bound of range to be tagged
<gtk-text-buffer>
) (name mchars
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Calls
gtk-text-tag-table-lookup
on the buffer's tag table to get a<gtk-text-tag>
, then callsgtk-text-buffer-remove-tag
.
- buffer
- a
<gtk-text-buffer>
- name
- name of a
<gtk-text-tag>
- start
- one bound of range to be untagged
- end
- other bound of range to be untagged
<gtk-text-buffer>
) (start <gtk-text-iter>
) (end <gtk-text-iter>
)Removes all tags in the range between start and end. Be careful with this function; it could remove tags added in code unrelated to the code you're currently writing. That is, using this function is probably a bad idea if you have two or more unrelated code sections that add tags.
- buffer
- a
<gtk-text-buffer>
- start
- one bound of range to be untagged
- end
- other bound of range to be untagged
<gtk-text-buffer>
) (char_offset int
) ⇒ (ret <gtk-text-iter>
)Initializes iter to a position char-offset chars from the start of the entire buffer. If char-offset is -1 or greater than the number of characters in the buffer, iter is initialized to the end iterator, the iterator one past the last valid character in the buffer.
- buffer
- a
<gtk-text-buffer>
- iter
- iterator to initialize
- char-offset
- char offset from start of buffer, counting from 0, or -1
<gtk-text-buffer>
) (line_number int
) ⇒ (ret <gtk-text-iter>
)Initializes iter to the start of the given line.
- buffer
- a
<gtk-text-buffer>
- iter
- iterator to initialize
- line-number
- line number counting from 0
<gtk-text-buffer>
) (mark <gtk-text-mark>
) ⇒ (ret <gtk-text-iter>
)Initializes iter with the current position of mark.
- buffer
- a
<gtk-text-buffer>
- iter
- iterator to initialize
- mark
- a
<gtk-text-mark>
in buffer
<gtk-text-buffer>
) ⇒ (ret <gtk-text-iter>
)Initialized iter with the first position in the text buffer. This is the same as using
gtk-text-buffer-get-iter-at-offset
to get the iter at character offset 0.
- buffer
- a
<gtk-text-buffer>
- iter
- iterator to initialize
<gtk-text-buffer>
) ⇒ (ret <gtk-text-iter>
)Initializes iter with the "end iterator," one past the last valid character in the text buffer. If dereferenced with
gtk-text-iter-get-char
, the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer (callgtk-text-buffer-get-start-iter
to get character position 0) to the end iterator.
- buffer
- a
<gtk-text-buffer>
- iter
- iterator to initialize
<gtk-text-buffer>
) ⇒ (start <gtk-text-iter>
) (end <gtk-text-iter>
)Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end).
- buffer
- a
<gtk-text-buffer>
- start
- iterator to initialize with first position in the buffer
- end
- iterator to initialize with the end iterator
<gtk-text-buffer>
) ⇒ (ret bool
)Indicates whether the buffer has been modified since the last call to
gtk-text-buffer-set-modified
set the modification flag to ‘#f
’. Used for example to enable a "save" function in a text editor.
- buffer
- a
<gtk-text-buffer>
- ret
- ‘
#t
’ if the buffer has been modified
<gtk-text-buffer>
) (setting bool
)Used to keep track of whether the buffer has been modified since the last time it was saved. Whenever the buffer is saved to disk, call gtk_text_buffer_set_modified (buffer, FALSE). When the buffer is modified, it will automatically toggled on the modified bit again. When the modified bit flips, the buffer emits a "modified_changed" signal.
- buffer
- a
<gtk-text-buffer>
- setting
- modification flag setting
<gtk-text-buffer>
) (interactive bool
) (default_editable bool
) ⇒ (ret bool
)Deletes the range between the "insert" and "selection_bound" marks, that is, the currently-selected text. If interactive is ‘
#t
’, the editability of the selection will be considered (users can't delete uneditable text).
- buffer
- a
<gtk-text-buffer>
- interactive
- whether the deletion is caused by user interaction
- default-editable
- whether the buffer is editable by default
- ret
- whether there was a non-empty selection to delete
<gtk-text-buffer>
) (clipboard <gtk-clipboard>
) (override_location <gtk-text-iter>
) (default_editable bool
)Pastes the contents of a clipboard at the insertion point, or at override-location. (Note: pasting is asynchronous, that is, we'll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.)
- buffer
- a
<gtk-text-buffer>
- clipboard
- the
<gtk-clipboard>
to paste from- override-location
- location to insert pasted text, or ‘
#f
’ for at the cursor- default-editable
- whether the buffer is editable by default
<gtk-text-buffer>
) (clipboard <gtk-clipboard>
)Copies the currently-selected text to a clipboard.
- buffer
- a
<gtk-text-buffer>
- clipboard
- the
<gtk-clipboard>
object to copy to.
<gtk-text-buffer>
) (clipboard <gtk-clipboard>
) (default_editable bool
)Copies the currently-selected text to a clipboard, then deletes said text if it's editable.
- buffer
- a
<gtk-text-buffer>
- clipboard
- the
<gtk-clipboard>
object to cut to.- default-editable
- default editability of the buffer
<gtk-text-buffer>
)Called to indicate that the buffer operations between here and a call to
gtk-text-buffer-end-user-action
are part of a single user-visible operation. The operations betweengtk-text-buffer-begin-user-action
andgtk-text-buffer-end-user-action
can then be grouped when creating an undo stack.<gtk-text-buffer>
maintains a count of calls togtk-text-buffer-begin-user-action
that have not been closed with a call togtk-text-buffer-end-user-action
, and emits the "begin_user_action" and "end_user_action" signals only for the outermost pair of calls. This allows you to build user actions from other user actions.The "interactive" buffer mutation functions, such as
gtk-text-buffer-insert-interactive
, automatically call begin/end user action around the buffer operations they perform, so there's no need to add extra calls if you user action consists solely of a single call to one of those functions.
- buffer
- a
<gtk-text-buffer>