set_indent_width


Description:

public void set_indent_width (int width)

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 tab_width property will be used.

The indent_width interacts with the insert_spaces_instead_of_tabs property and tab_width. An example will be clearer: if the indent_width is 4 and tab_width is 8 and 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 tab_width is 8). On the other hand, if 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 TextBuffer.

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

Parameters:

this

a SourceView.

width

indent width in characters.