Region

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

Region utility.

A GtkSourceRegion permits to store a group of subregions of a class@Gtk.TextBuffer. GtkSourceRegion stores the subregions with pairs of class@Gtk.TextMark's, so the region is still valid after insertions and deletions in the class@Gtk.TextBuffer.

The class@Gtk.TextMark for the start of a subregion has a left gravity, while the class@Gtk.TextMark for the end of a subregion has a right gravity.

The typical use-case of GtkSourceRegion is to scan a class@Gtk.TextBuffer chunk by chunk, not the whole buffer at once to not block the user interface. The GtkSourceRegion represents in that case the remaining region to scan. You can listen to the signal@Gtk.TextBuffer::insert-text and signal@Gtk.TextBuffer::delete-range signals to update the GtkSourceRegion accordingly.

To iterate through the subregions, you need to use a struct@RegionIter, for example:

GtkSourceRegion *region;
GtkSourceRegionIter region_iter;

gtk_source_region_get_start_region_iter (region, &region_iter);

while (!gtk_source_region_iter_is_end (&region_iter))
{
GtkTextIter subregion_start;
GtkTextIter subregion_end;

if (!gtk_source_region_iter_get_subregion (&region_iter,
&subregion_start,
&subregion_end))
{
break;
}

// Do something useful with the subregion.

gtk_source_region_iter_next (&region_iter);
}

Skipped during bindings generation

  • method to_string: C function gtk_source_region_to_string is ignored

Constructors

Link copied to clipboard
constructor(buffer: <Error class: unknown class>)
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open val buffer: <Error class: unknown class>?

The class@Gtk.TextBuffer. The #GtkSourceRegion has a weak reference to the buffer.

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

Functions

Link copied to clipboard
open fun addRegion(regionToAdd: Region? = null)

Adds @region_to_add to @region.

Link copied to clipboard
open fun addSubregion(start: <Error class: unknown class>, end: <Error class: unknown class>)

Adds the subregion delimited by @_start and @_end to @region.

Link copied to clipboard
open fun getBounds(start: <Error class: unknown class>?, end: <Error class: unknown class>?): Boolean

Gets the @start and @end bounds of the @region.

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

Initializes a struct@RegionIter to the first subregion of @region.

Link copied to clipboard
open fun intersectRegion(region2: Region? = null): Region?

Returns the intersection between @region1 and @region2.

Link copied to clipboard
open fun intersectSubregion(start: <Error class: unknown class>, end: <Error class: unknown class>): Region?

Returns the intersection between @region and the subregion delimited by

Link copied to clipboard
open fun isEmpty(): Boolean

Returns whether the @region is empty.

Link copied to clipboard
open fun subtractRegion(regionToSubtract: Region? = null)

Subtracts @region_to_subtract from @region.

Link copied to clipboard
open fun subtractSubregion(start: <Error class: unknown class>, end: <Error class: unknown class>)

Subtracts the subregion delimited by @_start and @_end from @region.