SpaceDrawer

open class SpaceDrawer(pointer: <Error class: unknown class><<Error class: unknown class>>)

Represent white space characters with symbols.

#GtkSourceSpaceDrawer provides a way to visualize white spaces, by drawing symbols.

Call method@View.get_space_drawer to get the GtkSourceSpaceDrawer 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, method@SpaceDrawer.set_types_for_locations can be called to set the property@SpaceDrawer:matrix property (by default all space types are enabled at all locations). Then call method@SpaceDrawer.set_enable_matrix.

For a finer-grained method, there is also the class@Tag's property@Tag:draw-spaces property.

Example

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);

Use-case: draw unwanted white spaces

A possible use-case is to draw only unwanted white spaces. Examples:

  • Draw all trailing spaces.

  • 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.

Skipped during bindings generation

  • method matrix: Property TypeInfo of getter and setter do not match

Constructors

Link copied to clipboard
constructor()

Creates a new #GtkSourceSpaceDrawer object.

constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Whether the property@SpaceDrawer:matrix property is enabled.

Link copied to clipboard
val gtksourceSpaceDrawerPointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
open fun bindMatrixSetting(settings: <Error class: unknown class>, key: String, flags: <Error class: unknown class>)

Binds the property@SpaceDrawer:matrix property to a class@Gio.Settings key.

Link copied to clipboard
Link copied to clipboard
open fun getMatrix(): <Error class: unknown class>

Gets the value of the property@SpaceDrawer:matrix property, as a struct@GLib.Variant.

Link copied to clipboard

If only one location is specified, this function returns what kind of white spaces are drawn at that location.

Link copied to clipboard
open fun setEnableMatrix(enableMatrix: Boolean)

Sets whether the property@SpaceDrawer:matrix property is enabled.

Link copied to clipboard
open fun setMatrix(matrix: <Error class: unknown class>? = null)

Sets a new value to the property@SpaceDrawer:matrix property, as a struct@GLib.Variant.

Link copied to clipboard

Modifies the property@SpaceDrawer:matrix property at the specified