- If the indentation and alignment must be done with spaces, draw tabs.
And non-breaking spaces can always be drawn, everywhere, to distinguish them from normal spaces.
Module for [SpaceDrawer] class
Represent white space characters with symbols.
#GtkSourceSpaceDrawer provides a way to visualize white spaces, by drawing symbols.
Call [gtksource.view.View.getSpaceDrawer] to get the [gtksource.space_drawer.SpaceDrawer] instance of a certain class@View.
By default, no white spaces are drawn because the property@SpaceDrawer:enable-matrix is false.
To draw white spaces, [gtksource.space_drawer.SpaceDrawer.setTypesForLocations] can be called to set the property@SpaceDrawer:matrix property (by default all space types are enabled at all locations). Then call [gtksource.space_drawer.SpaceDrawer.setEnableMatrix].
For a finer-grained method, there is also the class@Tag's property@Tag:draw-spaces property.
To draw non-breaking spaces everywhere and draw all types of trailing spaces except newlines:
gtk_source_space_drawer_set_types_for_locations (space_drawer,
GTK_SOURCE_SPACE_LOCATION_ALL,
GTK_SOURCE_SPACE_TYPE_NBSP);
gtk_source_space_drawer_set_types_for_locations (space_drawer,
GTK_SOURCE_SPACE_LOCATION_TRAILING,
GTK_SOURCE_SPACE_TYPE_ALL &
~GTK_SOURCE_SPACE_TYPE_NEWLINE);
gtk_source_space_drawer_set_enable_matrix (space_drawer, TRUE);A possible use-case is to draw only unwanted white spaces.
And non-breaking spaces can always be drawn, everywhere, to distinguish them from normal spaces.
SpaceDrawer self()Returns `this`, for use in `with` statements.SpaceDrawerGidBuilder builder()Get builder for [gtksource.space_drawer.SpaceDrawer] Returns: New builder objectbool enableMatrix() @propertyGet `enableMatrix` property. Returns: Whether the `property@SpaceDrawer:matrix` property is enabled.void enableMatrix(bool propval) @propertySet `enableMatrix` property. Params: propval = Whether the `property@SpaceDrawer:matrix` property is enabled.glib.variant.Variant matrix() @propertyGet `matrix` property. Returns: The property is a [glib.variant.Variant] property to specify where and what kind of white spaces to draw.void matrix(glib.variant.Variant propval) @propertySet `matrix` property. Params: propval = The property is a [glib.variant.Variant] property to specify where and what kind of white spaces to draw.void bindMatrixSetting(gio.settings.Settings settings, string key, gio.types.SettingsBindFlags flags)Binds the `propertySpaceDrawer:matrix` property to a [gio.settings.Settings] key.bool getEnableMatrix()glib.variant.Variant getMatrix()Gets the value of the `propertySpaceDrawer:matrix` property, as a [glib.variant.Variant].gtksource.types.SpaceTypeFlags getTypesForLocations(gtksource.types.SpaceLocationFlags locations)If only one location is specified, this function returns what kind of white spaces are drawn at that location.void setEnableMatrix(bool enableMatrix)Sets whether the `propertySpaceDrawer:matrix` property is enabled.void setMatrix(glib.variant.Variant matrix = null)Sets a new value to the `propertySpaceDrawer:matrix` property, as a [glib.variant.Variant].void setTypesForLocations(gtksource.types.SpaceLocationFlags locations, gtksource.types.SpaceTypeFlags types)Modifies the `propertySpaceDrawer:matrix` property at the specified locations.T enableMatrix(bool propval)Set `enableMatrix` property. Params: propval = Whether the `property@SpaceDrawer:matrix` property is enabled. Returns: Builder instance for fluent chainingT matrix(glib.variant.Variant propval)Set `matrix` property. Params: propval = The property is a [glib.variant.Variant] property to specify where and what kind of white spaces to draw.Fluent builder for [gtksource.space_drawer.SpaceDrawer]