Package: gtk

Function gtk:text-iter-line-index

Lambda List

gtk:text-iter-line-index (iter &key visible)

Syntax

(gtk:text-iter-line-index iter) => index
(gtk:text-iter-line-index iter :visible t) => index
(setf (gtk:text-iter-line-offset iter) index)
(setf (gtk:text-iter-line-offset iter :visible t) index)

Arguments

iter -- a gtk:text-iter instance
index -- an integer with a byte index relative to the start of the current line of the iterator
visible -- a boolean keyword argument, the default is false

Details

The gtk:text-iter-line-index function returns the byte index of the iterator, counting from the start of a newline-terminated line. The (setf gtk:text-iter-line-index) function moves the iterator within a line, to the new byte index. If the visible keyword argument is true, the function does not count bytes that are invisible due to tags with the invisible attribute toggled on.

Remember that the text buffer encodes text in UTF-8, and that characters can require a variable number of bytes to represent. The given byte index must be at the start of a character, it cannot be in the middle of a UTF-8 encoded character.

Notes

This function combines the *_line_index() and *_visible_line_index() functions into one, using the visible keyword argument.
 

See also

2024-7-26