### ----------------------------------------------------
### -- Gnome::Gtk3
### -- Licenses: Artistic-2.0
### -- Authors: Marcel Timmerman
### -- File: lib/Gnome/Gtk3/TextBuffer.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 3
 will temporarily select a
region in between their old and new locations, which can be pretty
inefficient since the temporarily-selected region will force stuff
to be recalculated. This function moves them as a unit, which can
be optimized.


  method gtk_text_buffer_select_range ( N-GObject $ins, N-GObject $bound )

=item N-GObject $ins; where to put the “insert” mark
=item N-GObject $bound; where to put the “selection_bound” mark

=end pod

sub gtk_text_buffer_select_range ( N-GObject $buffer, N-GObject $ins, N-GObject $bound )
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_apply_tag:
=begin pod
=head2 [[gtk_] text_buffer_] apply_tag

Emits the “apply-tag” signal on I<buffer>. The default
handler for the signal applies I<tag> to the given range.
I<start> and I<end> do not have to be in order.

  method gtk_text_buffer_apply_tag (
    Gnome::Gtk3::TextTag $tag,
    Gnome::Gtk3::TextIter $start, Gnome::Gtk3::TextIter $end
  )

=item Gnome::Gtk3::TextTag $tag
=item Gnome::Gtk3::TextIter $start; one bound of range to be tagged
=item Gnome::Gtk3::TextIter $end; other bound of range to be tagged

=end pod

sub gtk_text_buffer_apply_tag ( N-GObject $buffer, N-GObject $tag, N-GTextIter $start, N-GTextIter $end )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_remove_tag:
=begin pod
=head2 [[gtk_] text_buffer_] remove_tag

Emits the “remove-tag” signal. The default handler for the signal
removes all occurrences of I<tag> from the given range. I<start> and
I<end> don’t have to be in order.

  method gtk_text_buffer_remove_tag ( N-GObject $tag, N-GObject $start, N-GObject $end )

=item Gnome::Gtk3::TextTag $tag
=item Gnome::Gtk3::TextIter $start; one bound of range to be untagged
=item Gnome::Gtk3::TextIter $end; other bound of range to be untagged

=end pod

sub gtk_text_buffer_remove_tag ( N-GObject $buffer, N-GObject $tag, N-GTextIter $start, N-GTextIter $end )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_apply_tag_by_name:
=begin pod
=head2 [[gtk_] text_buffer_] apply_tag_by_name

Calls C<gtk_text_tag_table_lookup()> on the buffer’s tag table to
get a B<Gnome::Gtk3::TextTag>, then calls C<gtk_text_buffer_apply_tag()>.

  method gtk_text_buffer_apply_tag_by_name (
    Str $name, Gnome::Gtk3::TextIter $start, Gnome::Gtk3::TextIter $end
  )

=item Str $name; name of a named B<Gnome::Gtk3::TextTag>
=item Gnome::Gtk3::TextIter $start; one bound of range to be tagged
=item Gnome::Gtk3::TextIter $end; other bound of range to be tagged

=end pod

sub gtk_text_buffer_apply_tag_by_name ( N-GObject $buffer, Str $name, N-GTextIter $start, N-GTextIter $end )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_remove_tag_by_name:
=begin pod
=head2 [[gtk_] text_buffer_] remove_tag_by_name

Calls C<gtk_text_tag_table_lookup()> on the buffer’s tag table to
get a B<Gnome::Gtk3::TextTag>, then calls C<gtk_text_buffer_remove_tag()>.

  method gtk_text_buffer_remove_tag_by_name (
    Str $name, Gnome::Gtk3::TextIter $start, Gnome::Gtk3::TextIter $end
  )

=item Str $name; name of a B<Gnome::Gtk3::TextTag>
=item Gnome::Gtk3::TextIter $start; one bound of range to be untagged
=item Gnome::Gtk3::TextIter $end; other bound of range to be untagged

=end pod

sub gtk_text_buffer_remove_tag_by_name ( N-GObject $buffer, Str $name, N-GTextIter $start, N-GTextIter $end )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_remove_all_tags:
=begin pod
=head2 [[gtk_] text_buffer_] remove_all_tags

Removes all tags in the range between I<start> and I<end>.  Be careful
with this function; it could remove tags added in code unrelated to
the code you’re currently writing. That is, using this function is
probably a bad idea if you have two or more unrelated code sections
that add tags.

  method gtk_text_buffer_remove_all_tags (
    Gnome::Gtk3::TextIter $start, Gnome::Gtk3::TextIter $end
  )

=item Gnome::Gtk3::TextIter $start; one bound of range to be untagged
=item Gnome::Gtk3::TextIter $end; other bound of range to be untagged

=end pod

sub gtk_text_buffer_remove_all_tags ( N-GObject $buffer, N-GTextIter $start, N-GTextIter $end )
  is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_create_tag:
=begin pod
=head2 [[gtk_] text_buffer_] create_tag

Creates a tag and adds it to the tag table for I<buffer>.
Equivalent to calling C<gtk_text_tag_new()> and then adding the
tag to the buffer’s tag table. The returned tag is owned by
the buffer’s tag table, so the ref count will be equal to one.

If I<tag_name> is C<Any>, the tag is anonymous.

If I<tag_name> is non-C<Any>, a tag called I<tag_name> must not already
exist in the tag table for this buffer.

The I<first_property_name> argument and subsequent arguments are a list
of properties to set on the tag, as with C<g_object_set()>.

Returns: (transfer none): a new tag

  method gtk_text_buffer_create_tag ( Str $tag_name, Str $first_property_name --> N-GObject  )

=item Str $tag_name; (allow-none): name of the new tag, or C<Any>
=item Str $first_property_name; (allow-none): name of first property to set, or C<Any> @...: C<Any>-terminated list of property names and values

=end pod

sub gtk_text_buffer_create_tag ( N-GObject $buffer, Str $tag_name, Str $first_property_name, Any $any = Any )
  returns N-GObject
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_iter_at_line_offset:
=begin pod
=head2 [[gtk_] text_buffer_] get_iter_at_line_offset

Obtains an iterator pointing to I<$char_offset> within the given line. Note
characters, not bytes; UTF-8 may encode one character as multiple bytes.

Before the 3.20 version, it was not allowed to pass an invalid location.

Since the 3.20 version, if I<$line_number> is greater than the number of lines
in the I<buffer>, the end iterator is returned. And if I<$char_offset> is off the end of the line, the iterator at the end of the line is returned.

  method gtk_text_buffer_get_iter_at_line_offset (
    Int $line_number, Int $char_offset
    --> Gnome::Gtk3::TextIter
  )

=item Int $line_number; line number counting from 0
=item Int $char_offset; char offset from start of line

=end pod

sub gtk_text_buffer_get_iter_at_line_offset (
  N-GObject $buffer, Int $line_number, Int $char_offset
  --> Gnome::Gtk3::TextIter
) {
#  my Gnome::Gtk3::TextIter $iter .= new;
#  my N-GTextIter $no = $iter._get-native-object;
  my N-GTextIter $no .= new;
  _gtk_text_buffer_get_iter_at_line_offset(
    $buffer, $no, $line_number, $char_offset
  );
  Gnome::Gtk3::TextIter.new(:native-object($no))
#  $iter._set-native-object($no);

#  $iter
}

sub _gtk_text_buffer_get_iter_at_line_offset ( N-GObject $buffer, N-GTextIter $iter is rw, int32 $line_number, int32 $char_offset )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_iter_at_line_offset')
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_iter_at_line_index:
=begin pod
=head2 [[gtk_] text_buffer_] get_iter_at_line_index

Obtains an iterator pointing to I<byte_index> within the given line.
I<byte_index> must be the start of a UTF-8 character. Note bytes, not
characters; UTF-8 may encode one character as multiple bytes.

Before the 3.20 version, it was not allowed to pass an invalid location.

Since the 3.20 version, if I<line_number> is greater than the number of lines
in the I<buffer>, the end iterator is returned. And if I<byte_index> is off the
end of the line, the iterator at the end of the line is returned.

  method gtk_text_buffer_get_iter_at_line_index (
    Int $line_number, Int $byte_index
    --> Gnome::Gtk3::TextIter
  )

=item Int $line_number; line number counting from 0
=item Int $byte_index; byte index from start of line

=end pod

sub gtk_text_buffer_get_iter_at_line_index (
  N-GObject $buffer, Int $line_number, Int $byte_index
  --> Gnome::Gtk3::TextIter
) {
#  my Gnome::Gtk3::TextIter $iter .= new;
#  my N-GTextIter $no = $iter._get-native-object;
  my N-GTextIter $no .= new;
  _gtk_text_buffer_get_iter_at_line_index(
    $buffer, $no, $line_number, $byte_index
  );
  Gnome::Gtk3::TextIter.new(:native-object($no))
#  $iter._set-native-object($no);

#  $iter
}

sub _gtk_text_buffer_get_iter_at_line_index ( N-GObject $buffer, N-GTextIter $iter is rw, int32 $line_number, int32 $byte_index )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_iter_at_line_index')
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_iter_at_offset:
=begin pod
=head2 [[gtk_] text_buffer_] get_iter_at_offset

Initializes I<iter> to a position I<char_offset> chars from the start
of the entire buffer. If I<char_offset> is -1 or greater than the number
of characters in the buffer, I<iter> is initialized to the end iterator,
the iterator one past the last valid character in the buffer.

  method gtk_text_buffer_get_iter_at_offset (
    Int $char_offset
    --> Gnome::Gtk3::TextIter
  )

=item Int $char_offset; char offset from start of buffer, counting from 0, or -1

=end pod


sub gtk_text_buffer_get_iter_at_offset (
  N-GObject $buffer, Int $char_offset
  --> Gnome::Gtk3::TextIter
) {
#  my Gnome::Gtk3::TextIter $iter .= new;
#  my N-GTextIter $no = $iter._get-native-object;
  my N-GTextIter $no .= new;
  _gtk_text_buffer_get_iter_at_offset( $buffer, $no, $char_offset);
  Gnome::Gtk3::TextIter.new(:native-object($no))
#  $iter._set-native-object($no);

#  $iter
}

sub _gtk_text_buffer_get_iter_at_offset ( N-GObject $buffer, N-GTextIter $iter is rw, int32 $char_offset )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_iter_at_offset')
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_iter_at_line:
=begin pod
=head2 [[gtk_] text_buffer_] get_iter_at_line

Returns an I<iter> to the start of the given line. If I<$line_number> is greater
than the number of lines in the I<buffer>, the end iterator is returned.

  method gtk_text_buffer_get_iter_at_line (
    Int $line_number
    --> Gnome::Gtk3::TextIter
  )

=item Int $line_number; line number counting from 0

=end pod

sub gtk_text_buffer_get_iter_at_line (
  N-GObject $buffer, Int $line_number
  --> Gnome::Gtk3::TextIter
) {
#  my Gnome::Gtk3::TextIter $iter .= new;
#  my N-GTextIter $no = $iter._get-native-object;
  my N-GTextIter $no .= new;
  _gtk_text_buffer_get_iter_at_line( $buffer, $no, $line_number);
  Gnome::Gtk3::TextIter.new(:native-object($no))
#  $iter._set-native-object($no);

#  $iter
}

sub _gtk_text_buffer_get_iter_at_line ( N-GObject $buffer, N-GTextIter $iter is rw, int32 $line_number )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_iter_at_line')
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_start_iter:
=begin pod
=head2 [[gtk_] text_buffer_] get_start_iter

Initialized I<$iter> with the first position in the text buffer. This
is the same as using C<gtk_text_buffer_get_iter_at_offset()> to get
the iter at character offset 0.

  method gtk_text_buffer_get_start_iter ( --> Gnome::Gtk3::TextIter )

=item N-GObject $iter; (out): iterator to initialize

=end pod

sub gtk_text_buffer_get_start_iter (
  N-GObject $buffer --> Gnome::Gtk3::TextIter
) {
#  my Gnome::Gtk3::TextIter $start .= new;
#  my N-GTextIter $no = $start._get-native-object;

  my N-GTextIter $no .= new;
  _gtk_text_buffer_get_start_iter( $buffer, $no);
#  $start._set-native-object($no);
  Gnome::Gtk3::TextIter.new(:native-object($no))

#  $start
}

sub _gtk_text_buffer_get_start_iter ( N-GObject $buffer, N-GTextIter $iter is rw )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_start_iter')
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_end_iter:
=begin pod
=head2 [[gtk_] text_buffer_] get_end_iter

Initializes I<iter> with the “end iterator,” one past the last valid
character in the text buffer. If dereferenced with
C<gtk_text_iter_get_char()>, the end iterator has a character value of 0.
The entire buffer lies in the range from the first position in
the buffer (call C<gtk_text_buffer_get_start_iter()> to get
character position 0) to the end iterator.

  method gtk_text_buffer_get_end_iter ( --> Gnome::Gtk3::TextIter )

=item N-GObject $iter; (out): iterator to initialize

=end pod

sub gtk_text_buffer_get_end_iter (
  N-GObject $buffer --> Gnome::Gtk3::TextIter
) {
#  my Gnome::Gtk3::TextIter $end .= new;
#  my N-GTextIter $no = $end._get-native-object;
  my N-GTextIter $no .= new;
  _gtk_text_buffer_get_end_iter( $buffer, $no);
  Gnome::Gtk3::TextIter.new(:native-object($no))
#  $end._set-native-object($no);

#  $end
}

sub _gtk_text_buffer_get_end_iter ( N-GObject $buffer, N-GTextIter $iter is rw )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_end_iter')
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_get_bounds:
=begin pod
=head2 [[gtk_] text_buffer_] get_bounds

Retrieves the first and last iterators in the buffer, i.e. the
entire buffer lies within the range [I<start>,I<end>).

  method gtk_text_buffer_get_bounds ( --> List )

Returns a list of
=item Gnome::Gtk3::TextIter $start; iterator to initialize with first position in the buffer
=item Gnome::Gtk3::TextIter $end; iterator to initialize with the end iterator

=end pod

sub gtk_text_buffer_get_bounds ( N-GObject $buffer --> List ) {
#  my Gnome::Gtk3::TextIter $i1 .= new;
#  my N-GTextIter $no1 = $i1._get-native-object;
#  my Gnome::Gtk3::TextIter $i2 .= new;
#  my N-GTextIter $no2 = $i2._get-native-object;

  my N-GTextIter $no1 .= new;
  my N-GTextIter $no2 .= new;
  _gtk_text_buffer_get_bounds( $buffer, $no1, $no2);

#  $i1._set-native-object($no1);
#  $i2._set-native-object($no2);

  ( Gnome::Gtk3::TextIter.new(:native-object($no1)),
    Gnome::Gtk3::TextIter.new(:native-object($no2))
  )
}

sub _gtk_text_buffer_get_bounds ( N-GObject $buffer, N-GTextIter $start is rw, N-GTextIter $end is rw )
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_bounds')
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_get_iter_at_mark:
=begin pod
=head2 [[gtk_] text_buffer_] get_iter_at_mark

Initializes I<iter> with the current position of I<mark>.

  method gtk_text_buffer_get_iter_at_mark ( Gnome::Gtk3::TextIter $iter, N-GObject $mark )

=item Gnome::Gtk3::TextIter $iter; (out): iterator to initialize
=item N-GObject $mark; a B<Gnome::Gtk3::TextMark> in I<buffer>

=end pod

sub gtk_text_buffer_get_iter_at_mark ( N-GObject $buffer, N-GTextIter $iter, N-GObject $mark )
  is native(&gtk-lib)
  { * }
}}

#`{{
#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_get_iter_at_child_anchor:
=begin pod
=head2 [[gtk_] text_buffer_] get_iter_at_child_anchor

Obtains the location of I<anchor> within I<buffer>.

  method gtk_text_buffer_get_iter_at_child_anchor ( Gnome::Gtk3::TextIter $iter, GtkTextChildAnchor $anchor )

=item Gnome::Gtk3::TextIter $iter; (out): an iterator to be initialized
=item GtkTextChildAnchor $anchor; a child anchor that appears in I<buffer>

=end pod

sub gtk_text_buffer_get_iter_at_child_anchor ( N-GObject $buffer, N-GTextIter $iter, GtkTextChildAnchor $anchor )
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_modified:
=begin pod
=head2 [[gtk_] text_buffer_] get_modified

Indicates whether the buffer has been modified since the last call
to C<gtk_text_buffer_set_modified()> set the modification flag to
C<0>. Used for example to enable a “save” function in a text
editor.

Returns: C<1> if the buffer has been modified

  method gtk_text_buffer_get_modified ( --> Int  )


=end pod

sub gtk_text_buffer_get_modified ( N-GObject $buffer )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_set_modified:
=begin pod
=head2 [[gtk_] text_buffer_] set_modified

Used to keep track of whether the buffer has been modified since the
last time it was saved. Whenever the buffer is saved to disk, call
gtk_text_buffer_set_modified (I<buffer>, FALSE). When the buffer is modified,
it will automatically toggled on the modified bit again. When the modified
bit flips, the buffer emits the  I<modified-changed> signal.

  method gtk_text_buffer_set_modified ( Int $setting )

=item Int $setting; modification flag setting

=end pod

sub gtk_text_buffer_set_modified ( N-GObject $buffer, int32 $setting )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_has_selection:
=begin pod
=head2 [[gtk_] text_buffer_] get_has_selection

Indicates whether the buffer has some text currently selected.

Returns: C<1> if the there is text selected


  method gtk_text_buffer_get_has_selection ( --> Int  )


=end pod

sub gtk_text_buffer_get_has_selection ( N-GObject $buffer )
  returns int32
  is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_add_selection_clipboard:
=begin pod
=head2 [[gtk_] text_buffer_] add_selection_clipboard

Adds I<clipboard> to the list of clipboards in which the selection
contents of I<buffer> are available. In most cases, I<clipboard> will be
the B<Gnome::Gtk3::Clipboard> of type C<GDK_SELECTION_PRIMARY> for a view of I<buffer>.

  method gtk_text_buffer_add_selection_clipboard ( N-GObject $clipboard )

=item N-GObject $clipboard; a B<Gnome::Gtk3::Clipboard>

=end pod

sub gtk_text_buffer_add_selection_clipboard ( N-GObject $buffer, N-GObject $clipboard )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_remove_selection_clipboard:
=begin pod
=head2 [[gtk_] text_buffer_] remove_selection_clipboard

Removes a B<Gnome::Gtk3::Clipboard> added with
C<gtk_text_buffer_add_selection_clipboard()>.

  method gtk_text_buffer_remove_selection_clipboard ( N-GObject $clipboard )

=item N-GObject $clipboard; a B<Gnome::Gtk3::Clipboard> added to I<buffer> by  C<gtk_text_buffer_add_selection_clipboard()>

=end pod

sub gtk_text_buffer_remove_selection_clipboard ( N-GObject $buffer, N-GObject $clipboard )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_cut_clipboard:
=begin pod
=head2 [[gtk_] text_buffer_] cut_clipboard

Copies the currently-selected text to a clipboard, then deletes
said text if it’s editable.

  method gtk_text_buffer_cut_clipboard ( N-GObject $clipboard, Int $default_editable )

=item N-GObject $clipboard; the B<Gnome::Gtk3::Clipboard> object to cut to
=item Int $default_editable; default editability of the buffer

=end pod

sub gtk_text_buffer_cut_clipboard ( N-GObject $buffer, N-GObject $clipboard, int32 $default_editable )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_copy_clipboard:
=begin pod
=head2 [[gtk_] text_buffer_] copy_clipboard

Copies the currently-selected text to a clipboard.

  method gtk_text_buffer_copy_clipboard ( N-GObject $clipboard )

=item N-GObject $clipboard; the B<Gnome::Gtk3::Clipboard> object to copy to

=end pod

sub gtk_text_buffer_copy_clipboard ( N-GObject $buffer, N-GObject $clipboard )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_paste_clipboard:
=begin pod
=head2 [[gtk_] text_buffer_] paste_clipboard

Pastes the contents of a clipboard. If I<override_location> is C<Any>, the
pasted text will be inserted at the cursor position, or the buffer selection
will be replaced if the selection is non-empty.

Note: pasting is asynchronous, that is, we’ll ask for the paste data and
return, and at some point later after the main loop runs, the paste data will
be inserted.

  method gtk_text_buffer_paste_clipboard ( N-GObject $clipboard, N-GObject $override_location, Int $default_editable )

=item N-GObject $clipboard; the B<Gnome::Gtk3::Clipboard> to paste from
=item N-GObject $override_location; (allow-none): location to insert pasted text, or C<Any>
=item Int $default_editable; whether the buffer is editable by default

=end pod

sub gtk_text_buffer_paste_clipboard ( N-GObject $buffer, N-GObject $clipboard, N-GObject $override_location, int32 $default_editable )
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
#TM:1:gtk_text_buffer_get_selection_bounds:
=begin pod
=head2 [[gtk_] text_buffer_] get_selection_bounds

Returns C<1> if some text is selected; places the bounds
of the selection in I<start> and I<end> (if the selection has length 0,
then I<start> and I<end> are filled in with the same value).
I<start> and I<end> will be in ascending order. If I<start> and I<end> are
NULL, then they are not filled in, but the return value still indicates
whether text is selected.

  method gtk_text_buffer_get_selection_bounds ( --> List )

Returned List contains
=item Int $status; C<1> when the selection has nonzero length
=item Gnome::Gtk3::TextIter $start; iterator to initialize with selection start
=item Gnome::Gtk3::TextIter $end; iterator to initialize with selection end

=end pod

sub gtk_text_buffer_get_selection_bounds ( N-GObject $buffer --> List ) {
#  my Gnome::Gtk3::TextIter $i1 .= new;
#  my N-GTextIter $no1 = $i1._get-native-object;
#  my Gnome::Gtk3::TextIter $i2 .= new;
#  my N-GTextIter $no2 = $i2._get-native-object;
  my N-GTextIter $no1 .= new;
  my N-GTextIter $no2 .= new;
  my Int $sts = _gtk_text_buffer_get_selection_bounds( $buffer, $no1, $no2);
#  $i1._set-native-object($no1);
#  $i2._set-native-object($no2);

  ( $sts,
    Gnome::Gtk3::TextIter.new(:native-object($no1)),
    Gnome::Gtk3::TextIter.new(:native-object($no2))
  )
}

sub _gtk_text_buffer_get_selection_bounds ( N-GObject $buffer, N-GTextIter $start, N-GTextIter $end )
  returns int32
  is native(&gtk-lib)
  is symbol('gtk_text_buffer_get_selection_bounds')
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_delete_selection:
=begin pod
=head2 [[gtk_] text_buffer_] delete_selection

Deletes the range between the “insert” and “selection_bound” marks,
that is, the currently-selected text. If I<interactive> is C<1>,
the editability of the selection will be considered (users can’t delete
uneditable text).

Returns: whether there was a non-empty selection to delete

  method gtk_text_buffer_delete_selection ( Int $interactive, Int $default_editable --> Int  )

=item Int $interactive; whether the deletion is caused by user interaction
=item Int $default_editable; whether the buffer is editable by default

=end pod

sub gtk_text_buffer_delete_selection ( N-GObject $buffer, int32 $interactive, int32 $default_editable )
  returns int32
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_begin_user_action:
=begin pod
=head2 [[gtk_] text_buffer_] begin_user_action

Called to indicate that the buffer operations between here and a
call to C<gtk_text_buffer_end_user_action()> are part of a single
user-visible operation. The operations between
C<gtk_text_buffer_begin_user_action()> and
C<gtk_text_buffer_end_user_action()> can then be grouped when creating
an undo stack. B<Gnome::Gtk3::TextBuffer> maintains a count of calls to
C<gtk_text_buffer_begin_user_action()> that have not been closed with
a call to C<gtk_text_buffer_end_user_action()>, and emits the
“begin-user-action” and “end-user-action” signals only for the
outermost pair of calls. This allows you to build user actions
from other user actions.

The “interactive” buffer mutation functions, such as
C<gtk_text_buffer_insert_interactive()>, automatically call begin/end
user action around the buffer operations they perform, so there's
no need to add extra calls if you user action consists solely of a
single call to one of those functions.

  method gtk_text_buffer_begin_user_action ( )


=end pod

sub gtk_text_buffer_begin_user_action ( N-GObject $buffer )
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_end_user_action:
=begin pod
=head2 [[gtk_] text_buffer_] end_user_action

Should be paired with a call to C<gtk_text_buffer_begin_user_action()>.
See that function for a full explanation.

  method gtk_text_buffer_end_user_action ( )


=end pod

sub gtk_text_buffer_end_user_action ( N-GObject $buffer )
  is native(&gtk-lib)
  { * }

#`{{
#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_get_copy_target_list:
=begin pod
=head2 [[gtk_] text_buffer_] get_copy_target_list

This function returns the list of targets this text buffer can
provide for copying and as DND source. The targets in the list are
added with I<info> values from the B<Gnome::Gtk3::TextBufferTargetInfo> enum,
using C<gtk_target_list_add_rich_text_targets()> and
C<gtk_target_list_add_text_targets()>.

Returns: (transfer none): the B<Gnome::Gtk3::TargetList>


  method gtk_text_buffer_get_copy_target_list ( --> GtkTargetList  )


=end pod

sub gtk_text_buffer_get_copy_target_list ( N-GObject $buffer )
  returns GtkTargetList
  is native(&gtk-lib)
  { * }

#-------------------------------------------------------------------------------
#TM:0:gtk_text_buffer_get_paste_target_list:
=begin pod
=head2 [[gtk_] text_buffer_] get_paste_target_list

This function returns the list of targets this text buffer supports
for pasting and as DND destination. The targets in the list are
added with I<info> values from the B<Gnome::Gtk3::TextBufferTargetInfo> enum,
using C<gtk_target_list_add_rich_text_targets()> and
C<gtk_target_list_add_text_targets()>.

Returns: (transfer none): the B<Gnome::Gtk3::TargetList>


  method gtk_text_buffer_get_paste_target_list ( --> GtkTargetList  )


=end pod

sub gtk_text_buffer_get_paste_target_list ( N-GObject $buffer )
  returns GtkTargetList
  is native(&gtk-lib)
  { * }
}}

#-------------------------------------------------------------------------------
=begin pod
=head1 Signals

There are two ways to connect to a signal. The first option you have is to use C<register-signal()> from B<Gnome::GObject::Object>. The second option is to use C<g_signal_connect_object()> directly from B<Gnome::GObject::Signal>.

=head2 First method

The positional arguments of the signal handler are all obligatory as well as their types. The named attributes C<:$widget> and user data are optional.

  # handler method
  method mouse-event ( N-GdkEvent $event, :$widget ) { ... }

  # connect a signal on window object
  my Gnome::Gtk3::Window $w .= new( ... );
  $w.register-signal( self, 'mouse-event', 'button-press-event');

=head2 Second method

  my Gnome::Gtk3::Window $w .= new( ... );
  my Callable $handler = sub (
    N-GObject $native, N-GdkEvent $event, OpaquePointer $data
  ) {
    ...
  }

  $w.connect-object( 'button-press-event', $handler);

Also here, the types of positional arguments in the signal handler are important. This is because both methods C<register-signal()> and C<g_signal_connect_object()> are using the signatures of the handler routines to setup the native call interface.

=head2 Supported signals


=comment #TS:1:insert-text:
=head3 insert-text

The I<insert-text> signal is emitted to insert text in a B<Gnome::Gtk3::TextBuffer>.
Insertion actually occurs in the default handler.

Note that if your handler runs before the default handler it must not
invalidate the I<location> iter (or has to revalidate it).
The default signal handler revalidates it to point to the end of the
inserted text.

See also:
C<gtk_text_buffer_insert()>,
C<gtk_text_buffer_insert_range()>.

  method handler (
    N-GObject $location,
    Str $text,
    Int $len,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($textbuffer),
    *%user-options
  );

=item $textbuffer; the object which received the signal

=item $location; position to insert I<text> in I<textbuffer>. A native GtkTextIter object.

=item $text; the UTF-8 text to be inserted

=item $len; length of the inserted text in bytes


=comment #TS:0:insert-pixbuf:
=head3 insert-pixbuf

The I<insert-pixbuf> signal is emitted to insert a B<Gnome::Gdk3::Pixbuf>
in a B<Gnome::Gtk3::TextBuffer>. Insertion actually occurs in the default handler.

Note that if your handler runs before the default handler it must not
invalidate the I<location> iter (or has to revalidate it).
The default signal handler revalidates it to be placed after the
inserted I<pixbuf>.

See also: C<gtk_text_buffer_insert_pixbuf()>.

  method handler (
    N-GObject $location,
    N-GObject $pixbuf,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($textbuffer),
    *%user-options
  );

=item $textbuffer; the object which received the signal

=item $location; position to insert I<pixbuf> in I<textbuffer>. A native GtkTextIter object.

=item $pixbuf; a native GdkPixbuf to be inserted


=comment #TS:0:insert-child-anchor:
=head3 insert-child-anchor

The I<insert-child-anchor> signal is emitted to insert a
B<Gnome::Gtk3::TextChildAnchor> in a B<Gnome::Gtk3::TextBuffer>.
Insertion actually occurs in the default handler.

Note that if your handler runs before the default handler it must
not invalidate the I<location> iter (or has to revalidate it).
The default signal handler revalidates it to be placed after the
inserted I<anchor>.

See also: C<gtk_text_buffer_insert_child_anchor()>.

  method handler (
    N-GObject $location,
    N-GObject $anchor,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($textbuffer),
    *%user-options
  );

=item $textbuffer; the object which received the signal

=item $location; position to insert I<anchor> in I<textbuffer>. A native GtkTextIter object.

=item $anchor; the native GtkTextChildAnchor object to be inserted


=comment #TS:0:delete-range:
=head3 delete-range

The I<delete-range> signal is emitted to delete a range
from a B<Gnome::Gtk3::TextBuffer>.

Note that if your handler runs before the default handler it must not
invalidate the I<start> and I<end> iters (or has to revalidate them).
The default signal handler revalidates the I<start> and I<end> iters to
both point to the location where text was deleted. Handlers
which run after the default handler (see C<g_signal_connect_after()>)
do not have access to the deleted text.

See also: C<gtk_text_buffer_delete()>.

  method handler (
    N-GObject $start,
    N-GObject $end,
    Int :$_handler_id,
    Gnome::GObject::Object :_widget($textbuffer),
    *%user-options
  );

=item $textbuffer; the object which received the signal

=item $start; the start of the range to be deleted. A native GtkTextIter