Creates a new source buffer.
Moves iter to the position of the previous classMark of the given category.
Changes the case of the text between the specified iterators.
Connect to BracketMatched signal.
Connect to CursorMoved signal.
Connect to HighlightUpdated signal.
Connect to SourceMarkUpdated signal.
Creates a source mark in the buffer of category category.
Forces buffer to analyze and highlight the given area synchronously.
Moves iter to the position of the next classMark of the given category.
Get all defined context classes at iter.
Determines whether bracket match highlighting is activated for the source buffer.
Determines whether syntax highlighting is activated in the source buffer.
Returns the classLanguage associated with the buffer, see gtksource.buffer.Buffer.setLanguage.
Returns the list of marks of the given category at iter.
Returns the list of marks of the given category at line.
Returns the classStyleScheme associated with the buffer, see gtksource.buffer.Buffer.setStyleScheme.
Moves backward to the next toggle (on or off) of the context class.
Moves forward to the next toggle (on or off) of the context class.
Check if the class context_class is set on iter.
Joins the lines of text between the specified iterators.
Remove all marks of category between start and end from the buffer.
Returns this, for use in with statements.
Controls the bracket match highlighting function in the buffer.
Controls whether syntax is highlighted in the buffer.
Sets whether the buffer has an implicit trailing newline.
Associates a classLanguage with the buffer.
Sets a classStyleScheme to be used by the buffer and the view.
Sort the lines of text between the specified iterators.
Get highlightMatchingBrackets property.
Set highlightMatchingBrackets property.
Get highlightSyntax property.
Set highlightSyntax property.
Get implicitTrailingNewline property.
Set implicitTrailingNewline property.
Get loading property.
Get styleScheme property.
Set styleScheme property.
Creates a new source buffer using the highlighting patterns in language.
Returns this, for use in with statements.
Get canRedo property.
Get canUndo property.
Get cursorPosition property.
Get enableUndo property.
Set enableUndo property.
Get hasSelection property.
Get text property.
Set text property.
Adds the mark at position where.
Adds clipboard to the list of clipboards in which the selection contents of buffer are available.
Emits the “apply-tag” signal on buffer.
Emits the “apply-tag” signal on buffer.
Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter.
Denotes the beginning of an action that may not be undone.
Called to indicate that the buffer operations between here and a call to gtk.text_buffer.TextBuffer.endUserAction are part of a single user-visible operation.
Copies the currently-selected text to a clipboard.
Creates and inserts a child anchor.
Creates a mark at position where.
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.
Deletes text between start and end.
Deletes all editable text in the given range.
Deletes mark, so that it’s no longer located anywhere in the buffer.
Deletes the mark named name; the mark must exist.
Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.
Denotes the end of an action that may not be undone.
Ends a user-visible operation.
Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end).
Gets whether there is a redoable action in the history.
Gets whether there is an undoable action in the history.
Gets the number of characters in the buffer.
Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.
Initializes iter with the “end iterator,” one past the last valid character in the text buffer.
Indicates whether the buffer has some text currently selected.
Returns the mark that represents the cursor (insertion point).
Obtains the location of anchor within buffer.
Initializes iter to the start of the given line.
Obtains an iterator pointing to byte_index within the given line.
Obtains an iterator pointing to char_offset within the given line.
Initializes iter with the current position of mark.
Initializes iter to a position char_offset chars from the start of the entire buffer.
Obtains the number of lines in the buffer.
Returns the mark named name in buffer buffer, or null if no such mark exists in the buffer.
Gets the maximum number of undo levels to perform.
Indicates whether the buffer has been modified since the last call to gtk.text_buffer.TextBuffer.setModified set the modification flag to false.
Returns the mark that represents the selection bound.
Returns true if some text is selected; places the bounds of the selection in start and end.
Get a content provider for this buffer.
Returns the text in the range [start,end).
Initialized iter with the first position in the text buffer.
Get the gtk.text_tag_table.TextTagTable associated with this buffer.
Returns the text in the range [start,end).
Inserts len bytes of text at position iter.
Inserts text in buffer.
Inserts a child widget anchor into the text buffer at iter.
Inserts text in buffer.
Inserts text in buffer.
Inserts the text in markup at position iter.
Inserts an image into the text buffer at iter.
Copies text, tags, and paintables between start and end and inserts the copy at iter.
Copies text, tags, and paintables between start and end and inserts the copy at iter.
Moves mark to the new location where.
Moves the mark named name (which must exist) to location where.
Pastes the contents of a clipboard.
This function moves the “insert” and “selection_bound” marks simultaneously.
Redoes the next redoable action on the buffer, if there is one.
Removes all tags in the range between start and end.
Removes a gdk.clipboard.Clipboard added with gtk.text_buffer.TextBuffer.addSelectionClipboard
Emits the “remove-tag” signal.
Emits the “remove-tag” signal.
This function moves the “insert” and “selection_bound” marks simultaneously.
Sets whether or not to enable undoable actions in the text buffer.
Sets the maximum number of undo levels to perform.
Used to keep track of whether the buffer has been modified since the last time it was saved.
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 gtk.text_buffer.TextBuffer.delete_ and gtk.text_buffer.TextBuffer.insert directly instead.
Undoes the last undoable action on the buffer, if there is one.
Connect to ApplyTag signal.
Connect to BeginUserAction signal.
Connect to Changed signal.
Connect to DeleteRange signal.
Connect to EndUserAction signal.
Connect to InsertChildAnchor signal.
Connect to InsertPaintable signal.
Connect to InsertText signal.
Connect to MarkDeleted signal.
Connect to MarkSet signal.
Connect to ModifiedChanged signal.
Connect to PasteDone signal.
Connect to Redo signal.
Connect to RemoveTag signal.
Connect to Undo signal.
Subclass of gtk.text_buffer.TextBuffer.
A gtksource.buffer.Buffer object is the model for class@View widgets. It extends the gtk.text_buffer.TextBuffer class by adding features useful to display and edit source code such as syntax highlighting and bracket matching.
To create a gtksource.buffer.Buffer use gtksource.buffer.Buffer.new_ or gtksource.buffer.Buffer.newWithLanguage. The second form is just a convenience function which allows you to initially set a class@Language. You can also directly create a class@View and get its class@Buffer with gtk.text_view.TextView.getBuffer.
The highlighting is enabled by default, but you can disable it with gtksource.buffer.Buffer.setHighlightSyntax.
Context Classes:
It is possible to retrieve some information from the syntax highlighting engine. The default context classes that are applied to regions of a gtksource.buffer.Buffer:
Custom language definition files can create their own context classes, since the functions like gtksource.buffer.Buffer.iterHasContextClass take a string parameter as the context class.
gtksource.buffer.Buffer provides an API to access the context classes: gtksource.buffer.Buffer.iterHasContextClass, gtksource.buffer.Buffer.getContextClassesAtIter, gtksource.buffer.Buffer.iterForwardToContextClassToggle and gtksource.buffer.Buffer.iterBackwardToContextClassToggle.
And the signal@GtkSource.Buffer::highlight-updated signal permits to be notified when a context class region changes.
Each context class has also an associated gtk.text_tag.TextTag with the name gtksourceview:context-classes:<name>. For example to retrieve the gtk.text_tag.TextTag for the string context class, one can write:
GtkTextTagTable *tag_table; GtkTextTag *tag; tag_table = gtk_text_buffer_get_tag_table (buffer); tag = gtk_text_tag_table_lookup (tag_table, "gtksourceview:context-classes:string");
The tag must be used for read-only purposes.
Accessing a context class via the associated gtk.text_tag.TextTag is less convenient than the gtksource.buffer.Buffer API, because:
A possible use-case for accessing a context class via the associated gtk.text_tag.TextTag is to read the region but without adding a hard dependency on the GtkSourceView library (for example for a spell-checking library that wants to read the no-spell-check region).