:right-sidebar: True Region =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: Region(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: Region(**properties) new(buffer:Gtk.TextBuffer) -> GtkSource.Region Constructors ------------ .. rst-class:: interim-class .. class:: Region :no-index: .. classmethod:: new(buffer: ~gi.repository.Gtk.TextBuffer) -> ~gi.repository.GtkSource.Region :param buffer: a :obj:`~gi.repository.Gtk.TextBuffer`. Methods ------- .. rst-class:: interim-class .. class:: Region :no-index: .. method:: add_region(region_to_add: ~gi.repository.GtkSource.Region | None = None) -> None Adds ``region_to_add`` to ``region``. ``region_to_add`` is not modified. :param region_to_add: the :obj:`~gi.repository.GtkSource.Region` to add to ``region``, or :const:`None`. .. method:: add_subregion(_start: ~gi.repository.Gtk.TextIter, _end: ~gi.repository.Gtk.TextIter) -> None Adds the subregion delimited by ``_start`` and ``_end`` to ``region``. :param _start: the start of the subregion. :param _end: the end of the subregion. .. method:: get_bounds() -> tuple[bool, ~gi.repository.Gtk.TextIter, ~gi.repository.Gtk.TextIter] Gets the ``start`` and ``end`` bounds of the ``region``. .. method:: get_buffer() -> ~gi.repository.Gtk.TextBuffer | None .. method:: get_start_region_iter() -> ~gi.repository.GtkSource.RegionIter Initializes a :obj:`~gi.repository.GtkSource.RegionIter` to the first subregion of ``region``. If ``region`` is empty, ``iter`` will be initialized to the end iterator. .. method:: intersect_region(region2: ~gi.repository.GtkSource.Region | None = None) -> ~gi.repository.GtkSource.Region | None Returns the intersection between ``region1`` and ``region2``. ``region1`` and ``region2`` are not modified. :param region2: a :obj:`~gi.repository.GtkSource.Region`, or :const:`None`. .. method:: intersect_subregion(_start: ~gi.repository.Gtk.TextIter, _end: ~gi.repository.Gtk.TextIter) -> ~gi.repository.GtkSource.Region | None Returns the intersection between ``region`` and the subregion delimited by ``_start`` and ``_end``. ``region`` is not modified. :param _start: the start of the subregion. :param _end: the end of the subregion. .. method:: is_empty() -> bool Returns whether the ``region`` is empty. A :const:`None` ``region`` is considered empty. .. method:: subtract_region(region_to_subtract: ~gi.repository.GtkSource.Region | None = None) -> None Subtracts ``region_to_subtract`` from ``region``. ``region_to_subtract`` is not modified. :param region_to_subtract: the :obj:`~gi.repository.GtkSource.Region` to subtract from ``region``, or :const:`None`. .. method:: subtract_subregion(_start: ~gi.repository.Gtk.TextIter, _end: ~gi.repository.Gtk.TextIter) -> None Subtracts the subregion delimited by ``_start`` and ``_end`` from ``region``. :param _start: the start of the subregion. :param _end: the end of the subregion. .. method:: 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 ---------- .. rst-class:: interim-class .. class:: Region :no-index: .. attribute:: props.buffer :type: ~gi.repository.Gtk.TextBuffer The :obj:`~gi.repository.Gtk.TextBuffer`. The :obj:`~gi.repository.GtkSource.Region` has a weak reference to the buffer. Fields ------ .. rst-class:: interim-class .. class:: Region :no-index: .. attribute:: parent_instance