TextBuffer

open class TextBuffer(pointer: <Error class: unknown class><<Error class: unknown class>>)

Stores text and attributes for display in a GtkTextView.

You may wish to begin by reading the section-text-widget.html, 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 method@Gtk.TextBuffer.set_enable_undo.

Skipped during bindings generation

  • method cursor-position: Property has no getter nor setter

  • method text: Property has no getter nor setter

Constructors

Link copied to clipboard
constructor(table: TextTagTable? = null)

Creates a new text buffer.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val canRedo: Boolean

Denotes that the buffer can reapply the last undone action.

Link copied to clipboard
open val canUndo: Boolean

Denotes that the buffer can undo the last applied action.

Link copied to clipboard

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

Link copied to clipboard
val gtkTextBufferPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard

Whether the buffer has some text currently selected.

Link copied to clipboard

The GtkTextTagTable for the buffer.

Functions

Link copied to clipboard
open fun addCommitNotify(flags: TextBufferNotifyFlags, commitNotify: TextBufferCommitNotify): <Error class: unknown class>

Adds a callback@Gtk.TextBufferCommitNotify to be called when a change is to be made to the type@Gtk.TextBuffer.

Link copied to clipboard
open fun addMark(mark: TextMark, where: TextIter)

Adds the mark at position @where.

Link copied to clipboard
open fun addSelectionClipboard(clipboard: <Error class: unknown class>)

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

Link copied to clipboard
open fun applyTag(tag: TextTag, start: TextIter, end: TextIter)

Emits the “apply-tag” signal on @buffer.

Link copied to clipboard
open fun applyTagByName(name: String, start: TextIter, end: TextIter)

Emits the “apply-tag” signal on @buffer.

Link copied to clipboard
open fun backspace(iter: TextIter, interactive: Boolean, defaultEditable: Boolean): Boolean

Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by @iter.

Link copied to clipboard

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

Link copied to clipboard
open fun beginUserAction()

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.

Link copied to clipboard
fun connectApplyTag(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (tag: TextTag, start: TextIter, end: TextIter) -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectBeginUserAction(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the content of a GtkTextBuffer has changed.

Link copied to clipboard
fun connectDeleteRange(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (start: TextIter, end: TextIter) -> Unit): <Error class: unknown class>

Emitted to delete a range from a GtkTextBuffer.

Link copied to clipboard
fun connectEndUserAction(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectInsertChildAnchor(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (location: TextIter, anchor: TextChildAnchor) -> Unit): <Error class: unknown class>

Emitted to insert a GtkTextChildAnchor in a GtkTextBuffer.

Link copied to clipboard
fun connectInsertPaintable(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (location: TextIter, <Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted to insert a GdkPaintable in a GtkTextBuffer.

Link copied to clipboard
fun connectInsertText(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (location: TextIter, text: String, len: Int) -> Unit): <Error class: unknown class>

Emitted to insert text in a GtkTextBuffer.

Link copied to clipboard
fun connectMarkDeleted(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (mark: TextMark) -> Unit): <Error class: unknown class>

Emitted as notification after a GtkTextMark is deleted.

Link copied to clipboard
fun connectMarkSet(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (location: TextIter, mark: TextMark) -> Unit): <Error class: unknown class>

Emitted as notification after a GtkTextMark is set.

Link copied to clipboard
fun connectModifiedChanged(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

Emitted when the modified bit of a GtkTextBuffer flips.

Link copied to clipboard
fun connectPasteDone(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (<Error class: unknown class>) -> Unit): <Error class: unknown class>

Emitted after paste operation has been completed.

Link copied to clipboard
fun connectRedo(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectRemoveTag(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: (tag: TextTag, start: TextIter, end: TextIter) -> Unit): <Error class: unknown class>

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

Link copied to clipboard
fun connectUndo(connectFlags: <Error class: unknown class> = ConnectFlags(0u), handler: () -> Unit): <Error class: unknown class>

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

Link copied to clipboard
open fun copyClipboard(clipboard: <Error class: unknown class>)

Copies the currently-selected text to a clipboard.

Link copied to clipboard

Creates and inserts a child anchor.

Link copied to clipboard
open fun createMark(markName: String? = null, where: TextIter, leftGravity: Boolean): TextMark

Creates a mark at position @where.

Link copied to clipboard
open fun cutClipboard(clipboard: <Error class: unknown class>, defaultEditable: Boolean)

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

Link copied to clipboard
open fun delete(start: TextIter, end: TextIter)

Deletes text between @start and @end.

Link copied to clipboard
open fun deleteInteractive(startIter: TextIter, endIter: TextIter, defaultEditable: Boolean): Boolean

Deletes all editable text in the given range.

Link copied to clipboard
open fun deleteMark(mark: TextMark)

Deletes @mark, so that it’s no longer located anywhere in the buffer.

Link copied to clipboard
open fun deleteMarkByName(name: String)

Deletes the mark named @name; the mark must exist.

Link copied to clipboard
open fun deleteSelection(interactive: Boolean, defaultEditable: Boolean): Boolean

Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.

Link copied to clipboard

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

Link copied to clipboard
open fun endUserAction()

Ends a user-visible operation.

Link copied to clipboard
open fun getBounds(start: TextIter, end: TextIter)

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

Link copied to clipboard
open fun getCanRedo(): Boolean

Gets whether there is a redoable action in the history.

Link copied to clipboard
open fun getCanUndo(): Boolean

Gets whether there is an undoable action in the history.

Link copied to clipboard
open fun getCharCount(): Int

Gets the number of characters in the buffer.

Link copied to clipboard

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

Link copied to clipboard
open fun getEndIter(iter: TextIter)

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

Link copied to clipboard

Indicates whether the buffer has some text currently selected.

Link copied to clipboard
open fun getInsert(): TextMark

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

Link copied to clipboard

Obtains the location of @anchor within @buffer.

Link copied to clipboard
open fun getIterAtLine(iter: TextIter, lineNumber: Int): Boolean

Initializes @iter to the start of the given line.

Link copied to clipboard
open fun getIterAtLineIndex(iter: TextIter, lineNumber: Int, byteIndex: Int): Boolean

Obtains an iterator pointing to @byte_index within the given line.

Link copied to clipboard
open fun getIterAtLineOffset(iter: TextIter, lineNumber: Int, charOffset: Int): Boolean

Obtains an iterator pointing to @char_offset within the given line.

Link copied to clipboard
open fun getIterAtMark(iter: TextIter, mark: TextMark)

Initializes @iter with the current position of @mark.

Link copied to clipboard
open fun getIterAtOffset(iter: TextIter, charOffset: Int)

Initializes @iter to a position @char_offset chars from the start of the entire buffer.

Link copied to clipboard
open fun getLineCount(): Int

Obtains the number of lines in the buffer.

Link copied to clipboard
open fun getMark(name: String): TextMark?

Returns the mark named @name in buffer @buffer, or null if no such mark exists in the buffer.

Link copied to clipboard
open fun getMaxUndoLevels(): <Error class: unknown class>

Gets the maximum number of undo levels to perform.

Link copied to clipboard
open fun getModified(): Boolean

Indicates whether the buffer has been modified since the last call to method@Gtk.TextBuffer.set_modified set the modification flag to false.

Link copied to clipboard

Returns the mark that represents the selection bound.

Link copied to clipboard

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

Link copied to clipboard
open fun getSelectionContent(): <Error class: unknown class>

Get a content provider for this buffer.

Link copied to clipboard
open fun getSlice(start: TextIter, end: TextIter, includeHiddenChars: Boolean): String

Returns the text in the range [@start,@end).

Link copied to clipboard
open fun getStartIter(iter: TextIter)

Initialized @iter with the first position in the text buffer.

Link copied to clipboard

Get the GtkTextTagTable associated with this buffer.

Link copied to clipboard
open fun getText(start: TextIter, end: TextIter, includeHiddenChars: Boolean): String

Returns the text in the range [@start,@end).

Link copied to clipboard
open fun insert(iter: TextIter, text: String, len: Int)

Inserts @len bytes of @text at position @iter.

Link copied to clipboard
open fun insertAtCursor(text: String, len: Int)

Inserts @text in @buffer.

Link copied to clipboard
open fun insertChildAnchor(iter: TextIter, anchor: TextChildAnchor)

Inserts a child widget anchor into the text buffer at @iter.

Link copied to clipboard
open fun insertInteractive(iter: TextIter, text: String, len: Int, defaultEditable: Boolean): Boolean

Inserts @text in @buffer.

Link copied to clipboard
open fun insertInteractiveAtCursor(text: String, len: Int, defaultEditable: Boolean): Boolean

Inserts @text in @buffer.

Link copied to clipboard
open fun insertMarkup(iter: TextIter, markup: String, len: Int)

Inserts the text in @markup at position @iter.

Link copied to clipboard
open fun insertPaintable(iter: TextIter, paintable: <Error class: unknown class>)

Inserts an image into the text buffer at @iter.

Link copied to clipboard
open fun insertRange(iter: TextIter, start: TextIter, end: TextIter)

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

Link copied to clipboard
open fun insertRangeInteractive(iter: TextIter, start: TextIter, end: TextIter, defaultEditable: Boolean): Boolean

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

Link copied to clipboard
open fun moveMark(mark: TextMark, where: TextIter)

Moves @mark to the new location @where.

Link copied to clipboard
open fun moveMarkByName(name: String, where: TextIter)

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

Link copied to clipboard
open fun pasteClipboard(clipboard: <Error class: unknown class>, overrideLocation: TextIter? = null, defaultEditable: Boolean)

Pastes the contents of a clipboard.

Link copied to clipboard
open fun placeCursor(where: TextIter)

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

Link copied to clipboard
open fun redo()

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

Link copied to clipboard
open fun removeAllTags(start: TextIter, end: TextIter)

Removes all tags in the range between @start and @end.

Link copied to clipboard
open fun removeCommitNotify(commitNotifyHandler: <Error class: unknown class>)

Removes the GtkTextBufferCommitNotify handler previously registered with method@Gtk.TextBuffer.add_commit_notify.

Link copied to clipboard
open fun removeSelectionClipboard(clipboard: <Error class: unknown class>)

Removes a GdkClipboard added with method@Gtk.TextBuffer.add_selection_clipboard

Link copied to clipboard
open fun removeTag(tag: TextTag, start: TextIter, end: TextIter)

Emits the “remove-tag” signal.

Link copied to clipboard
open fun removeTagByName(name: String, start: TextIter, end: TextIter)

Emits the “remove-tag” signal.

Link copied to clipboard
open fun selectRange(ins: TextIter, bound: TextIter)

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

Link copied to clipboard
open fun setEnableUndo(enableUndo: Boolean)

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

Link copied to clipboard
open fun setMaxUndoLevels(maxUndoLevels: <Error class: unknown class>)

Sets the maximum number of undo levels to perform.

Link copied to clipboard
open fun setModified(setting: Boolean)

Used to keep track of whether the buffer has been modified since the last time it was saved.

Link copied to clipboard
open fun setText(text: String, len: Int)

Deletes current contents of @buffer, and inserts @text instead. This is automatically marked as an irreversible action in the undo stack. If you wish to mark this action as part of a larger undo operation, call method@TextBuffer.delete and method@TextBuffer.insert directly instead.

Link copied to clipboard

Deletes current contents of @buffer, and inserts @text instead. This is automatically marked as an irreversible action in the undo stack. If you wish to mark this action as part of a larger undo operation, call method@TextBuffer.delete and method@TextBuffer.insert directly instead.

Link copied to clipboard
open fun undo()

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