Next: , Previous: GtkTextMark, Up: Top


28 GtkTextBuffer

Stores attributed text for display in a

28.1 Overview

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.

28.2 Usage

— Class: <gtk-text-buffer>

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
— Signal on <gtk-text-buffer>: changed

The changed signal is emitted when the content of a <gtk-text-buffer> has changed.

— Signal on <gtk-text-buffer>: insert-text (arg0 <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.

— Signal on <gtk-text-buffer>: insert-pixbuf (arg0 <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.

— Signal on <gtk-text-buffer>: insert-child-anchor (arg0 <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.

— Signal on <gtk-text-buffer>: delete-range (arg0 <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.

— Signal on <gtk-text-buffer>: modified-changed

The modified_changed signal is emitted when the modified bit of a <gtk-text-buffer> flips.

See also: gtk-text-buffer-set-modified.

— Signal on <gtk-text-buffer>: mark-set (arg0 <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.

— Signal on <gtk-text-buffer>: mark-deleted (arg0 <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.

— Signal on <gtk-text-buffer>: apply-tag (arg0 <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.

— Signal on <gtk-text-buffer>: remove-tag (arg0 <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.

— Signal on <gtk-text-buffer>: begin-user-action

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.

— Signal on <gtk-text-buffer>: end-user-action

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.

— Function: gtk-text-buffer-new (table <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
— Function: gtk-text-buffer-get-line-count (self <gtk-text-buffer>) ⇒  (ret int)
— Method: get-line-count

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
— Function: gtk-text-buffer-get-char-count (self <gtk-text-buffer>) ⇒  (ret int)
— Method: get-char-count

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
— Function: gtk-text-buffer-get-tag-table (self <gtk-text-buffer>) ⇒  (ret <gtk-text-tag-table>)
— Method: get-tag-table

Get the <gtk-text-tag-table> associated with this buffer.

buffer
a <gtk-text-buffer>
ret
the buffer's tag table
— Function: gtk-text-buffer-insert (self <gtk-text-buffer>) (iter <gtk-text-iter>) (stext scm)
— Method: insert

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
— Function: gtk-text-buffer-insert-at-cursor (self <gtk-text-buffer>) (stext scm)
— Method: insert-at-cursor

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
— Function: gtk-text-buffer-insert-interactive (self <gtk-text-buffer>) (iter <gtk-text-iter>) (stext scm) (default_editable bool) ⇒  (ret bool)
— Method: insert-interactive

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
— Function: gtk-text-buffer-insert-range (self <gtk-text-buffer>) (iter <gtk-text-iter>) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: insert-range

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
— Function: gtk-text-buffer-insert-with-tags (self <gtk-text-buffer>) (iter <gtk-text-iter>) (stext scm) (tag_list glist-of)
— Method: insert-with-tags

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, then gtk-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
— Function: gtk-text-buffer-delete (self <gtk-text-buffer>) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: delete

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
— Function: gtk-text-buffer-delete-interactive (self <gtk-text-buffer>) (start_iter <gtk-text-iter>) (end_iter <gtk-text-iter>) (default_editable bool) ⇒  (ret bool)
— Method: delete-interactive

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
— Function: gtk-text-buffer-backspace (self <gtk-text-buffer>) (iter <gtk-text-iter>) (interactive bool) (default_editable bool) ⇒  (ret bool)
— Method: backspace

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 modified

Since 2.6

— Function: gtk-text-buffer-set-text (self <gtk-text-buffer>) (stext scm)
— Method: set-text

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
— Function: gtk-text-buffer-get-text (self <gtk-text-buffer>) (start <gtk-text-iter>) (end <gtk-text-iter>) (include_hidden_chars bool) ⇒  (ret mchars)
— Method: get-text

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 with gtk-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
— Function: gtk-text-buffer-get-slice (self <gtk-text-buffer>) (start <gtk-text-iter>) (end <gtk-text-iter>) (include_hidden_chars bool) ⇒  (ret mchars)
— Method: get-slice

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 with gtk-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
— Function: gtk-text-buffer-insert-pixbuf (self <gtk-text-buffer>) (iter <gtk-text-iter>) (pixbuf <gdk-pixbuf>)
— Method: insert-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 and gtk-text-buffer-get-text.

buffer
a <gtk-text-buffer>
iter
location to insert the pixbuf
pixbuf
a <gdk-pixbuf>
— Function: gtk-text-buffer-insert-child-anchor (self <gtk-text-buffer>) (iter <gtk-text-iter>) (anchor <gtk-text-child-anchor>)
— Method: insert-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 and gtk-text-buffer-get-text. Consider gtk-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>
— Function: gtk-text-buffer-create-child-anchor (self <gtk-text-buffer>) (iter <gtk-text-iter>) ⇒  (ret <gtk-text-child-anchor>)
— Method: create-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 with gtk-text-buffer-insert-child-anchor. The new anchor is owned by the buffer; no reference count is returned to the caller of gtk-text-buffer-create-child-anchor.

buffer
a <gtk-text-buffer>
iter
location in the buffer
ret
the created child anchor
— Function: gtk-text-buffer-create-mark (self <gtk-text-buffer>) (mark_name mchars) (where <gtk-text-iter>) (left_gravity bool) ⇒  (ret <gtk-text-mark>)
— Method: create-mark

Creates a mark at position where. If mark-name is ‘#f’, the mark is anonymous; otherwise, the mark can be retrieved by name using gtk-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
— Function: gtk-text-buffer-move-mark (self <gtk-text-buffer>) (mark <gtk-text-mark>) (where <gtk-text-iter>)
— Method: move-mark

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
— Function: gtk-text-buffer-move-mark-by-name (self <gtk-text-buffer>) (name mchars) (where <gtk-text-iter>)
— Method: move-mark-by-name

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
— Function: gtk-text-buffer-delete-mark (self <gtk-text-buffer>) (mark <gtk-text-mark>)
— Method: delete-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
— Function: gtk-text-buffer-delete-mark-by-name (self <gtk-text-buffer>) (name mchars)
— Method: delete-mark-by-name

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
— Function: gtk-text-buffer-get-mark (self <gtk-text-buffer>) (name mchars) ⇒  (ret <gtk-text-mark>)
— Method: get-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
— Function: gtk-text-buffer-get-insert (self <gtk-text-buffer>) ⇒  (ret <gtk-text-mark>)
— Method: get-insert

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
— Function: gtk-text-buffer-get-selection-bound (self <gtk-text-buffer>) ⇒  (ret <gtk-text-mark>)
— Method: get-selection-bound

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
— Function: gtk-text-buffer-get-has-selection (self <gtk-text-buffer>) ⇒  (ret bool)
— Method: get-has-selection

Indicates whether the buffer has some text currently selected.

buffer
a <gtk-text-buffer>
ret
#t’ if the there is text selected

Since 2.10

— Function: gtk-text-buffer-place-cursor (self <gtk-text-buffer>) (where <gtk-text-iter>)
— Method: place-cursor

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
— Function: gtk-text-buffer-select-range (self <gtk-text-buffer>) (ins <gtk-text-iter>) (bound <gtk-text-iter>)
— Method: select-range

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

— Function: gtk-text-buffer-apply-tag (self <gtk-text-buffer>) (tag <gtk-text-tag>) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: apply-tag

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
— Function: gtk-text-buffer-remove-tag (self <gtk-text-buffer>) (tag <gtk-text-tag>) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: remove-tag

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
— Function: gtk-text-buffer-apply-tag-by-name (self <gtk-text-buffer>) (name mchars) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: apply-tag-by-name

Calls gtk-text-tag-table-lookup on the buffer's tag table to get a <gtk-text-tag>, then calls gtk-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
— Function: gtk-text-buffer-remove-tag-by-name (self <gtk-text-buffer>) (name mchars) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: remove-tag-by-name

Calls gtk-text-tag-table-lookup on the buffer's tag table to get a <gtk-text-tag>, then calls gtk-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
— Function: gtk-text-buffer-remove-all-tags (self <gtk-text-buffer>) (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: remove-all-tags

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
— Function: gtk-text-buffer-get-iter-at-offset (self <gtk-text-buffer>) (char_offset int) ⇒  (ret <gtk-text-iter>)
— Method: get-iter-at-offset

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
— Function: gtk-text-buffer-get-iter-at-line (self <gtk-text-buffer>) (line_number int) ⇒  (ret <gtk-text-iter>)
— Method: get-iter-at-line

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
— Function: gtk-text-buffer-get-iter-at-mark (self <gtk-text-buffer>) (mark <gtk-text-mark>) ⇒  (ret <gtk-text-iter>)
— Method: get-iter-at-mark

Initializes iter with the current position of mark.

buffer
a <gtk-text-buffer>
iter
iterator to initialize
mark
a <gtk-text-mark> in buffer
— Function: gtk-text-buffer-get-start-iter (self <gtk-text-buffer>) ⇒  (ret <gtk-text-iter>)
— Method: get-start-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
— Function: gtk-text-buffer-get-end-iter (self <gtk-text-buffer>) ⇒  (ret <gtk-text-iter>)
— Method: get-end-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 (call gtk-text-buffer-get-start-iter to get character position 0) to the end iterator.

buffer
a <gtk-text-buffer>
iter
iterator to initialize
— Function: gtk-text-buffer-get-bounds (self <gtk-text-buffer>) ⇒  (start <gtk-text-iter>) (end <gtk-text-iter>)
— Method: get-bounds
— Method: get-bounds

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
— Function: gtk-text-buffer-get-modified (self <gtk-text-buffer>) ⇒  (ret bool)
— Method: get-modified

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
— Function: gtk-text-buffer-set-modified (self <gtk-text-buffer>) (setting bool)
— Method: set-modified

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
— Function: gtk-text-buffer-delete-selection (self <gtk-text-buffer>) (interactive bool) (default_editable bool) ⇒  (ret bool)
— Method: delete-selection

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
— Function: gtk-text-buffer-paste-clipboard (self <gtk-text-buffer>) (clipboard <gtk-clipboard>) (override_location <gtk-text-iter>) (default_editable bool)
— Method: paste-clipboard

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
— Function: gtk-text-buffer-copy-clipboard (self <gtk-text-buffer>) (clipboard <gtk-clipboard>)
— Method: copy-clipboard

Copies the currently-selected text to a clipboard.

buffer
a <gtk-text-buffer>
clipboard
the <gtk-clipboard> object to copy to.
— Function: gtk-text-buffer-cut-clipboard (self <gtk-text-buffer>) (clipboard <gtk-clipboard>) (default_editable bool)
— Method: cut-clipboard

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
— Function: gtk-text-buffer-begin-user-action (self <gtk-text-buffer>)
— Method: begin-user-action

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 between gtk-text-buffer-begin-user-action and gtk-text-buffer-end-user-action can then be grouped when creating an undo stack. <gtk-text-buffer> maintains a count of calls to gtk-text-buffer-begin-user-action that have not been closed with a call to gtk-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>
— Function: gtk-text-buffer-end-user-action (self <gtk-text-buffer>)
— Method: end-user-action

Should be paired with a call to gtk-text-buffer-begin-user-action. See that function for a full explanation.

buffer
a <gtk-text-buffer>