Class Region

java.lang.Object
All Implemented Interfaces:
Proxy

@Generated("io.github.jwharm.JavaGI") public class Region extends GObject
Region utility.

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

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

The typical use-case of GtkSourceRegion is to scan a 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 Gtk.TextBuffer::insert-text and Gtk.TextBuffer::delete-range signals to update the GtkSourceRegion accordingly.

To iterate through the subregions, you need to use a 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);
 }