
@c %start of fragment

@deftp Class <gtk-text-iter>
Derives from @code{<gboxed>}.

@end deftp

@deffn Function gtk-text-iter-get-buffer  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-buffer>})
Returns the @code{<gtk-text-buffer>} this iterator is associated with.

@table @var
@item iter
an iterator

@item ret
the buffer

@end table

@end deffn

@deffn Function gtk-text-iter-copy  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-iter>})
Creates a dynamically-allocated copy of an iterator. This function is not useful
in applications, because iterators can be copied with a simple assignment
(@samp{GtkTextIter i = j;}). The function is used by language bindings.

@table @var
@item iter
an iterator

@item ret
a copy of the @var{iter}, free with @code{gtk-text-iter-free}

@end table

@end deffn

@deffn Function gtk-text-iter-get-offset  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
Returns the character offset of an iterator. Each character in a
@code{<gtk-text-buffer>} has an offset, starting with 0 for the first character
in the buffer. Use @code{gtk-text-buffer-get-iter-at-offset} to convert an
offset back into an iterator.

@table @var
@item iter
an iterator

@item ret
a character offset

@end table

@end deffn

@deffn Function gtk-text-iter-get-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
Returns the line number containing the iterator. Lines in a
@code{<gtk-text-buffer>} are numbered beginning with 0 for the first line in the
buffer.

@table @var
@item iter
an iterator

@item ret
a line number

@end table

@end deffn

@deffn Function gtk-text-iter-get-line-offset  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
Returns the character offset of the iterator, counting from the start of a
newline-terminated line. The first character on the line has offset 0.

@table @var
@item iter
an iterator

@item ret
offset from start of line

@end table

@end deffn

@deffn Function gtk-text-iter-get-line-index  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
Returns the byte index of the iterator, counting from the start of a
newline-terminated line. Remember that @code{<gtk-text-buffer>} encodes text in
UTF-8, and that characters can require a variable number of bytes to represent.

@table @var
@item iter
an iterator

@item ret
distance from start of line, in bytes

@end table

@end deffn

@deffn Function gtk-text-iter-get-char  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{unsigned-int32})
Returns the Unicode character at this iterator. (Equivalent to operator* on a
C++ iterator.) If the element at this iterator is a non-character element, such
as an image embedded in the buffer, the Unicode "unknown" character 0xFFFC is
returned. If invoked on the end iterator, zero is returned; zero is not a valid
Unicode character. So you can write a loop which ends when
@code{gtk-text-iter-get-char} returns 0.

@table @var
@item iter
an iterator

@item ret
a Unicode character, or 0 if @var{iter} is not dereferenceable

@end table

@end deffn

@deffn Function gtk-text-iter-get-slice  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
Returns the text in the given range. A "slice" is an array of characters encoded
in UTF-8 format, including the Unicode "unknown" character 0xFFFC for iterable
non-character elements in the buffer, such as images. Because images are encoded
in the slice, byte and character offsets in the returned array will correspond
to byte offsets in the text buffer. Note that 0xFFFC can occur in normal text as
well, so it is not a reliable indicator that a pixbuf or widget is in the
buffer.

@table @var
@item start
iterator at start of a range

@item end
iterator at end of a range

@item ret
slice of text from the buffer

@end table

@end deffn

@deffn Function gtk-text-iter-get-text  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
Returns @emph{text} in the given range. If the range contains non-text elements
such as images, the character and byte offsets in the returned string will not
correspond to character and byte offsets in the buffer. If you want offsets to
correspond, see @code{gtk-text-iter-get-slice}.

@table @var
@item start
iterator at start of a range

@item end
iterator at end of a range

@item ret
array of characters from the buffer

@end table

@end deffn

@deffn Function gtk-text-iter-get-visible-slice  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
Like @code{gtk-text-iter-get-slice}, but invisible text is not included.
Invisible text is usually invisible because a @code{<gtk-text-tag>} with the
"invisible" attribute turned on has been applied to it.

@table @var
@item start
iterator at start of range

@item end
iterator at end of range

@item ret
slice of text from the buffer

@end table

@end deffn

@deffn Function gtk-text-iter-get-visible-text  (self@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{mchars})
Like @code{gtk-text-iter-get-text}, but invisible text is not included.
Invisible text is usually invisible because a @code{<gtk-text-tag>} with the
"invisible" attribute turned on has been applied to it.

@table @var
@item start
iterator at start of range

@item end
iterator at end of range

@item ret
string containing visible text in the range

@end table

@end deffn

@deffn Function gtk-text-iter-get-pixbuf  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
If the element at @var{iter} is a pixbuf, the pixbuf is returned (with no new
reference count added). Otherwise, @samp{@code{#f}} is returned.

@table @var
@item iter
an iterator

@item ret
the pixbuf at @var{iter}

@end table

@end deffn

@deffn Function gtk-text-iter-get-marks  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{gslist-of})
Returns a list of all @code{<gtk-text-mark>} at this location. Because marks are
not iterable (they don't take up any "space" in the buffer, they are just marks
in between iterable locations), multiple marks can exist in the same place. The
returned list is not in any meaningful order.

@table @var
@item iter
an iterator

@item ret
list of @code{<gtk-text-mark>}

@end table

@end deffn

@deffn Function gtk-text-iter-get-toggled-tags  (self@tie{}@code{<gtk-text-iter>}) (toggled_on@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{gslist-of})
Returns a list of @code{<gtk-text-tag>} that are toggled on or off at this
point. (If @var{toggled-on} is @samp{@code{#t}}, the list contains tags that are
toggled on.) If a tag is toggled on at @var{iter}, then some non-empty range of
characters following @var{iter} has that tag applied to it. If a tag is toggled
off, then some non-empty range following @var{iter} does @emph{not} have the tag
applied to it.

@table @var
@item iter
an iterator

@item toggled-on
@samp{@code{#t}} to get toggled-on tags

@item ret
tags toggled at this point

@end table

@end deffn

@deffn Function gtk-text-iter-get-child-anchor  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<gtk-text-child-anchor>})
If the location at @var{iter} contains a child anchor, the anchor is returned
(with no new reference count added). Otherwise, @samp{@code{#f}} is returned.

@table @var
@item iter
an iterator

@item ret
the anchor at @var{iter}

@end table

@end deffn

@deffn Function gtk-text-iter-begins-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{tag} is toggled on at exactly this point. If
@var{tag} is @samp{@code{#f}}, returns @samp{@code{#t}} if any tag is toggled on
at this point. Note that the @code{gtk-text-iter-begins-tag} returns
@samp{@code{#t}} if @var{iter} is the @emph{start} of the tagged range;
@code{gtk-text-iter-has-tag} tells you whether an iterator is @emph{within} a
tagged range.

@table @var
@item iter
an iterator

@item tag
a @code{<gtk-text-tag>}, or @samp{@code{#f}}

@item ret
whether @var{iter} is the start of a range tagged with @var{tag}

@end table

@end deffn

@deffn Function gtk-text-iter-ends-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{tag} is toggled off at exactly this point. If
@var{tag} is @samp{@code{#f}}, returns @samp{@code{#t}} if any tag is toggled
off at this point. Note that the @code{gtk-text-iter-ends-tag} returns
@samp{@code{#t}} if @var{iter} is the @emph{end} of the tagged range;
@code{gtk-text-iter-has-tag} tells you whether an iterator is @emph{within} a
tagged range.

@table @var
@item iter
an iterator

@item tag
a @code{<gtk-text-tag>}, or @samp{@code{#f}}

@item ret
whether @var{iter} is the end of a range tagged with @var{tag}

@end table

@end deffn

@deffn Function gtk-text-iter-toggles-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
This is equivalent to (@code{gtk-text-iter-begins-tag} ||
@code{gtk-text-iter-ends-tag}), i.e. it tells you whether a range with @var{tag}
applied to it begins @emph{or} ends at @var{iter}.

@table @var
@item iter
an iterator

@item tag
a @code{<gtk-text-tag>}, or @samp{@code{#f}}

@item ret
whether @var{tag} is toggled on or off at @var{iter}

@end table

@end deffn

@deffn Function gtk-text-iter-has-tag  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{iter} is within a range tagged with @var{tag}.

@table @var
@item iter
an iterator

@item tag
a @code{<gtk-text-tag>}

@item ret
whether @var{iter} is tagged with @var{tag}

@end table

@end deffn

@deffn Function gtk-text-iter-get-tags  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{gslist-of})
Returns a list of tags that apply to @var{iter}, in ascending order of priority
(highest-priority tags are last). The @code{<gtk-text-tag>} in the list don't
have a reference added, but you have to free the list itself.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
list of @code{<gtk-text-tag>}

@end table

@end deffn

@deffn Function gtk-text-iter-editable  (self@tie{}@code{<gtk-text-iter>}) (default_setting@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
Returns whether the character at @var{iter} is within an editable region of
text. Non-editable text is "locked" and can't be changed by the user via
@code{<gtk-text-view>}. This function is simply a convenience wrapper around
@code{gtk-text-iter-get-attributes}. If no tags applied to this text affect
editability, @var{default-setting} will be returned.

You don't want to use this function to decide whether text can be inserted at
@var{iter}, because for insertion you don't want to know whether the char at
@var{iter} is inside an editable range, you want to know whether a new character
inserted at @var{iter} would be inside an editable range. Use
@code{gtk-text-iter-can-insert} to handle this case.

@table @var
@item iter
an iterator

@item default-setting
@samp{@code{#t}} if text is editable by default

@item ret
whether @var{iter} is inside an editable range

@end table

@end deffn

@deffn Function gtk-text-iter-can-insert  (self@tie{}@code{<gtk-text-iter>}) (default_editability@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{bool})
Considering the default editability of the buffer, and tags that affect
editability, determines whether text inserted at @var{iter} would be editable.
If text inserted at @var{iter} would be editable then the user should be allowed
to insert text at @var{iter}. @code{gtk-text-buffer-insert-interactive} uses
this function to decide whether insertions are allowed at a given position.

@table @var
@item iter
an iterator

@item default-editability
@samp{@code{#t}} if text is editable by default

@item ret
whether text inserted at @var{iter} would be editable

@end table

@end deffn

@deffn Function gtk-text-iter-starts-word  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Determines whether @var{iter} begins a natural-language word. Word breaks are
determined by Pango and should be correct for nearly any language (if not, the
correct fix would be to the Pango word break algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} is at the start of a word

@end table

@end deffn

@deffn Function gtk-text-iter-ends-word  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Determines whether @var{iter} ends a natural-language word. Word breaks are
determined by Pango and should be correct for nearly any language (if not, the
correct fix would be to the Pango word break algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} is at the end of a word

@end table

@end deffn

@deffn Function gtk-text-iter-inside-word  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Determines whether @var{iter} is inside a natural-language word (as opposed to
say inside some whitespace). Word breaks are determined by Pango and should be
correct for nearly any language (if not, the correct fix would be to the Pango
word break algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} is inside a word

@end table

@end deffn

@deffn Function gtk-text-iter-starts-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{iter} begins a paragraph, i.e. if
@code{gtk-text-iter-get-line-offset} would return 0. However this function is
potentially more efficient than @code{gtk-text-iter-get-line-offset} because it
doesn't have to compute the offset, it just has to see whether it's 0.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} begins a line

@end table

@end deffn

@deffn Function gtk-text-iter-ends-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{iter} points to the start of the paragraph
delimiter characters for a line (delimiters will be either a newline, a carriage
return, a carriage return followed by a newline, or a Unicode paragraph
separator character). Note that an iterator pointing to the \n of a \r\n pair
will not be counted as the end of a line, the line ends before the \r. The end
iterator is considered to be at the end of a line, even though there are no
paragraph delimiter chars there.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} is at the end of a line

@end table

@end deffn

@deffn Function gtk-text-iter-starts-sentence  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Determines whether @var{iter} begins a sentence. Sentence boundaries are
determined by Pango and should be correct for nearly any language (if not, the
correct fix would be to the Pango text boundary algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} is at the start of a sentence.

@end table

@end deffn

@deffn Function gtk-text-iter-ends-sentence  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Determines whether @var{iter} ends a sentence. Sentence boundaries are
determined by Pango and should be correct for nearly any language (if not, the
correct fix would be to the Pango text boundary algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} is at the end of a sentence.

@end table

@end deffn

@deffn Function gtk-text-iter-inside-sentence  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Determines whether @var{iter} is inside a sentence (as opposed to in between two
sentences, e.g. after a period and before the first letter of the next
sentence). Sentence boundaries are determined by Pango and should be correct for
nearly any language (if not, the correct fix would be to the Pango text boundary
algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} is inside a sentence.

@end table

@end deffn

@deffn Function gtk-text-iter-is-cursor-position  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
See @code{gtk-text-iter-forward-cursor-position} or @code{<pango-log-attr>} or
@code{pango-break} for details on what a cursor position is.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if the cursor can be placed at @var{iter}

@end table

@end deffn

@deffn Function gtk-text-iter-get-chars-in-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
Returns the number of characters in the line containing @var{iter}, including
the paragraph delimiters.

@table @var
@item iter
an iterator

@item ret
number of characters in the line

@end table

@end deffn

@deffn Function gtk-text-iter-get-bytes-in-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
Returns the number of bytes in the line containing @var{iter}, including the
paragraph delimiters.

@table @var
@item iter
an iterator

@item ret
number of bytes in the line

@end table

@end deffn

@deffn Function gtk-text-iter-get-attributes  (self@tie{}@code{<gtk-text-iter>}) (values@tie{}@code{<gtk-text-attributes>}) @result{}@tie{} (ret@tie{}@code{bool})
Computes the effect of any tags applied to this spot in the text. The
@var{values} parameter should be initialized to the default settings you wish to
use if no tags are in effect. You'd typically obtain the defaults from
@code{gtk-text-view-get-default-attributes}.

@code{gtk-text-iter-get-attributes} will modify @var{values}, applying the
effects of any tags present at @var{iter}. If any tags affected @var{values},
the function returns @samp{@code{#t}}.

@table @var
@item iter
an iterator

@item values
a @code{<gtk-text-attributes>} to be filled in

@item ret
@samp{@code{#t}} if @var{values} was modified

@end table

@end deffn

@deffn Function gtk-text-iter-get-language  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{<pango-language>})
A convenience wrapper around @code{gtk-text-iter-get-attributes}, which returns
the language in effect at @var{iter}. If no tags affecting language apply to
@var{iter}, the return value is identical to that of
@code{gtk-get-default-language}.

@table @var
@item iter
an iterator

@item ret
language in effect at @var{iter}

@end table

@end deffn

@deffn Function gtk-text-iter-is-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{iter} is the end iterator, i.e. one past the
last dereferenceable iterator in the buffer. @code{gtk-text-iter-is-end} is the
most efficient way to check whether an iterator is the end iterator.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} is the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-is-start  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Returns @samp{@code{#t}} if @var{iter} is the first iterator in the buffer, that
is if @var{iter} has a character offset of 0.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} is the first in the buffer

@end table

@end deffn

@deffn Function gtk-text-iter-forward-char  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{iter} forward by one character offset. Note that images embedded in
the buffer occupy 1 character slot, so @code{gtk-text-iter-forward-char} may
actually move onto an image instead of a character, if you have images in your
buffer. If @var{iter} is the end iterator or one character before it, @var{iter}
will now point at the end iterator, and @code{gtk-text-iter-forward-char}
returns @samp{@code{#f}} for convenience when writing loops.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} moved and is dereferenceable

@end table

@end deffn

@deffn Function gtk-text-iter-backward-char  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves backward by one character offset. Returns @samp{@code{#t}} if movement was
possible; if @var{iter} was the first in the buffer (character offset 0),
@code{gtk-text-iter-backward-char} returns @samp{@code{#f}} for convenience when
writing loops.

@table @var
@item iter
an iterator

@item ret
whether movement was possible

@end table

@end deffn

@deffn Function gtk-text-iter-forward-chars  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{count} characters if possible (if @var{count} would move past the
start or end of the buffer, moves to the start or end of the buffer). The return
value indicates whether the new position of @var{iter} is different from its
original position, and dereferenceable (the last iterator in the buffer is not
dereferenceable). If @var{count} is 0, the function does nothing and returns
@samp{@code{#f}}.

@table @var
@item iter
an iterator

@item count
number of characters to move, may be negative

@item ret
whether @var{iter} moved and is dereferenceable

@end table

@end deffn

@deffn Function gtk-text-iter-backward-chars  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{count} characters backward, if possible (if @var{count} would move
past the start or end of the buffer, moves to the start or end of the buffer).
The return value indicates whether the iterator moved onto a dereferenceable
position; if the iterator didn't move, or moved onto the end iterator, then
@samp{@code{#f}} is returned. If @var{count} is 0, the function does nothing and
returns @samp{@code{#f}}.

@table @var
@item iter
an iterator

@item count
number of characters to move

@item ret
whether @var{iter} moved and is dereferenceable

@end table

@end deffn

@deffn Function gtk-text-iter-forward-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{iter} to the start of the next line. Returns @samp{@code{#t}} if
there was a next line to move to, and @samp{@code{#f}} if @var{iter} was simply
moved to the end of the buffer and is now not dereferenceable, or if @var{iter}
was already at the end of the buffer.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} can be dereferenced

@end table

@end deffn

@deffn Function gtk-text-iter-backward-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{iter} to the start of the previous line. Returns @samp{@code{#t}} if
@var{iter} could be moved; i.e. if @var{iter} was at character offset 0, this
function returns @samp{@code{#f}}. Therefore if @var{iter} was already on line
0, but not at the start of the line, @var{iter} is snapped to the start of the
line and the function returns @samp{@code{#t}}. (Note that this implies that in
a loop calling this function, the line number may not change on every iteration,
if your first iteration is on line 0.)

@table @var
@item iter
an iterator

@item ret
whether @var{iter} moved

@end table

@end deffn

@deffn Function gtk-text-iter-forward-lines  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{count} lines forward, if possible (if @var{count} would move past the
start or end of the buffer, moves to the start or end of the buffer). The return
value indicates whether the iterator moved onto a dereferenceable position; if
the iterator didn't move, or moved onto the end iterator, then @samp{@code{#f}}
is returned. If @var{count} is 0, the function does nothing and returns
@samp{@code{#f}}. If @var{count} is negative, moves backward by 0 - @var{count}
lines.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item count
number of lines to move forward

@item ret
whether @var{iter} moved and is dereferenceable

@end table

@end deffn

@deffn Function gtk-text-iter-backward-lines  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{count} lines backward, if possible (if @var{count} would move past
the start or end of the buffer, moves to the start or end of the buffer). The
return value indicates whether the iterator moved onto a dereferenceable
position; if the iterator didn't move, or moved onto the end iterator, then
@samp{@code{#f}} is returned. If @var{count} is 0, the function does nothing and
returns @samp{@code{#f}}. If @var{count} is negative, moves forward by 0 -
@var{count} lines.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item count
number of lines to move backward

@item ret
whether @var{iter} moved and is dereferenceable

@end table

@end deffn

@deffn Function gtk-text-iter-forward-word-ends  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Calls @code{gtk-text-iter-forward-word-end} up to @var{count} times.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item count
number of times to move

@item ret
@samp{@code{#t}} if @var{iter} moved and is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-backward-word-starts  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Calls @code{gtk-text-iter-backward-word-start} up to @var{count} times.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item count
number of times to move

@item ret
@samp{@code{#t}} if @var{iter} moved and is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-forward-word-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves forward to the next word end. (If @var{iter} is currently on a word end,
moves forward to the next one after that.) Word breaks are determined by Pango
and should be correct for nearly any language (if not, the correct fix would be
to the Pango word break algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} moved and is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-backward-word-start  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves backward to the previous word start. (If @var{iter} is currently on a word
start, moves backward to the next one after that.) Word breaks are determined by
Pango and should be correct for nearly any language (if not, the correct fix
would be to the Pango word break algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} moved and is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-forward-sentence-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves forward to the next sentence end. (If @var{iter} is at the end of a
sentence, moves to the next end of sentence.) Sentence boundaries are determined
by Pango and should be correct for nearly any language (if not, the correct fix
would be to the Pango text boundary algorithms).

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if @var{iter} moved and is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-forward-sentence-ends  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Calls @code{gtk-text-iter-forward-sentence-end}@var{count} times (or until
@code{gtk-text-iter-forward-sentence-end} returns @samp{@code{#f}}). If
@var{count} is negative, moves backward instead of forward.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item count
number of sentences to move

@item ret
@samp{@code{#t}} if @var{iter} moved and is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-forward-visible-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{iter} to the start of the next visible line. Returns @samp{@code{#t}}
if there was a next line to move to, and @samp{@code{#f}} if @var{iter} was
simply moved to the end of the buffer and is now not dereferenceable, or if
@var{iter} was already at the end of the buffer.

@table @var
@item iter
an iterator

@item ret
whether @var{iter} can be dereferenced

@end table

Since 2.8

@end deffn

@deffn Function gtk-text-iter-backward-visible-line  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{iter} to the start of the previous visible line. Returns
@samp{@code{#t}} if @var{iter} could be moved; i.e. if @var{iter} was at
character offset 0, this function returns @samp{@code{#f}}. Therefore if
@var{iter} was already on line 0, but not at the start of the line, @var{iter}
is snapped to the start of the line and the function returns @samp{@code{#t}}.
(Note that this implies that in a loop calling this function, the line number
may not change on every iteration, if your first iteration is on line 0.)

@table @var
@item iter
an iterator

@item ret
whether @var{iter} moved

@end table

Since 2.8

@end deffn

@deffn Function gtk-text-iter-forward-visible-lines  (self@tie{}@code{<gtk-text-iter>}) (count@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{bool})
Moves @var{count} visible lines forward, if possible (if @var{count} would move
past the start or end of the buffer, moves to the start or end of the buffer).
The return value indicates whether the iterator moved onto a dereferenceable
position; if the iterator didn't move, or moved onto the end iterator, then
@samp{@code{#f}} is returned. If @var{count} is 0, the function does nothing and
returns @samp{@code{#f}}. If @var{count} is negative, moves backward by 0 -
@var{count} lines.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item count
number of lines to move forward

@item ret
whether @var{iter} moved and is dereferenceable

@end table

Since 2.8

@end deffn

@deffn Function gtk-text-iter-set-offset  (self@tie{}@code{<gtk-text-iter>}) (char_offset@tie{}@code{int})
Sets @var{iter} to point to @var{char-offset}. @var{char-offset} counts from the
start of the entire text buffer, starting with 0.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item char-offset
a character number

@end table

@end deffn

@deffn Function gtk-text-iter-set-line  (self@tie{}@code{<gtk-text-iter>}) (line_number@tie{}@code{int})
Moves iterator @var{iter} to the start of the line @var{line-number}. If
@var{line-number} is negative or larger than the number of lines in the buffer,
moves @var{iter} to the start of the last line in the buffer.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item line-number
line number (counted from 0)

@end table

@end deffn

@deffn Function gtk-text-iter-set-line-offset  (self@tie{}@code{<gtk-text-iter>}) (char_on_line@tie{}@code{int})
Moves @var{iter} within a line, to a new @emph{character} (not byte) offset. The
given character offset must be less than or equal to the number of characters in
the line; if equal, @var{iter} moves to the start of the next line. See
@code{gtk-text-iter-set-line-index} if you have a byte index rather than a
character offset.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item char-on-line
a character offset relative to the start of @var{iter}'s current line

@end table

@end deffn

@deffn Function gtk-text-iter-set-line-index  (self@tie{}@code{<gtk-text-iter>}) (byte_on_line@tie{}@code{int})
Same as @code{gtk-text-iter-set-line-offset}, but works with a @emph{byte}
index. The given byte index must be at the start of a character, it can't be in
the middle of a UTF-8 encoded character.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item byte-on-line
a byte index relative to the start of @var{iter}'s current line

@end table

@end deffn

@deffn Function gtk-text-iter-forward-to-end  (self@tie{}@code{<gtk-text-iter>})
Moves @var{iter} forward to the "end iterator," which points one past the last
valid character in the buffer. @code{gtk-text-iter-get-char} called on the end
iterator returns 0, which is convenient for writing loops.

@table @var
@item iter
a @code{<gtk-text-iter>}

@end table

@end deffn

@deffn Function gtk-text-iter-forward-to-line-end  (self@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves the iterator to point to the paragraph delimiter characters, which will be
either a newline, a carriage return, a carriage return/newline in sequence, or
the Unicode paragraph separator character. If the iterator is already at the
paragraph delimiter characters, moves to the paragraph delimiter characters for
the next line. If @var{iter} is on the last line in the buffer, which does not
end in paragraph delimiters, moves to the end iterator (end of the last line),
and returns @samp{@code{#f}}.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if we moved and the new location is not the end iterator

@end table

@end deffn

@deffn Function gtk-text-iter-forward-to-tag-toggle  (self@tie{}@code{<gtk-text-iter>}) (tag@tie{}@code{<gtk-text-tag>}) @result{}@tie{} (ret@tie{}@code{bool})
Moves forward to the next toggle (on or off) of the
@code{<gtk-text-tag>}@var{tag}, or to the next toggle of any tag if @var{tag} is
@samp{@code{#f}}. If no matching tag toggles are found, returns
@samp{@code{#f}}, otherwise @samp{@code{#t}}. Does not return toggles located at
@var{iter}, only toggles after @var{iter}. Sets @var{iter} to the location of
the toggle, or to the end of the buffer if no toggle is found.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item tag
a @code{<gtk-text-tag>}, or @samp{@code{#f}}

@item ret
whether we found a tag toggle after @var{iter}

@end table

@end deffn

@deffn Function gtk-text-iter-forward-search  (self@tie{}@code{<gtk-text-iter>}) (str@tie{}@code{mchars}) (flags@tie{}@code{<gtk-text-search-flags>}) (match_start@tie{}@code{<gtk-text-iter>}) (match_end@tie{}@code{<gtk-text-iter>}) (limit@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Searches forward for @var{str}. Any match is returned by setting
@var{match-start} to the first character of the match and @var{match-end} to the
first character after the match. The search will not continue past @var{limit}.
Note that a search is a linear or O(n) operation, so you may wish to use
@var{limit} to avoid locking up your UI on large buffers.

If the @code{<gtk-text-search-visible-only>} flag is present, the match may have
invisible text interspersed in @var{str}. i.e. @var{str} will be a
possibly-noncontiguous subsequence of the matched range. similarly, if you
specify @code{<gtk-text-search-text-only>}, the match may have pixbufs or child
widgets mixed inside the matched range. If these flags are not given, the match
must be exact; the special 0xFFFC character in @var{str} will match embedded
pixbufs or child widgets.

@table @var
@item iter
start of search

@item str
a search string

@item flags
flags affecting how the search is done

@item match-start
return location for start of match, or @samp{@code{#f}}

@item match-end
return location for end of match, or @samp{@code{#f}}

@item limit
bound for the search, or @samp{@code{#f}} for the end of the buffer

@item ret
whether a match was found

@end table

@end deffn

@deffn Function gtk-text-iter-backward-search  (self@tie{}@code{<gtk-text-iter>}) (str@tie{}@code{mchars}) (flags@tie{}@code{<gtk-text-search-flags>}) (match_start@tie{}@code{<gtk-text-iter>}) (match_end@tie{}@code{<gtk-text-iter>}) (limit@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Same as @code{gtk-text-iter-forward-search}, but moves backward.

@table @var
@item iter
a @code{<gtk-text-iter>} where the search begins

@item str
search string

@item flags
bitmask of flags affecting the search

@item match-start
return location for start of match, or @samp{@code{#f}}

@item match-end
return location for end of match, or @samp{@code{#f}}

@item limit
location of last possible @var{match-start}, or @samp{@code{#f}} for start of
buffer

@item ret
whether a match was found

@end table

@end deffn

@deffn Function gtk-text-iter-equal  (self@tie{}@code{<gtk-text-iter>}) (rhs@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Tests whether two iterators are equal, using the fastest possible mechanism.
This function is very fast; you can expect it to perform better than e.g.
getting the character offset for each iterator and comparing the offsets
yourself. Also, it's a bit faster than @code{gtk-text-iter-compare}.

@table @var
@item lhs
a @code{<gtk-text-iter>}

@item rhs
another @code{<gtk-text-iter>}

@item ret
@samp{@code{#t}} if the iterators point to the same place in the buffer

@end table

@end deffn

@deffn Function gtk-text-iter-compare  (self@tie{}@code{<gtk-text-iter>}) (rhs@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{int})
A @code{qsort}-style function that returns negative if @var{lhs} is less than
@var{rhs}, positive if @var{lhs} is greater than @var{rhs}, and 0 if they're
equal. Ordering is in character offset order, i.e. the first character in the
buffer is less than the second character in the buffer.

@table @var
@item lhs
a @code{<gtk-text-iter>}

@item rhs
another @code{<gtk-text-iter>}

@item ret
-1 if @var{lhs} is less than @var{rhs}, 1 if @var{lhs} is greater, 0 if they are
equal

@end table

@end deffn

@deffn Function gtk-text-iter-in-range  (self@tie{}@code{<gtk-text-iter>}) (start@tie{}@code{<gtk-text-iter>}) (end@tie{}@code{<gtk-text-iter>}) @result{}@tie{} (ret@tie{}@code{bool})
Checks whether @var{iter} falls in the range [@var{start}, @var{end}).
@var{start} and @var{end} must be in ascending order.

@table @var
@item iter
a @code{<gtk-text-iter>}

@item start
start of range

@item end
end of range

@item ret
@samp{@code{#t}} if @var{iter} is in the range

@end table

@end deffn

@deffn Function gtk-text-iter-order  (self@tie{}@code{<gtk-text-iter>}) (second@tie{}@code{<gtk-text-iter>})
Swaps the value of @var{first} and @var{second} if @var{second} comes before
@var{first} in the buffer. That is, ensures that @var{first} and @var{second}
are in sequence. Most text buffer functions that take a range call this
automatically on your behalf, so there's no real reason to call it yourself in
those cases. There are some exceptions, such as @code{gtk-text-iter-in-range},
that expect a pre-sorted range.

@table @var
@item first
a @code{<gtk-text-iter>}

@item second
another @code{<gtk-text-iter>}

@end table

@end deffn


@c %end of fragment
