SourceView.setIndentWidth

Sets the number of spaces to use for each step of indent when the tab key is pressed. If @width is -1, the value of the #GtkSourceView:tab-width property will be used.

The #GtkSourceView:indent-width interacts with the #GtkSourceView:insert-spaces-instead-of-tabs property and #GtkSourceView:tab-width. An example will be clearer: if the #GtkSourceView:indent-width is 4 and #GtkSourceView:tab-width is 8 and #GtkSourceView:insert-spaces-instead-of-tabs is %FALSE, then pressing the tab key at the beginning of a line will insert 4 spaces. So far so good. Pressing the tab key a second time will remove the 4 spaces and insert a \t character instead (since #GtkSourceView:tab-width is 8). On the other hand, if #GtkSourceView:insert-spaces-instead-of-tabs is %TRUE, the second tab key pressed will insert 4 more spaces for a total of 8 spaces in the #GtkTextBuffer.

The test-widget program (available in the GtkSourceView repository) may be useful to better understand the indentation settings (enable the space drawing!).

class SourceView
void
setIndentWidth
(
int width
)

Parameters

width int

indent width in characters.

Meta