Text buffer iterator
Class GtkTextIter( [table] )
table | (GtkTextTable) a tag table, or nil to create a new one. |
You may wish to begin by reading the text widget conceptual overview which gives an overview of all the objects and data types related to the text widget and how they work together.
Methods | |
copy | Creates a copy of an iterator. |
get_char | Returns the Unicode character at this iterator. |
get_line | Returns the line number containing the iterator. |
get_line_index | Returns the byte index of the iterator, counting from the start of a newline-terminated line. |
get_line_offset | Returns the character offset of the iterator, counting from the start of a newline-terminated line. |
get_offset | Returns the character offset of an iterator. |
get_pixbuf | If the element at iter is a pixbuf, the pixbuf is returned. Otherwise, nil is returned. |
get_slice | Returns the text in the given range. |
get_text | Returns text in the given range. |
get_visible_line_index | 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. |
get_visible_line_offset | 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. |
get_visible_slice | Like get_slice(), but invisible text is not included. |
get_visible_text | Like gtk_text_iter_get_text(), but invisible text is not included. |
Creates a copy of an iterator.
GtkTextIter.copy()
Return | a copy of GtkTextIter |
Returns the Unicode character at this iterator.
GtkTextIter.get_char()
Return | a Unicode character, or nil if iter is not dereferenceable (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. |
Returns the line number containing the iterator.
GtkTextIter.get_line()
Return | a line number |
Lines in a GtkTextBuffer are numbered beginning with 0 for the first line in the buffer.
Returns the byte index of the iterator, counting from the start of a newline-terminated line.
GtkTextIter.get_line_index()
Return | distance from start of line, in bytes |
Remember that GtkTextBuffer encodes text in UTF-8, and that characters can require a variable number of bytes to represent.
Returns the character offset of the iterator, counting from the start of a newline-terminated line.
GtkTextIter.get_line_offset()
Return | offset from start of line |
The first character on the line has offset 0.
Returns the character offset of an iterator.
GtkTextIter.get_offset()
Return | a character offset |
Each character in a GtkTextBuffer 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.
If the element at iter is a pixbuf, the pixbuf is returned. Otherwise, nil is returned.
GtkTextIter.get_pixbuf()
Return | the pixbuf |
Returns the text in the given range.
GtkTextIter.get_slice( end )
end | iterator at end of a range |
Return | slice of text from the buffer |
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.
Returns text in the given range.
GtkTextIter.get_text( end )
end | iterator at end of a range |
Return | array of characters from the buffer |
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().
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.
GtkTextIter.get_visible_line_index()
Return | byte index of iter with respect to the start of the line |
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.
GtkTextIter.get_visible_line_offset()
Return | offset in visible characters from the start of the line |
Like get_slice(), but invisible text is not included.
GtkTextIter.get_visible_slice( end )
end | iterator at end of a range |
Return | slice of text from the buffer |
Invisible text is usually invisible because a GtkTextTag with the "invisible" attribute turned on has been applied to it.
Like gtk_text_iter_get_text(), but invisible text is not included.
GtkTextIter.get_visible_text( end )
end | iterator at end of a range |
Return | string containing visible text in the range |
Invisible text is usually invisible because a GtkTextTag with the "invisible" attribute turned on has been applied to it.