What you need is to parse the user input by the key-press-event
signal (or similar signals).
- Get the GtkTextBuffer by calling gtk_text_view_get_buffer.
- Get the GtkTextMark by calling gtk_text_buffer_get_insert.
- Get the GtkTextIter by calling gtk_text_buffer_get_iter_at_mark.
- Check if the GtkTextIter is at the end of the word by gtk_text_iter_ends_word.
- If it was
- then Use gtk_text_iter_backward_word_start to get the GtkTextIter for the start of the word.
- Call gtk_text_buffer_get_text to get the uncompleted word.
- Search for related identifiers and display them in a GtkTreeView on a GtkWindow of GTK_WINDOW_POPUP type.
If you want to show the auto-complete list after .
or ::
or ->
, then you should get the previous word by an approach like the above.