Gtk.IMContext.prototype.get_surrounding

function get_surrounding():Boolean {
    // Gjs wrapper for gtk_im_context_get_surrounding()
}

Retrieves context around the insertion point. Input methods typically want context in order to constrain input text based on existing text; this is important for languages such as Thai where only some sequences of characters are allowed.

This function is implemented by emitting the GtkIMContext::retrieve_surrounding signal on the input method; in response to this signal, a widget should provide as much context as is available, up to an entire paragraph, by calling Gtk.set_surrounding. Note that there is no obligation for a widget to respond to the ::retrieve_surrounding signal, so input methods must be prepared to function without context.

Returns

true if surrounding text was provided; in this case you must free the result stored in *text.