get_surrounding


Description:

[ Version ( deprecated = true , deprecated_since = "4.2" ) ]
public virtual bool get_surrounding (out string text, out int cursor_index)

Warning: get_surrounding is deprecated since 4.2.

Retrieves context around the insertion point.

Note:

Use [method@Gtk.IMContext.get_surrounding_with_selection] instead.

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 [signal@Gtk.IMContext: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 [ method@Gtk.IMContext.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.

Parameters:

this

a `GtkIMContext`

text

location to store a UTF-8 encoded string of text holding context around the insertion point. If the function returns true, then you must free the result stored in this location with g_free.

cursor_index

location to store byte index of the insertion cursor within text.

Returns:

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