Mark

class Mark(**properties: Any)

Superclasses: TextMark, Object

Mark object for Buffer.

A GtkSourceMark marks a position in the text where you want to display additional info. It is based on TextMark and thus is still valid after the text has changed though its position may change.

GtkSourceMark’s are organized in categories which you have to set when you create the mark. Each category can have a priority, a pixbuf and other associated attributes. See set_mark_attributes. The pixbuf will be displayed in the margin at the line where the mark residents if the show_line_marks property is set to True. If there are multiple marks in the same line, the pixbufs will be drawn on top of each other. The mark with the highest priority will be drawn on top.

Constructors

class Mark
classmethod new(name: str | None, category: str) Mark

Creates a text mark.

Add it to a buffer using add_mark. If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using get_mark. Normally marks are created using the utility function create_source_mark.

Parameters:
  • name – Name of the Mark or None

  • category – is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could belong to the “bookmark” category, or all the marks representing a compilation error could belong to “error” category).

Methods

class Mark
get_category() str

Returns the mark category.

next(category: str | None = None) Mark | None

Returns the next GtkSourceMark in the buffer or None if the mark was not added to a buffer.

If there is no next mark, None will be returned.

If category is None, looks for marks of any category.

Parameters:

category – a string specifying the mark category, or None.

prev(category: str | None = None) Mark | None

Returns the previous GtkSourceMark in the buffer or None if the mark was not added to a buffer.

If there is no previous mark, None is returned.

If category is None, looks for marks of any category

Parameters:

category – a string specifying the mark category, or None.

Properties

class Mark
props.category: str

The category of the GtkSourceMark, classifies the mark and controls which pixbuf is used and with which priority it is drawn.

Fields

class Mark
parent_instance