TextView.getIterAtPosition

bool getIterAtPosition(out gtk.text_iter.TextIter iter, out int trailing, int x, int y)

Retrieves the iterator pointing to the character at buffer coordinates x and y.

Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with gtk.text_view.TextView.windowToBufferCoords.

Note that this is different from gtk.text_view.TextView.getIterAtLocation, which returns cursor locations, i.e. positions between characters.

Parameters

itera gtk.text_iter.TextIter
trailingif non-null, location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.
xx position, in buffer coordinates
yy position, in buffer coordinates

Returns

true if the position is over text