Gtk.Text_Iter

Entities

Simple Types

Constants

Subprograms

Generic Instantiations

Description

You may wish to begin by reading the [text widget conceptual overview][TextWidget] which gives an overview of all the objects and data types related to the text widget and how they work together.

Assign

procedure Assign (Iter : Gtk_Text_Iter; Other : Gtk_Text_Iter)

Assigns the value of Other to Iter. This function is not useful in applications, because iterators can be assigned with GtkTextIter i = j;. The function is used by language bindings. Since: gtk+ 3.2

Parameters
Iter
Other

another Gtk.Text_Iter.Gtk_Text_Iter

Backward_Char

procedure Backward_Char
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves backward by one character offset. Returns True if movement was possible; if Iter was the first in the buffer (character offset 0), Gtk.Text_Iter.Backward_Char returns False for convenience when writing loops. @return whether movement was possible

Parameters
Iter
Result

Backward_Chars

procedure Backward_Chars
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves Count characters backward, if possible (if 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 False is returned. If Count is 0, the function does nothing and returns False.

Parameters
Iter
Count

number of characters to move @return whether Iter moved and is dereferenceable

Result

Backward_Cursor_Position

procedure Backward_Cursor_Position
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Like Gtk.Text_Iter.Forward_Cursor_Position, but moves backward. @return True if we moved

Parameters
Iter
Result

Backward_Cursor_Positions

procedure Backward_Cursor_Positions
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves up to Count cursor positions. See Gtk.Text_Iter.Forward_Cursor_Position for details.

Parameters
Iter
Count

number of positions to move @return True if we moved and the new position is dereferenceable

Result

Backward_Line

procedure Backward_Line
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter to the start of the previous line. Returns True if Iter could be moved; i.e. if Iter was at character offset 0, this function returns False. Therefore if Iter was already on line 0, but not at the start of the line, Iter is snapped to the start of the line and the function returns True. (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.) @return whether Iter moved

Parameters
Iter
Result

Backward_Lines

procedure Backward_Lines
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves Count lines backward, if possible (if 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 False is returned. If Count is 0, the function does nothing and returns False. If Count is negative, moves forward by 0 - Count lines.

Parameters
Iter
Count

number of lines to move backward @return whether Iter moved and is dereferenceable

Result

Backward_Search

procedure Backward_Search
   (Iter        : in out Gtk_Text_Iter;
    Str         : UTF8_String;
    Flags       : Gtk_Text_Search_Flags;
    Match_Start : out Gtk_Text_Iter;
    Match_End   : out Gtk_Text_Iter;
    Limit       : Gtk_Text_Iter := Null_Text_Iter;
    Result      : out Boolean)

Same as Gtk.Text_Iter.Forward_Search, but moves backward. Match_End will never be set to a Gtk.Text_Iter.Gtk_Text_Iter located after Iter, even if there is a possible Match_Start before or at Iter.

Parameters
Iter
Str

search string

Flags

bitmask of flags affecting the search

Match_Start

return location for start of match, or null

Match_End

return location for end of match, or null

Limit

location of last possible Match_Start, or null for start of buffer @return whether a match was found

Result

Backward_Sentence_Start

procedure Backward_Sentence_Start
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves backward to the previous sentence start; if Iter is already at the start of a sentence, moves backward to the next one. 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). @return True if Iter moved and is not the end iterator

Parameters
Iter
Result

Backward_Sentence_Starts

procedure Backward_Sentence_Starts
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Calls Gtk.Text_Iter.Backward_Sentence_Start up to Count times, or until it returns False. If Count is negative, moves forward instead of backward.

Parameters
Iter
Count

number of sentences to move @return True if Iter moved and is not the end iterator

Result

Backward_To_Tag_Toggle

procedure Backward_To_Tag_Toggle
   (Iter   : in out Gtk_Text_Iter;
    Tag    : Gtk.Text_Tag.Gtk_Text_Tag := null;
    Result : out Boolean)

Moves backward to the next toggle (on or off) of the Gtk.Text_Tag.Gtk_Text_Tag Tag, or to the next toggle of any tag if Tag is null. If no matching tag toggles are found, returns False, otherwise True. Does not return toggles located at Iter, only toggles before Iter. Sets Iter to the location of the toggle, or the start of the buffer if no toggle is found.

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag, or null @return whether we found a tag toggle before Iter

Result

Backward_Visible_Cursor_Position

procedure Backward_Visible_Cursor_Position
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter forward to the previous visible cursor position. See Gtk.Text_Iter.Backward_Cursor_Position for details. Since: gtk+ 2.4 @return True if we moved and the new position is dereferenceable

Parameters
Iter
Result

Backward_Visible_Cursor_Positions

procedure Backward_Visible_Cursor_Positions
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves up to Count visible cursor positions. See Gtk.Text_Iter.Backward_Cursor_Position for details. Since: gtk+ 2.4

Parameters
Iter
Count

number of positions to move @return True if we moved and the new position is dereferenceable

Result

Backward_Visible_Line

procedure Backward_Visible_Line
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter to the start of the previous visible line. Returns True if Iter could be moved; i.e. if Iter was at character offset 0, this function returns False. Therefore if Iter was already on line 0, but not at the start of the line, Iter is snapped to the start of the line and the function returns True. (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.) Since: gtk+ 2.8 @return whether Iter moved

Parameters
Iter
Result

Backward_Visible_Lines

procedure Backward_Visible_Lines
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves Count visible lines backward, if possible (if 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 False is returned. If Count is 0, the function does nothing and returns False. If Count is negative, moves forward by 0 - Count lines. Since: gtk+ 2.8

Parameters
Iter
Count

number of lines to move backward @return whether Iter moved and is dereferenceable

Result

Backward_Visible_Word_Start

procedure Backward_Visible_Word_Start
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves backward to the previous visible word start. (If 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). Since: gtk+ 2.4 @return True if Iter moved and is not the end iterator

Parameters
Iter
Result

Backward_Visible_Word_Starts

procedure Backward_Visible_Word_Starts
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Calls Gtk.Text_Iter.Backward_Visible_Word_Start up to Count times. Since: gtk+ 2.4

Parameters
Iter
Count

number of times to move @return True if Iter moved and is not the end iterator

Result

Backward_Word_Start

procedure Backward_Word_Start
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves backward to the previous word start. (If 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). @return True if Iter moved and is not the end iterator

Parameters
Iter
Result

Backward_Word_Starts

procedure Backward_Word_Starts
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Calls Gtk.Text_Iter.Backward_Word_Start up to Count times.

Parameters
Iter
Count

number of times to move @return True if Iter moved and is not the end iterator

Result

Begins_Tag

function Begins_Tag
   (Iter : Gtk_Text_Iter;
    Tag  : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class) return Boolean

Returns True if Tag is toggled on at exactly this point. If Tag is null, returns True if any tag is toggled on at this point. Note that if Gtk.Text_Iter.Begins_Tag returns True, it means that Iter is at the beginning of the tagged range, and that the character at Iter is inside the tagged range. In other words, unlike Gtk.Text_Iter.Ends_Tag, if Gtk.Text_Iter.Begins_Tag returns True, Gtk.Text_Iter.Has_Tag will also return True for the same parameters. Deprecated since 3.20, 1

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag, or null

Return Value

whether Iter is the start of a range tagged with Tag

Can_Insert

function Can_Insert
   (Iter                : Gtk_Text_Iter;
    Default_Editability : Boolean) return Boolean

Considering the default editability of the buffer, and tags that affect editability, determines whether text inserted at Iter would be editable. If text inserted at Iter would be editable then the user should be allowed to insert text at Iter. Gtk.Text_Buffer.Insert_Interactive uses this function to decide whether insertions are allowed at a given position.

Parameters
Iter
Default_Editability

True if text is editable by default

Return Value

whether text inserted at Iter would be editable

Case_Insensitive

Case_Insensitive : constant Gtk_Text_Search_Flags := 4;

Compare

function Compare
   (Iter : Gtk_Text_Iter;
    Rhs  : Gtk_Text_Iter) return Glib.Gint

A qsort-style function that returns negative if Lhs is less than Rhs, positive if Lhs is greater than 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.

Parameters
Iter
Rhs

another Gtk.Text_Iter.Gtk_Text_Iter

Return Value

-1 if Lhs is less than Rhs, 1 if Lhs is greater, 0 if they are equal

Copy

procedure Copy (Source : Gtk_Text_Iter; Dest : out Gtk_Text_Iter)

Create a copy of Source.

Parameters
Source
Dest

Editable

function Editable
   (Iter            : Gtk_Text_Iter;
    Default_Setting : Boolean) return Boolean

Returns whether the character at Iter is within an editable region of text. Non-editable text is "locked" and can't be changed by the user via Gtk.Text_View.Gtk_Text_View. This function is simply a convenience wrapper around Gtk.Text_Iter.Get_Attributes. If no tags applied to this text affect editability, Default_Setting will be returned. You don't want to use this function to decide whether text can be inserted at Iter, because for insertion you don't want to know whether the char at Iter is inside an editable range, you want to know whether a new character inserted at Iter would be inside an editable range. Use Gtk.Text_Iter.Can_Insert to handle this case.

Parameters
Iter
Default_Setting

True if text is editable by default

Return Value

whether Iter is inside an editable range

Ends_Line

function Ends_Line (Iter : Gtk_Text_Iter) return Boolean

Returns True if 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.

Parameters
Iter
Return Value

whether Iter is at the end of a line

Ends_Sentence

function Ends_Sentence (Iter : Gtk_Text_Iter) return Boolean

Determines whether 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).

Parameters
Iter
Return Value

True if Iter is at the end of a sentence.

Ends_Tag

function Ends_Tag
   (Iter : Gtk_Text_Iter;
    Tag  : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class) return Boolean

Returns True if Tag is toggled off at exactly this point. If Tag is null, returns True if any tag is toggled off at this point. Note that if Gtk.Text_Iter.Ends_Tag returns True, it means that Iter is at the end of the tagged range, but that the character at Iter is outside the tagged range. In other words, unlike Gtk.Text_Iter.Starts_Tag, if Gtk.Text_Iter.Ends_Tag returns True, Gtk.Text_Iter.Has_Tag will return False for the same parameters.

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag, or null

Return Value

whether Iter is the end of a range tagged with Tag

Ends_Word

function Ends_Word (Iter : Gtk_Text_Iter) return Boolean

Determines whether 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).

Parameters
Iter
Return Value

True if Iter is at the end of a word

Equal

function Equal (Iter : Gtk_Text_Iter; Rhs : Gtk_Text_Iter) return Boolean

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 Gtk.Text_Iter.Compare.

Parameters
Iter
Rhs

another Gtk.Text_Iter.Gtk_Text_Iter

Return Value

True if the iterators point to the same place in the buffer

Forward_Char

procedure Forward_Char
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter forward by one character offset. Note that images embedded in the buffer occupy 1 character slot, so Gtk.Text_Iter.Forward_Char may actually move onto an image instead of a character, if you have images in your buffer. If Iter is the end iterator or one character before it, Iter will now point at the end iterator, and Gtk.Text_Iter.Forward_Char returns False for convenience when writing loops. @return whether Iter moved and is dereferenceable

Parameters
Iter
Result

Forward_Chars

procedure Forward_Chars
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves Count characters if possible (if 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 Iter is different from its original position, and dereferenceable (the last iterator in the buffer is not dereferenceable). If Count is 0, the function does nothing and returns False.

Parameters
Iter
Count

number of characters to move, may be negative @return whether Iter moved and is dereferenceable

Result

Forward_Cursor_Position

procedure Forward_Cursor_Position
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter forward by a single cursor position. Cursor positions are (unsurprisingly) positions where the cursor can appear. Perhaps surprisingly, there may not be a cursor position between all characters. The most common example for European languages would be a carriage return/newline sequence. For some Unicode characters, the equivalent of say the letter "a" with an accent mark will be represented as two characters, first the letter then a "combining mark" that causes the accent to be rendered; so the cursor can't go between those two characters. See also the Pango_Log_Attr-struct and pango_break function. @return True if we moved and the new position is dereferenceable

Parameters
Iter
Result

Forward_Cursor_Positions

procedure Forward_Cursor_Positions
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves up to Count cursor positions. See Gtk.Text_Iter.Forward_Cursor_Position for details.

Parameters
Iter
Count

number of positions to move @return True if we moved and the new position is dereferenceable

Result

Forward_Line

procedure Forward_Line
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter to the start of the next line. If the iter is already on the last line of the buffer, moves the iter to the end of the current line. If after the operation, the iter is at the end of the buffer and not dereferencable, returns False. Otherwise, returns True. @return whether Iter can be dereferenced

Parameters
Iter
Result

Forward_Lines

procedure Forward_Lines
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves Count lines forward, if possible (if 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 False is returned. If Count is 0, the function does nothing and returns False. If Count is negative, moves backward by 0 - Count lines.

Parameters
Iter
Count

number of lines to move forward @return whether Iter moved and is dereferenceable

Result

Forward_Search

procedure Forward_Search
   (Iter        : in out Gtk_Text_Iter;
    Str         : UTF8_String;
    Flags       : Gtk_Text_Search_Flags;
    Match_Start : out Gtk_Text_Iter;
    Match_End   : out Gtk_Text_Iter;
    Limit       : Gtk_Text_Iter := Null_Text_Iter;
    Result      : out Boolean)

Searches forward for Str. Any match is returned by setting Match_Start to the first character of the match and Match_End to the first character after the match. The search will not continue past Limit. Note that a search is a linear or O(n) operation, so you may wish to use Limit to avoid locking up your UI on large buffers. Match_Start will never be set to a Gtk.Text_Iter.Gtk_Text_Iter located before Iter, even if there is a possible Match_End after or at Iter.

Parameters
Iter
Str

a search string

Flags

flags affecting how the search is done

Match_Start

return location for start of match, or null

Match_End

return location for end of match, or null

Limit

location of last possible Match_End, or null for the end of the buffer @return whether a match was found

Result

Forward_Sentence_End

procedure Forward_Sentence_End
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves forward to the next sentence end. (If 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). @return True if Iter moved and is not the end iterator

Parameters
Iter
Result

Forward_Sentence_Ends

procedure Forward_Sentence_Ends
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Calls Gtk.Text_Iter.Forward_Sentence_End Count times (or until Gtk.Text_Iter.Forward_Sentence_End returns False). If Count is negative, moves backward instead of forward.

Parameters
Iter
Count

number of sentences to move @return True if Iter moved and is not the end iterator

Result

Forward_To_End

procedure Forward_To_End (Iter : in out Gtk_Text_Iter)

Moves Iter forward to the "end iterator," which points one past the last valid character in the buffer. Gtk.Text_Iter.Get_Char called on the end iterator returns 0, which is convenient for writing loops.

Parameters
Iter

Forward_To_Line_End

procedure Forward_To_Line_End
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

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 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 False. @return True if we moved and the new location is not the end iterator

Parameters
Iter
Result

Forward_To_Tag_Toggle

procedure Forward_To_Tag_Toggle
   (Iter   : in out Gtk_Text_Iter;
    Tag    : Gtk.Text_Tag.Gtk_Text_Tag := null;
    Result : out Boolean)

Moves forward to the next toggle (on or off) of the Gtk.Text_Tag.Gtk_Text_Tag Tag, or to the next toggle of any tag if Tag is null. If no matching tag toggles are found, returns False, otherwise True. Does not return toggles located at Iter, only toggles after Iter. Sets Iter to the location of the toggle, or to the end of the buffer if no toggle is found.

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag, or null @return whether we found a tag toggle after Iter

Result

Forward_Visible_Cursor_Position

procedure Forward_Visible_Cursor_Position
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter forward to the next visible cursor position. See Gtk.Text_Iter.Forward_Cursor_Position for details. Since: gtk+ 2.4 @return True if we moved and the new position is dereferenceable

Parameters
Iter
Result

Forward_Visible_Cursor_Positions

procedure Forward_Visible_Cursor_Positions
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves up to Count visible cursor positions. See Gtk.Text_Iter.Forward_Cursor_Position for details. Since: gtk+ 2.4

Parameters
Iter
Count

number of positions to move @return True if we moved and the new position is dereferenceable

Result

Forward_Visible_Line

procedure Forward_Visible_Line
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves Iter to the start of the next visible line. Returns True if there was a next line to move to, and False if Iter was simply moved to the end of the buffer and is now not dereferenceable, or if Iter was already at the end of the buffer. Since: gtk+ 2.8 @return whether Iter can be dereferenced

Parameters
Iter
Result

Forward_Visible_Lines

procedure Forward_Visible_Lines
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Moves Count visible lines forward, if possible (if 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 False is returned. If Count is 0, the function does nothing and returns False. If Count is negative, moves backward by 0 - Count lines. Since: gtk+ 2.8

Parameters
Iter
Count

number of lines to move forward @return whether Iter moved and is dereferenceable

Result

Forward_Visible_Word_End

procedure Forward_Visible_Word_End
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves forward to the next visible word end. (If 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). Since: gtk+ 2.4 @return True if Iter moved and is not the end iterator

Parameters
Iter
Result

Forward_Visible_Word_Ends

procedure Forward_Visible_Word_Ends
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Calls Gtk.Text_Iter.Forward_Visible_Word_End up to Count times. Since: gtk+ 2.4

Parameters
Iter
Count

number of times to move @return True if Iter moved and is not the end iterator

Result

Forward_Word_End

procedure Forward_Word_End
   (Iter   : in out Gtk_Text_Iter;
    Result : out Boolean)

Moves forward to the next word end. (If 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). @return True if Iter moved and is not the end iterator

Parameters
Iter
Result

Forward_Word_Ends

procedure Forward_Word_Ends
   (Iter   : in out Gtk_Text_Iter;
    Count  : Glib.Gint;
    Result : out Boolean)

Calls Gtk.Text_Iter.Forward_Word_End up to Count times.

Parameters
Iter
Count

number of times to move @return True if Iter moved and is not the end iterator

Result

Free

procedure Free (Iter : Gtk_Text_Iter)

Free an iterator allocated on the heap. This function is intended for use in language bindings, and is not especially useful for applications, because iterators can simply be allocated on the stack.

Parameters
Iter

From_Object_Free

function From_Object_Free (B : access Gtk_Text_Iter) return Gtk_Text_Iter

You may wish to begin by reading the [text widget conceptual overview][TextWidget] which gives an overview of all the objects and data types related to the text widget and how they work together.

Parameters
B
Return Value

Get_Attributes

function Get_Attributes
   (Iter   : Gtk_Text_Iter;
    Values : access Gtk.Text_Attributes.Gtk_Text_Attributes)
    return Boolean

Computes the effect of any tags applied to this spot in the text. The 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 Gtk.Text_View.Get_Default_Attributes. Gtk.Text_Iter.Get_Attributes will modify Values, applying the effects of any tags present at Iter. If any tags affected Values, the function returns True.

Parameters
Iter
Values

a Gtk.Text_Attributes.Gtk_Text_Attributes to be filled in

Return Value

True if Values was modified

Get_Bytes_In_Line

function Get_Bytes_In_Line (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the number of bytes in the line containing Iter, including the paragraph delimiters.

Parameters
Iter
Return Value

number of bytes in the line

Get_Char

function Get_Char (Iter : Gtk_Text_Iter) return Gunichar

The Unicode character at this iterator is returned. (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 Gtk.Text_Iter.Get_Char returns 0.

Parameters
Iter
Return Value

a Unicode character, or 0 if Iter is not dereferenceable

Get_Char

function Get_Char (Iter : Gtk_Text_Iter) return Character

Return the character immediately following Iter. If Iter is at the end of the buffer, then return ASCII.NUL. Note that this function assumes that the text is encoded in ASCII format. If this is not the case, use the Get_Char function that returns a Gunichar instead.

Parameters
Iter
Return Value

Get_Chars_In_Line

function Get_Chars_In_Line (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the number of characters in the line containing Iter, including the paragraph delimiters.

Parameters
Iter
Return Value

number of characters in the line

Get_Language

function Get_Language
   (Iter : Gtk_Text_Iter) return Pango.Language.Pango_Language

A convenience wrapper around Gtk.Text_Iter.Get_Attributes, which returns the language in effect at Iter. If no tags affecting language apply to Iter, the return value is identical to that of Gtk.Main.Get_Default_Language.

Parameters
Iter
Return Value

language in effect at Iter

Get_Line

function Get_Line (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the line number containing the iterator. Lines in a Gtk.Text_Buffer.Gtk_Text_Buffer are numbered beginning with 0 for the first line in the buffer.

Parameters
Iter
Return Value

a line number

Get_Line_Index

function Get_Line_Index (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the byte index of the iterator, counting from the start of a newline-terminated line. Remember that Gtk.Text_Buffer.Gtk_Text_Buffer encodes text in UTF-8, and that characters can require a variable number of bytes to represent.

Parameters
Iter
Return Value

distance from start of line, in bytes

Get_Line_Offset

function Get_Line_Offset (Iter : Gtk_Text_Iter) return Glib.Gint

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.

Parameters
Iter
Return Value

offset from start of line

Get_Marks

function Get_Marks
   (Iter : Gtk_Text_Iter) return Glib.Object.Object_List.GSlist

Returns a list of all Gtk.Text_Mark.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.

Parameters
Iter
Return Value

Get_Offset

function Get_Offset (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the character offset of an iterator. Each character in a Gtk.Text_Buffer.Gtk_Text_Buffer has an offset, starting with 0 for the first character in the buffer. Use Gtk.Text_Buffer.Get_Iter_At_Offset to convert an offset back into an iterator.

Parameters
Iter
Return Value

a character offset

Get_Pixbuf

function Get_Pixbuf (Iter : Gtk_Text_Iter) return Gdk.Pixbuf.Gdk_Pixbuf

If the element at Iter is a pixbuf, the pixbuf is returned (with no new reference count added). Otherwise, null is returned.

Parameters
Iter
Return Value

the pixbuf at Iter

Get_Slice

function Get_Slice
   (Iter    : Gtk_Text_Iter;
    The_End : Gtk_Text_Iter) return UTF8_String

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.

Parameters
Iter
The_End

iterator at end of a range

Return Value

slice of text from the buffer

Get_Slice

function Get_Slice
  (Start   : Gtk_Text_Iter;
   The_End : Gtk_Text_Iter) return Gtkada.Types.Chars_Ptr

Same as Get_Slice above, but returns the raw C string. The caller is responsible for freeing the string returned, using Gtkada.Types.g_free.

Parameters
Start
The_End
Return Value

Get_Tags

function Get_Tags
   (Iter : Gtk_Text_Iter) return Gtk.Text_Tag.Text_Tag_List.GSlist

Returns a list of tags that apply to Iter, in ascending order of priority (highest-priority tags are last). The Gtk.Text_Tag.Gtk_Text_Tag in the list don't have a reference added, but you have to free the list itself.

Parameters
Iter
Return Value

Get_Text

function Get_Text
   (Iter    : Gtk_Text_Iter;
    The_End : Gtk_Text_Iter) return UTF8_String

Returns 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 Gtk.Text_Iter.Get_Slice.

Parameters
Iter
The_End

iterator at end of a range

Return Value

array of characters from the buffer

Get_Text_Iter

procedure Get_Text_Iter
  (Val  : Glib.Values.GValue;
   Iter : out Gtk_Text_Iter)

Extract the iterator from the given GValue. Note that the iterator returned is a copy of the iterator referenced by the give GValue. Modifying the iterator returned does not modify the iterator referenced by the GValue.

Parameters
Val
Iter

Get_Toggled_Tags

function Get_Toggled_Tags
   (Iter       : Gtk_Text_Iter;
    Toggled_On : Boolean) return Gtk.Text_Tag.Text_Tag_List.GSlist

Returns a list of Gtk.Text_Tag.Gtk_Text_Tag that are toggled on or off at this point. (If Toggled_On is True, the list contains tags that are toggled on.) If a tag is toggled on at Iter, then some non-empty range of characters following Iter has that tag applied to it. If a tag is toggled off, then some non-empty range following Iter does not have the tag applied to it.

Parameters
Iter
Toggled_On

True to get toggled-on tags

Return Value

Get_Type

function Get_Type return Glib.GType
Return Value

Get_Visible_Line_Index

function Get_Visible_Line_Index (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the number of bytes from the start of the line to the given Iter, not counting bytes that are invisible due to tags with the "invisible" flag toggled on.

Parameters
Iter
Return Value

byte index of Iter with respect to the start of the line

Get_Visible_Line_Offset

function Get_Visible_Line_Offset (Iter : Gtk_Text_Iter) return Glib.Gint

Returns the offset in characters from the start of the line to the given Iter, not counting characters that are invisible due to tags with the "invisible" flag toggled on.

Parameters
Iter
Return Value

offset in visible characters from the start of the line

Get_Visible_Slice

function Get_Visible_Slice
   (Iter    : Gtk_Text_Iter;
    The_End : Gtk_Text_Iter) return UTF8_String

Like Gtk.Text_Iter.Get_Slice, but invisible text is not included. Invisible text is usually invisible because a Gtk.Text_Tag.Gtk_Text_Tag with the "invisible" attribute turned on has been applied to it.

Parameters
Iter
The_End

iterator at end of range

Return Value

slice of text from the buffer

Get_Visible_Text

function Get_Visible_Text
   (Iter    : Gtk_Text_Iter;
    The_End : Gtk_Text_Iter) return UTF8_String

Like Gtk.Text_Iter.Get_Text, but invisible text is not included. Invisible text is usually invisible because a Gtk.Text_Tag.Gtk_Text_Tag with the "invisible" attribute turned on has been applied to it.

Parameters
Iter
The_End

iterator at end of range

Return Value

string containing visible text in the range

Gtk_Text_Iter

type Gtk_Text_Iter is private;

You may wish to begin by reading the [text widget conceptual overview][TextWidget] which gives an overview of all the objects and data types related to the text widget and how they work together.

Gtk_Text_Search_Flags

type Gtk_Text_Search_Flags is mod 2 ** Integer'Size;

Flags affecting how a search is done.

If neither GTK_TEXT_SEARCH_VISIBLE_ONLY nor GTK_TEXT_SEARCH_TEXT_ONLY are enabled, the match must be exact; the special 0xFFFC character will match embedded pixbufs or child widgets.

Gtk_Text_Search_Flags_Properties

package Gtk_Text_Search_Flags_Properties is
   new Generic_Internal_Discrete_Property (Gtk_Text_Search_Flags);

Has_Tag

function Has_Tag
   (Iter : Gtk_Text_Iter;
    Tag  : not null access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class)
    return Boolean

Returns True if Iter points to a character that is part of a range tagged with Tag. See also Gtk.Text_Iter.Starts_Tag and Gtk.Text_Iter.Ends_Tag.

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag

Return Value

whether Iter is tagged with Tag

In_Range

function In_Range
   (Iter    : Gtk_Text_Iter;
    Start   : Gtk_Text_Iter;
    The_End : Gtk_Text_Iter) return Boolean

Checks whether Iter falls in the range [Start, End). Start and End must be in ascending order.

Parameters
Iter
Start

start of range

The_End

end of range

Return Value

True if Iter is in the range

Inside_Sentence

function Inside_Sentence (Iter : Gtk_Text_Iter) return Boolean

Determines whether 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).

Parameters
Iter
Return Value

True if Iter is inside a sentence.

Inside_Word

function Inside_Word (Iter : Gtk_Text_Iter) return Boolean

Determines whether the character pointed by Iter is part of 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). Note that if Gtk.Text_Iter.Starts_Word returns True, then this function returns True too, since Iter points to the first character of the word.

Parameters
Iter
Return Value

True if Iter is inside a word

Is_Cursor_Position

function Is_Cursor_Position (Iter : Gtk_Text_Iter) return Boolean

See Gtk.Text_Iter.Forward_Cursor_Position or Pango_Log_Attr or pango_break for details on what a cursor position is.

Parameters
Iter
Return Value

True if the cursor can be placed at Iter

Is_End

function Is_End (Iter : Gtk_Text_Iter) return Boolean

Returns True if Iter is the end iterator, i.e. one past the last dereferenceable iterator in the buffer. Gtk.Text_Iter.Is_End is the most efficient way to check whether an iterator is the end iterator.

Parameters
Iter
Return Value

whether Iter is the end iterator

Is_Start

function Is_Start (Iter : Gtk_Text_Iter) return Boolean

Returns True if Iter is the first iterator in the buffer, that is if Iter has a character offset of 0.

Parameters
Iter
Return Value

whether Iter is the first in the buffer

Iter_Or_Null

function Iter_Or_Null (Iter : System.Address) return System.Address

Internal function for GtkAda

Parameters
Iter
Return Value

Null_Text_Iter

Null_Text_Iter : constant Gtk_Text_Iter;

Order

procedure Order (Iter : Gtk_Text_Iter; Second : Gtk_Text_Iter)

Swaps the value of First and Second if Second comes before First in the buffer. That is, ensures that First and 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 Gtk.Text_Iter.In_Range, that expect a pre-sorted range.

Parameters
Iter
Second

another Gtk.Text_Iter.Gtk_Text_Iter

Property_Gtk_Text_Search_Flags

type Property_Gtk_Text_Search_Flags is new Gtk_Text_Search_Flags_Properties.Property;

Set_Line

procedure Set_Line (Iter : in out Gtk_Text_Iter; Line_Number : Glib.Gint)

Moves iterator Iter to the start of the line Line_Number. If Line_Number is negative or larger than the number of lines in the buffer, moves Iter to the start of the last line in the buffer.

Parameters
Iter
Line_Number

line number (counted from 0)

Set_Line_Index

procedure Set_Line_Index
   (Iter         : in out Gtk_Text_Iter;
    Byte_On_Line : Glib.Gint)

Same as Gtk.Text_Iter.Set_Line_Offset, but works with a 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.

Parameters
Iter
Byte_On_Line

a byte index relative to the start of Iter's current line

Set_Line_Offset

procedure Set_Line_Offset
   (Iter         : in out Gtk_Text_Iter;
    Char_On_Line : Glib.Gint)

Moves Iter within a line, to a new character (not byte) offset. The given character offset must be less than or equal to the number of characters in the line; if equal, Iter moves to the start of the next line. See Gtk.Text_Iter.Set_Line_Index if you have a byte index rather than a character offset.

Parameters
Iter
Char_On_Line

a character offset relative to the start of Iter's current line

Set_Offset

procedure Set_Offset
   (Iter        : in out Gtk_Text_Iter;
    Char_Offset : Glib.Gint)

Sets Iter to point to Char_Offset. Char_Offset counts from the start of the entire text buffer, starting with 0.

Parameters
Iter
Char_Offset

a character number

Set_Text_Iter

procedure Set_Text_Iter
  (Val  : in out Glib.Values.GValue;
   Iter : Gtk_Text_Iter)

Set the value of the given GValue to Iter. Note that Iter is stored by reference, which means no copy of Iter is made. Iter should remain allocated as long as Val is being used.

Parameters
Val
Iter

Set_Visible_Line_Index

procedure Set_Visible_Line_Index
   (Iter         : in out Gtk_Text_Iter;
    Byte_On_Line : Glib.Gint)

Like Gtk.Text_Iter.Set_Line_Index, but the index is in visible bytes, i.e. text with a tag making it invisible is not counted in the index.

Parameters
Iter
Byte_On_Line

a byte index

Set_Visible_Line_Offset

procedure Set_Visible_Line_Offset
   (Iter         : in out Gtk_Text_Iter;
    Char_On_Line : Glib.Gint)

Like Gtk.Text_Iter.Set_Line_Offset, but the offset is in visible characters, i.e. text with a tag making it invisible is not counted in the offset.

Parameters
Iter
Char_On_Line

a character offset

Starts_Line

function Starts_Line (Iter : Gtk_Text_Iter) return Boolean

Returns True if Iter begins a paragraph, i.e. if Gtk.Text_Iter.Get_Line_Offset would return 0. However this function is potentially more efficient than Gtk.Text_Iter.Get_Line_Offset because it doesn't have to compute the offset, it just has to see whether it's 0.

Parameters
Iter
Return Value

whether Iter begins a line

Starts_Sentence

function Starts_Sentence (Iter : Gtk_Text_Iter) return Boolean

Determines whether 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).

Parameters
Iter
Return Value

True if Iter is at the start of a sentence.

Starts_Tag

function Starts_Tag
   (Iter : Gtk_Text_Iter;
    Tag  : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class) return Boolean

Returns True if Tag is toggled on at exactly this point. If Tag is null, returns True if any tag is toggled on at this point. Note that if Gtk.Text_Iter.Starts_Tag returns True, it means that Iter is at the beginning of the tagged range, and that the character at Iter is inside the tagged range. In other words, unlike Gtk.Text_Iter.Ends_Tag, if Gtk.Text_Iter.Starts_Tag returns True, Gtk.Text_Iter.Has_Tag will also return True for the same parameters. Since: gtk+ 3.20

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag, or null

Return Value

whether Iter is the start of a range tagged with Tag

Starts_Word

function Starts_Word (Iter : Gtk_Text_Iter) return Boolean

Determines whether 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).

Parameters
Iter
Return Value

True if Iter is at the start of a word

Text_Only

Text_Only : constant Gtk_Text_Search_Flags := 2;

Toggles_Tag

function Toggles_Tag
   (Iter : Gtk_Text_Iter;
    Tag  : access Gtk.Text_Tag.Gtk_Text_Tag_Record'Class) return Boolean

This is equivalent to (gtk_text_iter_starts_tag || Gtk.Text_Iter.Ends_Tag), i.e. it tells you whether a range with Tag applied to it begins or ends at Iter.

Parameters
Iter
Tag

a Gtk.Text_Tag.Gtk_Text_Tag, or null

Return Value

whether Tag is toggled on or off at Iter

Visible_Only

Visible_Only : constant Gtk_Text_Search_Flags := 1;