IMContext.getSurrounding

bool getSurrounding(out string text, out int cursorIndex)

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 signalGtk.IMContext::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.imcontext.IMContext.setSurrounding].

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

textlocation 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 [glib.global.gfree].
cursorIndexlocation 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.

Deprecated

Use [gtk.imcontext.IMContext.getSurroundingWithSelection] instead.