1.198 <GtkTextBuffer>

Class: <GtkTextBuffer>

It derives from <GObject>.

Stores text and attributes for display in a <GtkTextView>.

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.

GtkTextBuffer can support undoing changes to the buffer content, see text-buffer:set-enable-undo.

Fields

parent-instance
priv

Properties

Property: text-buffer:can-redo self

Denotes that the buffer can reapply the last undone action.

Its value is a boolean.

It is read only.

Property: text-buffer:can-undo self

Denotes that the buffer can undo the last applied action.

Its value is a boolean.

It is read only.

Property: text-buffer:cursor-position self

The position of the insert mark.

This is an offset from the beginning of the buffer. It is useful for getting notified when the cursor moves.

Its value is a 32-bit integer.

It is read only.

Property: text-buffer:enable-undo self

Denotes if support for undoing and redoing changes to the buffer is allowed.

Its value is a boolean.

Set it with (set! (text-buffer:enable-undo self) value).

Property: text-buffer:has-selection self

Whether the buffer has some text currently selected.

Its value is a boolean.

It is read only.

Property: text-buffer:tag-table self

The GtkTextTagTable for the buffer.

Its value is a <GtkTextTagTable>, or #f.

It can only be set when the object is made, with #:tag-table.

Property: text-buffer:text self

The text content of the buffer.

Without child widgets and images, see text-buffer:get-text for more information.

Its value is a string, or #f.

Set it with (set! (text-buffer:text self) value).

Procedures

Method: text-buffer:add-commit-notify self flags commit-notify ⇒ %return
Method: add-commit-notify self flags commit-notify ⇒ %return

Adds a GtkTextBufferCommitNotify to be called when a change is to be made to the <GtkTextBuffer>.

Functions are explicitly forbidden from making changes to the <GtkTextBuffer> from this callback. It is intended for tracking changes to the buffer only.

It may be advantageous to use GtkTextBufferCommitNotify over connecting to the text-buffer:insert-text or text-buffer:delete-range signals to avoid ordering issues with other signal handlers which may further modify the <GtkTextBuffer>.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

flags

Passed: a <GtkTextBufferNotifyFlags>, or a list of its symbols, or one of them.

which notifications should be dispatched to callback

commit-notify

Passed: a procedure.

a GtkTextBufferCommitNotify to call for commit notifications

See GtkTextBufferCommitNotify for how it is called.

%return

Returned: an unsigned 32-bit integer.

a handler id which may be used to remove the commit notify callback using text-buffer:remove-commit-notify.

user-data

Not passed: guile-gi supplies it.

closure data for commit-notify

destroy

Not passed: guile-gi supplies it.

a callback to free user-data when commit-notify is removed

See GDestroyNotify for how it is called.

Method: text-buffer:add-mark self mark where
Method: add-mark self mark where

Adds the mark at position where.

The mark must not be added to another buffer, and if its name is not #f then there must not be another mark in the buffer with the same name.

Emits the text-buffer:mark-set signal as notification of the mark’s initial placement.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

mark

Passed: a <GtkTextMark>.

the mark to add

where

Passed: a <GtkTextIter>.

location to place mark

Method: text-buffer:add-selection-clipboard self clipboard
Method: add-selection-clipboard self clipboard

Adds clipboard to the list of clipboards in which the selection contents of self are available.

In most cases, clipboard will be the <GdkClipboard> returned by widget:get-primary-clipboard for a view of self.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

clipboard

Passed: a <GdkClipboard>.

a <GdkClipboard>

Method: text-buffer:apply-tag self tag start end
Method: apply-tag self tag start end

Emits the “apply-tag” signal on self.

The default handler for the signal applies tag to the given range. start and end do not have to be in order.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

tag

Passed: a <GtkTextTag>.

a <GtkTextTag>

start

Passed: a <GtkTextIter>.

one bound of range to be tagged

end

Passed: a <GtkTextIter>.

other bound of range to be tagged

Method: text-buffer:apply-tag-by-name self name start end
Method: apply-tag-by-name self name start end

Emits the “apply-tag” signal on self.

Calls text-tag-table:lookup on the buffer’s tag table to get a <GtkTextTag>, then calls text-buffer:apply-tag.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

name

Passed: a string.

name of a named <GtkTextTag>

start

Passed: a <GtkTextIter>.

one bound of range to be tagged

end

Passed: a <GtkTextIter>.

other bound of range to be tagged

Method: text-buffer:backspace? self iter interactive default-editable ⇒ %return
Method: backspace? self iter interactive default-editable ⇒ %return

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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

a position in self

interactive

Passed: a boolean.

whether the deletion is caused by user interaction

default-editable

Passed: a boolean.

whether the buffer is editable by default

%return

Returned: a boolean.

#t if the buffer was modified

Method: text-buffer:begin-irreversible-action self
Method: begin-irreversible-action self

Denotes the beginning of an action that may not be undone.

This will cause any previous operations in the undo/redo queue to be cleared.

This should be paired with a call to text-buffer:end-irreversible-action after the irreversible action has completed.

You may nest calls to text-buffer:begin-irreversible-action and text-buffer:end-irreversible-action pairs.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Method: text-buffer:begin-user-action self
Method: begin-user-action self

Called to indicate that the buffer operations between here and a call to text-buffer:end-user-action are part of a single user-visible operation.

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

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Method: text-buffer:copy-clipboard self clipboard
Method: copy-clipboard self clipboard

Copies the currently-selected text to a clipboard.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

clipboard

Passed: a <GdkClipboard>.

the <GdkClipboard> object to copy to

Method: text-buffer:create-child-anchor self iter ⇒ %return
Method: create-child-anchor self iter ⇒ %return

Creates and inserts a child anchor.

This is a convenience function which simply creates a child anchor with text-child-anchor:new and inserts it into the buffer with text-buffer:insert-child-anchor.

The new anchor is owned by the buffer; no reference count is returned to the caller of this function.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

location in the buffer

%return

Returned: a <GtkTextChildAnchor>.

the created child anchor

Method: text-buffer:create-mark self mark-name where left-gravity ⇒ %return
Method: create-mark self mark-name where left-gravity ⇒ %return

Creates a mark at position where.

If mark-name is #f, the mark is anonymous; otherwise, the mark can be retrieved by name using 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 <GtkTextMark>, 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 text-buffer:mark-set signal as notification of the mark’s initial placement.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

mark-name

Passed: a string, or #f.

name for mark

where

Passed: a <GtkTextIter>.

location to place mark

left-gravity

Passed: a boolean.

whether the mark has left gravity

%return

Returned: a <GtkTextMark>.

the new <GtkTextMark> object

Method: text-buffer:cut-clipboard self clipboard default-editable
Method: cut-clipboard self clipboard default-editable

Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

clipboard

Passed: a <GdkClipboard>.

the <GdkClipboard> object to cut to

default-editable

Passed: a boolean.

default editability of the buffer

Method: text-buffer:delete self start end
Method: delete self start end

Deletes text between start and end.

The order of start and end is not actually relevant; 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

start

Passed: a <GtkTextIter>.

a position in self

end

Passed: a <GtkTextIter>.

another position in self

Method: text-buffer:delete-interactive? self start-iter end-iter default-editable ⇒ %return
Method: delete-interactive? self start-iter end-iter default-editable ⇒ %return

Deletes all editable text in the given range.

Calls 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

start-iter

Passed: a <GtkTextIter>.

start of range to delete

end-iter

Passed: a <GtkTextIter>.

end of range

default-editable

Passed: a boolean.

whether the buffer is editable by default

%return

Returned: a boolean.

whether some text was actually deleted

Method: text-buffer:delete-mark self mark
Method: delete-mark self 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 object:ref on the mark, it will be freed. Even if the mark isn’t freed, most operations on mark become invalid, until it gets added to a buffer again with text-buffer:add-mark. Use text-mark:get-deleted? to find out if a mark has been removed from its buffer.

The text-buffer:mark-deleted signal will be emitted as notification after the mark is deleted.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

mark

Passed: a <GtkTextMark>.

a <GtkTextMark> in self

Method: text-buffer:delete-mark-by-name self name
Method: delete-mark-by-name self name

Deletes the mark named name; the mark must exist.

See text-buffer:delete-mark for details.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

name

Passed: a string.

name of a mark in self

Method: text-buffer:delete-selection? self interactive default-editable ⇒ %return
Method: delete-selection? self interactive default-editable ⇒ %return

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).

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

interactive

Passed: a boolean.

whether the deletion is caused by user interaction

default-editable

Passed: a boolean.

whether the buffer is editable by default

%return

Returned: a boolean.

whether there was a non-empty selection to delete

Method: text-buffer:end-irreversible-action self
Method: end-irreversible-action self

Denotes the end of an action that may not be undone.

This will cause any previous operations in the undo/redo queue to be cleared.

This should be called after completing modifications to the text buffer after text-buffer:begin-irreversible-action was called.

You may nest calls to text-buffer:begin-irreversible-action and text-buffer:end-irreversible-action pairs.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Method: text-buffer:end-user-action self
Method: end-user-action self

Ends a user-visible operation.

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

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Method: text-buffer:get-bounds! self start end ⇒ start end
Method: get-bounds! self start end ⇒ start end

Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end).

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

start

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize with first position in the buffer

end

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize with the end iterator

Method: text-buffer:get-can-redo? self ⇒ %return
Method: get-can-redo? self ⇒ %return

Gets whether there is a redoable action in the history.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a boolean.

#t if there is a redoable action

Method: text-buffer:get-can-undo? self ⇒ %return
Method: get-can-undo? self ⇒ %return

Gets whether there is an undoable action in the history.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a boolean.

#t if there is an undoable action

Method: text-buffer:get-char-count self ⇒ %return
Method: get-char-count self ⇒ %return

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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a 32-bit integer.

number of characters in the buffer

Method: text-buffer:get-enable-undo? self ⇒ %return
Method: get-enable-undo? self ⇒ %return

Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.

See text-buffer:begin-irreversible-action and text-buffer:end-irreversible-action to create changes to the buffer that cannot be undone.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a boolean.

#t if undoing and redoing changes to the buffer is allowed.

Method: text-buffer:get-end-iter! self iter ⇒ iter
Method: get-end-iter! self iter ⇒ iter

Initializes iter with the “end iterator,” one past the last valid character in the text buffer.

If dereferenced with 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 text-buffer:get-start-iter! to get character position 0) to the end iterator.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

Method: text-buffer:get-has-selection? self ⇒ %return
Method: get-has-selection? self ⇒ %return

Indicates whether the buffer has some text currently selected.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a boolean.

#t if the there is text selected

Method: text-buffer:get-insert self ⇒ %return
Method: get-insert self ⇒ %return

Returns the mark that represents the cursor (insertion point).

Equivalent to calling text-buffer:get-mark to get the mark named “insert”, but very slightly more efficient, and involves less typing.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a <GtkTextMark>.

insertion point mark

Method: text-buffer:get-iter-at-child-anchor! self iter anchor ⇒ iter
Method: get-iter-at-child-anchor! self iter anchor ⇒ iter

Obtains the location of anchor within self.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

an iterator to be initialized

anchor

Passed: a <GtkTextChildAnchor>.

a child anchor that appears in self

Method: text-buffer:get-iter-at-line! self iter line-number ⇒ %return iter
Method: get-iter-at-line! self iter line-number ⇒ %return iter

Initializes iter to the start of the given line.

If line-number is greater than or equal to the number of lines in the self, the end iterator is returned.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

line-number

Passed: a 32-bit integer.

line number counting from 0

%return

Returned: a boolean.

whether the exact position has been found

Method: text-buffer:get-iter-at-line-index! self iter line-number byte-index ⇒ %return iter
Method: get-iter-at-line-index! self iter line-number byte-index ⇒ %return iter

Obtains an iterator pointing to byte-index within the given line.

byte-index must be the start of a UTF-8 character. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.

If line-number is greater than or equal to the number of lines in the self, the end iterator is returned. And if byte-index is off the end of the line, the iterator at the end of the line is returned.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

line-number

Passed: a 32-bit integer.

line number counting from 0

byte-index

Passed: a 32-bit integer.

byte index from start of line

%return

Returned: a boolean.

whether the exact position has been found

Method: text-buffer:get-iter-at-line-offset! self iter line-number char-offset ⇒ %return iter
Method: get-iter-at-line-offset! self iter line-number char-offset ⇒ %return iter

Obtains an iterator pointing to char-offset within the given line.

Note characters, not bytes; UTF-8 may encode one character as multiple bytes.

If line-number is greater than or equal to the number of lines in the self, the end iterator is returned. And if char-offset is off the end of the line, the iterator at the end of the line is returned.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

line-number

Passed: a 32-bit integer.

line number counting from 0

char-offset

Passed: a 32-bit integer.

char offset from start of line

%return

Returned: a boolean.

whether the exact position has been found

Method: text-buffer:get-iter-at-mark! self iter mark ⇒ iter
Method: get-iter-at-mark! self iter mark ⇒ iter

Initializes iter with the current position of mark.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

mark

Passed: a <GtkTextMark>.

a <GtkTextMark> in self

Method: text-buffer:get-iter-at-offset! self iter char-offset ⇒ iter
Method: get-iter-at-offset! self iter char-offset ⇒ 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

char-offset

Passed: a 32-bit integer.

char offset from start of buffer, counting from 0, or -1

Method: text-buffer:get-line-count self ⇒ %return
Method: get-line-count self ⇒ %return

Obtains the number of lines in the buffer.

This value is cached, so the function is very fast.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a 32-bit integer.

number of lines in the buffer

Method: text-buffer:get-mark self name ⇒ %return
Method: get-mark self name ⇒ %return

Returns the mark named name in buffer self, or #f if no such mark exists in the buffer.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

name

Passed: a string.

a mark name

%return

Returned: a <GtkTextMark>, or #f.

a <GtkTextMark>

Method: text-buffer:get-max-undo-levels self ⇒ %return
Method: get-max-undo-levels self ⇒ %return

Gets the maximum number of undo levels to perform.

If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: an unsigned 32-bit integer.

The max number of undo levels allowed (0 indicates unlimited).

Method: text-buffer:get-modified? self ⇒ %return
Method: get-modified? self ⇒ %return

Indicates whether the buffer has been modified since the last call to text-buffer:set-modified set the modification flag to #f.

Used for example to enable a “save” function in a text editor.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a boolean.

#t if the buffer has been modified

Method: text-buffer:get-selection-bound self ⇒ %return
Method: get-selection-bound self ⇒ %return

Returns the mark that represents the selection bound.

Equivalent to calling 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 self 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. 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a <GtkTextMark>.

selection bound mark

Method: text-buffer:get-selection-bounds! self start end ⇒ %return start end
Method: get-selection-bounds! self start end ⇒ %return start end

Returns #t if some text is selected; places the bounds of the selection in start and end.

If the selection has length 0, then start and end are filled in with the same value. start and end will be in ascending order. If start and end are #f, then they are not filled in, but the return value still indicates whether text is selected.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer> a <GtkTextBuffer>

start

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize with selection start

end

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize with selection end

%return

Returned: a boolean.

whether the selection has nonzero length

Method: text-buffer:get-selection-content self ⇒ %return
Method: get-selection-content self ⇒ %return

Get a content provider for this buffer.

It can be used to make the content of self available in a <GdkClipboard>, see clipboard:set-content?.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a <GdkContentProvider>.

a new <GdkContentProvider>.

Method: text-buffer:get-slice self start end include-hidden-chars ⇒ %return
Method: get-slice self start end include-hidden-chars ⇒ %return

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 text-buffer:get-text. Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a paintable or widget is in the buffer.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

start

Passed: a <GtkTextIter>.

start of a range

end

Passed: a <GtkTextIter>.

end of a range

include-hidden-chars

Passed: a boolean.

whether to include invisible text

%return

Returned: a string.

an allocated UTF-8 string

Method: text-buffer:get-start-iter! self iter ⇒ iter
Method: get-start-iter! self iter ⇒ iter

Initialized iter with the first position in the text buffer.

This is the same as using text-buffer:get-iter-at-offset! to get the iter at character offset 0.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed, filled in, and returned: a <GtkTextIter>.

iterator to initialize

Method: text-buffer:get-tag-table self ⇒ %return
Method: get-tag-table self ⇒ %return

Get the <GtkTextTagTable> associated with this buffer.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

%return

Returned: a <GtkTextTagTable>.

the buffer’s tag table

Method: text-buffer:get-text self start end include-hidden-chars ⇒ %return
Method: get-text self start end include-hidden-chars ⇒ %return

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 text-buffer:get-slice.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

start

Passed: a <GtkTextIter>.

start of a range

end

Passed: a <GtkTextIter>.

end of a range

include-hidden-chars

Passed: a boolean.

whether to include invisible text

%return

Returned: a string.

an allocated UTF-8 string

Method: text-buffer:insert self iter text len
Method: insert self iter text len

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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

a position in the buffer

text

Passed: a string.

text in UTF-8 format

len

Passed: a 32-bit integer.

length of text in bytes, or -1

Method: text-buffer:insert-at-cursor self text len
Method: insert-at-cursor self text len

Inserts text in self.

Simply calls text-buffer:insert, using the current cursor position as the insertion point.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

text

Passed: a string.

text in UTF-8 format

len

Passed: a 32-bit integer.

length of text, in bytes

Method: text-buffer:insert-child-anchor self iter anchor
Method: insert-child-anchor self iter 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 text-buffer:get-slice and text-buffer:get-text.

Consider 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

location to insert the anchor

anchor

Passed: a <GtkTextChildAnchor>.

a <GtkTextChildAnchor>

Method: text-buffer:insert-interactive-at-cursor? self text len default-editable ⇒ %return
Method: insert-interactive-at-cursor? self text len default-editable ⇒ %return

Inserts text in self.

Calls text-buffer:insert-interactive? at the cursor position.

default-editable indicates the editability of text that doesn’t have a tag affecting editability applied to it. Typically the result of text-view:get-editable? is appropriate here.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

text

Passed: a string.

text in UTF-8 format

len

Passed: a 32-bit integer.

length of text in bytes, or -1

default-editable

Passed: a boolean.

default editability of buffer

%return

Returned: a boolean.

whether text was actually inserted

Method: text-buffer:insert-interactive? self iter text len default-editable ⇒ %return
Method: insert-interactive? self iter text len default-editable ⇒ %return

Inserts text in self.

Like 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 text-view:get-editable? is appropriate here.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

a position in self

text

Passed: a string.

some UTF-8 text

len

Passed: a 32-bit integer.

length of text in bytes, or -1

default-editable

Passed: a boolean.

default editability of buffer

%return

Returned: a boolean.

whether text was actually inserted

Method: text-buffer:insert-markup self iter markup len
Method: insert-markup self iter markup len

Inserts the text in markup at position iter.

markup will be inserted in its entirety and must be nul-terminated and valid UTF-8. Emits the text-buffer:insert-text signal, possibly multiple times; insertion actually occurs in the default handler for the signal. iter will point to the end of the inserted text on return.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

location to insert the markup

markup

Passed: a string.

a nul-terminated UTF-8 string containing Pango markup

len

Passed: a 32-bit integer.

length of markup in bytes, or -1

Method: text-buffer:insert-paintable self iter paintable
Method: insert-paintable self iter paintable

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 paintable, but the “text” variants do not. e.g. see text-buffer:get-slice and text-buffer:get-text.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

location to insert the paintable

paintable

Passed: a <GdkPaintable>.

a <GdkPaintable>

Method: text-buffer:insert-range self iter start end
Method: insert-range self iter start end

Copies text, tags, and paintables between start and end and inserts the copy at iter.

The order of start and end doesn’t matter.

Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from self, the two buffers must share the same tag table.

Implemented via emissions of the ::insert-text and ::apply-tag signals, so expect those.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

a position in self

start

Passed: a <GtkTextIter>.

a position in a <GtkTextBuffer>

end

Passed: a <GtkTextIter>.

another position in the same buffer as start

Method: text-buffer:insert-range-interactive? self iter start end default-editable ⇒ %return
Method: insert-range-interactive? self iter start end default-editable ⇒ %return

Copies text, tags, and paintables between start and end and inserts the copy at iter.

Same as text-buffer:insert-range, but does nothing if the insertion point isn’t editable. The default-editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability. Typically the result of text-view:get-editable? is appropriate here.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

a position in self

start

Passed: a <GtkTextIter>.

a position in a <GtkTextBuffer>

end

Passed: a <GtkTextIter>.

another position in the same buffer as start

default-editable

Passed: a boolean.

default editability of the buffer

%return

Returned: a boolean.

whether an insertion was possible at iter

Method: text-buffer:move-mark self mark where
Method: move-mark self mark where

Moves mark to the new location where.

Emits the text-buffer:mark-set signal as notification of the move.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

mark

Passed: a <GtkTextMark>.

a <GtkTextMark>

where

Passed: a <GtkTextIter>.

new location for mark in self

Method: text-buffer:move-mark-by-name self name where
Method: move-mark-by-name self name where

Moves the mark named name (which must exist) to location where.

See text-buffer:move-mark for details.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

name

Passed: a string.

name of a mark

where

Passed: a <GtkTextIter>.

new location for mark

Procedure: text-buffer:new [table] ⇒ %return

Creates a new text buffer.

table

Passed, or left out: a <GtkTextTagTable>, or #f.

a tag table, or #f to create a new one

%return

Returned: a <GtkTextBuffer>.

a new text buffer

Method: text-buffer:paste-clipboard self clipboard override-location default-editable
Method: paste-clipboard self clipboard override-location default-editable

Pastes the contents of a clipboard.

If override-location is #f, the pasted text will be inserted at the cursor position, or the buffer selection will be replaced if the selection is non-empty.

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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

clipboard

Passed: a <GdkClipboard>.

the <GdkClipboard> to paste from

override-location

Passed: a <GtkTextIter>, or #f.

location to insert pasted text

default-editable

Passed: a boolean.

whether the buffer is editable by default

Method: text-buffer:place-cursor self where
Method: place-cursor self where

This function moves the “insert” and “selection_bound” marks simultaneously.

If you move them to the same place in two steps with 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

where

Passed: a <GtkTextIter>.

where to put the cursor

Method: text-buffer:redo self
Method: redo self

Redoes the next redoable action on the buffer, if there is one.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Method: text-buffer:remove-all-tags self start end
Method: remove-all-tags self start end

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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

start

Passed: a <GtkTextIter>.

one bound of range to be untagged

end

Passed: a <GtkTextIter>.

other bound of range to be untagged

Method: text-buffer:remove-commit-notify self commit-notify-handler
Method: remove-commit-notify self commit-notify-handler

Removes the GtkTextBufferCommitNotify handler previously registered with text-buffer:add-commit-notify.

This may result in the user_data_destroy being called that was passed when registering the commit notify functions.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

commit-notify-handler

Passed: an unsigned 32-bit integer.

the notify handler identifier returned from text-buffer:add-commit-notify.

Method: text-buffer:remove-selection-clipboard self clipboard
Method: remove-selection-clipboard self clipboard

Removes a <GdkClipboard> added with text-buffer:add-selection-clipboard

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

clipboard

Passed: a <GdkClipboard>.

a <GdkClipboard> added to self by text-buffer:add-selection-clipboard

Method: text-buffer:remove-tag self tag start end
Method: remove-tag self tag start end

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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

tag

Passed: a <GtkTextTag>.

a <GtkTextTag>

start

Passed: a <GtkTextIter>.

one bound of range to be untagged

end

Passed: a <GtkTextIter>.

other bound of range to be untagged

Method: text-buffer:remove-tag-by-name self name start end
Method: remove-tag-by-name self name start end

Emits the “remove-tag” signal.

Calls text-tag-table:lookup on the buffer’s tag table to get a <GtkTextTag>, then calls text-buffer:remove-tag.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

name

Passed: a string.

name of a <GtkTextTag>

start

Passed: a <GtkTextIter>.

one bound of range to be untagged

end

Passed: a <GtkTextIter>.

other bound of range to be untagged

Method: text-buffer:select-range self ins bound
Method: select-range self ins bound

This function moves the “insert” and “selection_bound” marks simultaneously.

If you move them in two steps with 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.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

ins

Passed: a <GtkTextIter>.

where to put the “insert” mark

bound

Passed: a <GtkTextIter>.

where to put the “selection_bound” mark

Method: text-buffer:set-enable-undo self enable-undo
Method: set-enable-undo self enable-undo

Sets whether or not to enable undoable actions in the text buffer.

Undoable actions in this context are changes to the text content of the buffer. Changes to tags and marks are not tracked.

If enabled, the user will be able to undo the last number of actions up to text-buffer:get-max-undo-levels.

See text-buffer:begin-irreversible-action and text-buffer:end-irreversible-action to create changes to the buffer that cannot be undone.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

enable-undo

Passed: a boolean.

#t to enable undo

Method: text-buffer:set-max-undo-levels self max-undo-levels
Method: set-max-undo-levels self max-undo-levels

Sets the maximum number of undo levels to perform.

If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

max-undo-levels

Passed: an unsigned 32-bit integer.

the maximum number of undo actions to perform

Method: text-buffer:set-modified self setting
Method: set-modified self setting

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 toggle on the modified bit again. When the modified bit flips, the buffer emits the text-buffer:modified-changed signal.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

setting

Passed: a boolean.

modification flag setting

Method: text-buffer:set-text self text len
Method: set-text self text len

Deletes current contents of self, 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 TextBuffer.delete and TextBuffer.insert directly instead.

If len is -1, text must be nul-terminated. text must be valid UTF-8.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

text

Passed: a string.

UTF-8 text to insert

len

Passed: a 32-bit integer.

length of text in bytes

Method: text-buffer:undo self
Method: undo self

Undoes the last undoable action on the buffer, if there is one.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Signals

Signal: text-buffer:apply-tag

Connect a handler with (connect object text-buffer:apply-tag handler). It is called as (handler self tag start end).

Emitted to apply a tag to a range of text in a <GtkTextBuffer>.

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: text-buffer:apply-tag, Gtk.TextBuffer.insert_with_tags, text-buffer:insert-range.

self

Passed: a <GtkTextBuffer>.

tag

Passed: a <GtkTextTag>.

the applied tag

start

Passed: a <GtkTextIter>.

the start of the range the tag is applied to

end

Passed: a <GtkTextIter>.

the end of the range the tag is applied to

Signal: text-buffer:begin-user-action

Connect a handler with (connect object text-buffer:begin-user-action handler). It is called as (handler self).

Emitted at the beginning of a single user-visible operation on a <GtkTextBuffer>.

See also: text-buffer:begin-user-action, text-buffer:insert-interactive?, text-buffer:insert-range-interactive?, text-buffer:delete-interactive?, text-buffer:backspace?, text-buffer:delete-selection?.

self

Passed: a <GtkTextBuffer>.

Signal: text-buffer:changed

Connect a handler with (connect object text-buffer:changed handler). It is called as (handler self).

Emitted when the content of a <GtkTextBuffer> has changed.

self

Passed: a <GtkTextBuffer>.

Signal: text-buffer:delete-range

Connect a handler with (connect object text-buffer:delete-range handler). It is called as (handler self start end).

Emitted to delete a range from a <GtkTextBuffer>.

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 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: text-buffer:delete.

self

Passed: a <GtkTextBuffer>.

start

Passed: a <GtkTextIter>.

the start of the range to be deleted

end

Passed: a <GtkTextIter>.

the end of the range to be deleted

Signal: text-buffer:end-user-action

Connect a handler with (connect object text-buffer:end-user-action handler). It is called as (handler self).

Emitted at the end of a single user-visible operation on the <GtkTextBuffer>.

See also: text-buffer:end-user-action, text-buffer:insert-interactive?, text-buffer:insert-range-interactive?, text-buffer:delete-interactive?, text-buffer:backspace?, text-buffer:delete-selection?, text-buffer:backspace?.

self

Passed: a <GtkTextBuffer>.

Signal: text-buffer:insert-child-anchor

Connect a handler with (connect object text-buffer:insert-child-anchor handler). It is called as (handler self location anchor).

Emitted to insert a <GtkTextChildAnchor> in a <GtkTextBuffer>.

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: text-buffer:insert-child-anchor.

self

Passed: a <GtkTextBuffer>.

location

Passed: a <GtkTextIter>.

position to insert anchor in textbuffer

anchor

Passed: a <GtkTextChildAnchor>.

the <GtkTextChildAnchor> to be inserted

Signal: text-buffer:insert-paintable

Connect a handler with (connect object text-buffer:insert-paintable handler). It is called as (handler self location paintable).

Emitted to insert a <GdkPaintable> in a <GtkTextBuffer>.

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 paintable.

See also: text-buffer:insert-paintable.

self

Passed: a <GtkTextBuffer>.

location

Passed: a <GtkTextIter>.

position to insert paintable in textbuffer

paintable

Passed: a <GdkPaintable>.

the <GdkPaintable> to be inserted

Signal: text-buffer:insert-text

Connect a handler with (connect object text-buffer:insert-text handler). It is called as (handler self location text len).

Emitted to insert text in a <GtkTextBuffer>.

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: text-buffer:insert, text-buffer:insert-range.

self

Passed: a <GtkTextBuffer>.

location

Passed: a <GtkTextIter>.

position to insert text in textbuffer

text

Passed: a string.

the UTF-8 text to be inserted

len

Passed: a 32-bit integer.

length of the inserted text in bytes

Signal: text-buffer:mark-deleted

Connect a handler with (connect object text-buffer:mark-deleted handler). It is called as (handler self mark).

Emitted as notification after a <GtkTextMark> is deleted.

See also: text-buffer:delete-mark.

self

Passed: a <GtkTextBuffer>.

mark

Passed: a <GtkTextMark>.

The mark that was deleted

Signal: text-buffer:mark-set

Connect a handler with (connect object text-buffer:mark-set handler). It is called as (handler self location mark).

Emitted as notification after a <GtkTextMark> is set.

See also: text-buffer:create-mark, text-buffer:move-mark.

self

Passed: a <GtkTextBuffer>.

location

Passed: a <GtkTextIter>.

The location of mark in textbuffer

mark

Passed: a <GtkTextMark>.

The mark that is set

Signal: text-buffer:modified-changed

Connect a handler with (connect object text-buffer:modified-changed handler). It is called as (handler self).

Emitted when the modified bit of a <GtkTextBuffer> flips.

See also: text-buffer:set-modified.

self

Passed: a <GtkTextBuffer>.

Signal: text-buffer:paste-done

Connect a handler with (connect object text-buffer:paste-done handler). It is called as (handler self clipboard).

Emitted after paste operation has been completed.

This is useful to properly scroll the view to the end of the pasted text. See text-buffer:paste-clipboard for more details.

self

Passed: a <GtkTextBuffer>.

clipboard

Passed: a <GdkClipboard>.

the <GdkClipboard> pasted from

Signal: text-buffer:redo

Connect a handler with (connect object text-buffer:redo handler). It is called as (handler self).

Emitted when a request has been made to redo the previously undone operation.

self

Passed: a <GtkTextBuffer>.

Signal: text-buffer:remove-tag

Connect a handler with (connect object text-buffer:remove-tag handler). It is called as (handler self tag start end).

Emitted to remove all occurrences of tag from a range of text in a <GtkTextBuffer>.

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: text-buffer:remove-tag.

self

Passed: a <GtkTextBuffer>.

tag

Passed: a <GtkTextTag>.

the tag to be removed

start

Passed: a <GtkTextIter>.

the start of the range the tag is removed from

end

Passed: a <GtkTextIter>.

the end of the range the tag is removed from

Signal: text-buffer:undo

Connect a handler with (connect object text-buffer:undo handler). It is called as (handler self).

Emitted when a request has been made to undo the previous operation or set of operations that have been grouped together.

self

Passed: a <GtkTextBuffer>.

Virtual methods

Virtual method: text-buffer:do-apply-tag implementor self tag start end

Emits the “apply-tag” signal on self.

The default handler for the signal applies tag to the given range. start and end do not have to be in order.

To override it in a new class, give register-type #:vfuncs `((apply-tag . ,procedure)). The procedure is called as (procedure self tag start end).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

tag

Passed: a <GtkTextTag>.

a <GtkTextTag>

start

Passed: a <GtkTextIter>.

one bound of range to be tagged

end

Passed: a <GtkTextIter>.

other bound of range to be tagged

Virtual method: text-buffer:do-begin-user-action implementor self

Called to indicate that the buffer operations between here and a call to text-buffer:end-user-action are part of a single user-visible operation.

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

To override it in a new class, give register-type #:vfuncs `((begin-user-action . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Virtual method: text-buffer:do-changed implementor self

The class handler for the text-buffer:changed signal.

To override it in a new class, give register-type #:vfuncs `((changed . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

Virtual method: text-buffer:do-delete-range implementor self start end

The class handler for the text-buffer:delete-range signal.

To override it in a new class, give register-type #:vfuncs `((delete-range . ,procedure)). The procedure is called as (procedure self start end).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

start

Passed: a <GtkTextIter>.

end

Passed: a <GtkTextIter>.

Virtual method: text-buffer:do-end-user-action implementor self

Ends a user-visible operation.

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

To override it in a new class, give register-type #:vfuncs `((end-user-action . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Virtual method: text-buffer:do-insert-child-anchor implementor self iter 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 text-buffer:get-slice and text-buffer:get-text.

Consider 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.

To override it in a new class, give register-type #:vfuncs `((insert-child-anchor . ,procedure)). The procedure is called as (procedure self iter anchor).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

location to insert the anchor

anchor

Passed: a <GtkTextChildAnchor>.

a <GtkTextChildAnchor>

Virtual method: text-buffer:do-insert-paintable implementor self iter paintable

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 paintable, but the “text” variants do not. e.g. see text-buffer:get-slice and text-buffer:get-text.

To override it in a new class, give register-type #:vfuncs `((insert-paintable . ,procedure)). The procedure is called as (procedure self iter paintable).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

iter

Passed: a <GtkTextIter>.

location to insert the paintable

paintable

Passed: a <GdkPaintable>.

a <GdkPaintable>

Virtual method: text-buffer:do-insert-text implementor self pos new-text new-text-length

The class handler for the text-buffer:insert-text signal.

To override it in a new class, give register-type #:vfuncs `((insert-text . ,procedure)). The procedure is called as (procedure self pos new-text new-text-length).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

pos

Passed: a <GtkTextIter>.

new-text

Passed: a string.

new-text-length

Passed: a 32-bit integer.

Virtual method: text-buffer:do-mark-deleted implementor self mark

The class handler for the text-buffer:mark-deleted signal.

To override it in a new class, give register-type #:vfuncs `((mark-deleted . ,procedure)). The procedure is called as (procedure self mark).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

mark

Passed: a <GtkTextMark>.

Virtual method: text-buffer:do-mark-set implementor self location mark

The class handler for the text-buffer:mark-set signal.

To override it in a new class, give register-type #:vfuncs `((mark-set . ,procedure)). The procedure is called as (procedure self location mark).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

location

Passed: a <GtkTextIter>.

mark

Passed: a <GtkTextMark>.

Virtual method: text-buffer:do-modified-changed implementor self

The class handler for the text-buffer:modified-changed signal.

To override it in a new class, give register-type #:vfuncs `((modified-changed . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

Virtual method: text-buffer:do-paste-done implementor self clipboard

The class handler for the text-buffer:paste-done signal.

To override it in a new class, give register-type #:vfuncs `((paste-done . ,procedure)). The procedure is called as (procedure self clipboard).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

clipboard

Passed: a <GdkClipboard>.

Virtual method: text-buffer:do-redo implementor self

Redoes the next redoable action on the buffer, if there is one.

To override it in a new class, give register-type #:vfuncs `((redo . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

Virtual method: text-buffer:do-remove-tag implementor self tag start end

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.

To override it in a new class, give register-type #:vfuncs `((remove-tag . ,procedure)). The procedure is called as (procedure self tag start end).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>

tag

Passed: a <GtkTextTag>.

a <GtkTextTag>

start

Passed: a <GtkTextIter>.

one bound of range to be untagged

end

Passed: a <GtkTextIter>.

other bound of range to be untagged

Virtual method: text-buffer:do-undo implementor self

Undoes the last undoable action on the buffer, if there is one.

To override it in a new class, give register-type #:vfuncs `((undo . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkTextBuffer>, or a class that derives from it, or its GType number.

self

Passed: a <GtkTextBuffer>.

a <GtkTextBuffer>