Method

IdeIndenterformat

Declaration

gchar*
ide_indenter_format (
  IdeIndenter* self,
  GtkTextView* text_view,
  GtkTextIter* begin,
  GtkTextIter* end,
  gint* cursor_offset,
  GdkEventKey* event
)

Description

This function performs an indentation for the key press activated by event. The implementation is free to move the begin and end iters to swallow adjacent content. The result, a string, is the contents that will replace the content inbetween begin and end.

cursor_offset may be set to jump the cursor starting from end. Negative values are allowed.

If self is NULL, the fallback indenter is used, which tries to mimic the indentation style of GtkSourceView.

Available since:3.32

Parameters

text_view GtkTextView*
 

A GtkTextView.

 The data is owned by the caller of the function.
begin GtkTextIter*
 

A GtkTextIter for the beginning region of text to replace.

 The data is owned by the caller of the function.
end GtkTextIter*
 

A GtkTextIter for the end region of text to replace.

 The data is owned by the caller of the function.
cursor_offset gint*
 

The offset in characters from end to place the cursor. Negative values are okay.

 The argument will be set by the function.
 The instance takes ownership of the data, and is responsible for freeing it.
event GdkEventKey*
 

The GdkEventKey that triggered the event.

 The data is owned by the caller of the function.

Return value

Returns: gchar*
 

A string containing the replacement text, or NULL.

 The caller of the method takes ownership of the data, and is responsible for freeing it.
 The return value can be NULL.
 The string is a NUL terminated UTF-8 string.