The gutter renderer is a gtk.widget.Widget and is measured using the normal widget
measurement facilities. The width of the gutter will be determined by the
measurements of the gutter renderers.
The width of a gutter renderer generally takes into account the entire text
buffer. For instance, to display the line numbers, if the buffer contains 100
lines, the gutter renderer will always set its width such as three digits can
be printed, even if only the first 20 lines are shown. Another strategy is to
take into account only the visible lines. In this case, only two digits are
necessary to display the line numbers of the first 20 lines. To take another
example, the gutter renderer for class@Marks doesn't need to take
into account the text buffer to announce its width. It only depends on the
icons size displayed in the gutter column.
When the available size to render a cell is greater than the required size to
render the cell contents, the cell contents can be aligned horizontally and
vertically with gtksource.gutter_renderer.GutterRenderer.setAlignmentMode.
The cells rendering occurs using vfunc@Gtk.Widget.snapshot. Implementations
should use gtk_source_gutter_renderer_get_lines() to retrieve information
about the lines to be rendered. To help with aligning content which takes
into account the padding and alignment of a cell, implementations may call
gtksource.gutter_renderer.GutterRenderer.alignCell for a given line number with the
width and height measurement of the content they width to render.
Gutter cell renderer.
A gtksource.gutter_renderer.GutterRenderer represents a column in a class@Gutter. The column contains one cell for each visible line of the gtk.text_buffer.TextBuffer. Due to text wrapping, a cell can thus span multiple lines of the gtk.text_view.TextView. In this case, enum@GutterRendererAlignmentMode controls the alignment of the cell.
The gutter renderer is a gtk.widget.Widget and is measured using the normal widget measurement facilities. The width of the gutter will be determined by the measurements of the gutter renderers.
The width of a gutter renderer generally takes into account the entire text buffer. For instance, to display the line numbers, if the buffer contains 100 lines, the gutter renderer will always set its width such as three digits can be printed, even if only the first 20 lines are shown. Another strategy is to take into account only the visible lines. In this case, only two digits are necessary to display the line numbers of the first 20 lines. To take another example, the gutter renderer for class@Marks doesn't need to take into account the text buffer to announce its width. It only depends on the icons size displayed in the gutter column.
When the available size to render a cell is greater than the required size to render the cell contents, the cell contents can be aligned horizontally and vertically with gtksource.gutter_renderer.GutterRenderer.setAlignmentMode.
The cells rendering occurs using vfunc@Gtk.Widget.snapshot. Implementations should use gtk_source_gutter_renderer_get_lines() to retrieve information about the lines to be rendered. To help with aligning content which takes into account the padding and alignment of a cell, implementations may call gtksource.gutter_renderer.GutterRenderer.alignCell for a given line number with the width and height measurement of the content they width to render.