Region

class Region(**properties: Any)

Superclasses: Object

Constructors:

Region(**properties)
new(buffer:Gtk.TextBuffer) -> GtkSource.Region

Constructors

class Region
classmethod new(buffer: TextBuffer) Region
Parameters:

buffer – a TextBuffer.

Methods

class Region
add_region(region_to_add: Region | None = None) None

Adds region_to_add to region.

region_to_add is not modified.

Parameters:

region_to_add – the Region to add to region, or None.

add_subregion(_start: TextIter, _end: TextIter) None

Adds the subregion delimited by _start and _end to region.

Parameters:
  • _start – the start of the subregion.

  • _end – the end of the subregion.

get_bounds() tuple[bool, TextIter, TextIter]

Gets the start and end bounds of the region.

get_buffer() TextBuffer | None
get_start_region_iter() RegionIter

Initializes a RegionIter to the first subregion of region.

If region is empty, iter will be initialized to the end iterator.

intersect_region(region2: Region | None = None) Region | None

Returns the intersection between region1 and region2.

region1 and region2 are not modified.

Parameters:

region2 – a Region, or None.

intersect_subregion(_start: TextIter, _end: TextIter) Region | None

Returns the intersection between region and the subregion delimited by _start and _end.

region is not modified.

Parameters:
  • _start – the start of the subregion.

  • _end – the end of the subregion.

is_empty() bool

Returns whether the region is empty.

A None region is considered empty.

subtract_region(region_to_subtract: Region | None = None) None

Subtracts region_to_subtract from region.

region_to_subtract is not modified.

Parameters:

region_to_subtract – the Region to subtract from region, or None.

subtract_subregion(_start: TextIter, _end: TextIter) None

Subtracts the subregion delimited by _start and _end from region.

Parameters:
  • _start – the start of the subregion.

  • _end – the end of the subregion.

to_string() str | None

Gets a string represention of region, for debugging purposes.

The returned string contains the character offsets of the subregions. It doesn’t include a newline character at the end of the string.

Properties

class Region
props.buffer: TextBuffer

The TextBuffer. The Region has a weak reference to the buffer.

Fields

class Region
parent_instance