GutterLines

class GutterLines(**properties: Any)

Superclasses: Object

Collected information about visible lines.

The GtkSourceGutterLines object is used to collect information about visible lines.

Use this from your query_data to collect the necessary information on visible lines. Doing so reduces the number of passes through the text btree allowing GtkSourceView to reach more frames-per-second while performing kinetic scrolling.

Methods

class GutterLines
add_class(line: int, name: str) None

Adds the class name to line.

name will be converted to a GLib.Quark as part of this process. A faster version of this function is available via add_qclass for situations where the GLib.Quark is known ahead of time.

Parameters:
  • line – a line number starting from zero

  • name – a class name

add_qclass(line: int, qname: int) None

Adds the class denoted by qname to line.

You may check if a line has qname by calling has_qclass.

You can remove qname by calling remove_qclass.

Parameters:
  • line – a line number starting from zero

  • qname – a class name as a Quark

get_buffer() TextBuffer

Gets the TextBuffer that the GtkSourceGutterLines represents.

get_first() int

Gets the line number (starting from 0) for the first line that is user visible.

get_iter_at_line(line: int) TextIter

Gets a TextIter for the current buffer at line

Parameters:

line – the line number

get_last() int

Gets the line number (starting from 0) for the last line that is user visible.

get_line_yrange(line: int, mode: GutterRendererAlignmentMode) tuple[int, int]

Gets the Y range for a line based on mode.

The value for y is relative to the renderers widget coordinates.

Parameters:
get_view() TextView

Gets the TextView that the GtkSourceGutterLines represents.

has_any_class(line: int) bool

Checks to see if the line has any GQuark classes set. This can be used to help renderer implementations avoid work if nothing has been set on the class.

Added in version 5.6.

Parameters:

line – a line contained within lines

has_class(line: int, name: str) bool

Checks to see if add_class was called with the name for line.

A faster version of this function is provided via has_qclass for situations where the quark is known ahead of time.

Parameters:
  • line – a line number starting from zero

  • name – a class name that may be converted, to a Quark

has_qclass(line: int, qname: int) bool

Checks to see if add_qclass was called with the quark denoted by qname for line.

Parameters:
  • line – a line number starting from zero

  • qname – a Quark containing the class name

is_cursor(line: int) bool

Checks to see if line contains the insertion cursor.

Parameters:

line – a line number starting from zero

is_prelit(line: int) bool

Checks to see if line is marked as prelit. Generally, this means the mouse pointer is over the line within the gutter.

Parameters:

line – a line number starting from zero

is_selected(line: int) bool

Checks to see if the view had a selection and if that selection overlaps line in some way.

Parameters:

line – a line number starting from zero

remove_class(line: int, name: str) None

Removes the class matching name from line.

A faster version of this function is available via remove_qclass for situations where the Quark is known ahead of time.

Parameters:
  • line – a line number starting from zero

  • name – a class name

remove_qclass(line: int, qname: int) None

Reverses a call to add_qclass by removing the GLib.Quark matching qname.

Parameters:
  • line – a line number starting from zero

  • qname – a Quark to remove from line