`GtkSourceView` is the main class of the GtkSourceView library. Use a [class@Buffer] to display text with a `GtkSourceView`.
This class provides:
Show the line numbers;
Show a right margin;
Highlight the current line;
Indentation settings;
Configuration for the Home and End keyboard keys;
Configure and show line marks;
And a few other things.
An easy way to test all these features is to use the test-widget mini-program provided in the GtkSourceView repository, in the tests/
directory.
GtkSourceView as GtkBuildable
The GtkSourceView implementation of the [[email protected]] interface exposes the [property@View:completion] object with the
internal-child "completion".
An example of a UI definition fragment with GtkSourceView: ```xml <object class="GtkSourceView" id="source_view"> <property
name="tab-width">4</property> <property name="auto-indent">True</property> <child internal-child="completion"
> <object class="GtkSourceCompletion"> <property name="select-on-show">False</property> </object> <
/child> </object> ```
Changing the Font
Gtk CSS provides the best way to change the font for a `GtkSourceView` in a manner that allows for components like [class@Map] to scale
the desired font.
If you need to adjust the font or size of font within a portion of the document only, you should use a [[email protected]] with the [
[email protected]:family] or [[email protected]:scale] set so that the font size may be scaled relative to the default font set in
CSS.
The property denotes if snippets should be expanded when the user
presses Tab after having typed a word matching the snippets found in [class@SnippetManager].
If true, when the tab key is pressed
when several lines are selected, the selected lines are indented of one level instead of being replaced with a `\t` character.
The signal is a key binding signal which gets emitted when the user
requests a completion, by pressing <keycombo><keycap>Control</keycap><keycap>space</keycap></keycombo
>.
Inherited Members:
All known members inherited from class Gtk.TextView
accepts_tab
add_child_at_anchor
add_overlay
backspace
backward_display_line
backward_display_line_start
bottom_margin
buffer
buffer_to_window_coords
copy_clipboard
create_buffer
cursor_visible
cut_clipboard
delete_from_cursor
editable
extend_selection
extra_menu
forward_display_line
forward_display_line_end
get_accepts_tab
get_bottom_margin
get_buffer
get_cursor_locations
get_cursor_visible
get_editable
get_extra_menu
get_gutter
get_indent
get_input_hints
get_input_purpose
get_iter_at_location
get_iter_at_position
get_iter_location
get_justification
get_left_margin
get_line_at_y
get_line_yrange
get_ltr_context
get_monospace
get_overwrite
get_pixels_above_lines
get_pixels_below_lines
get_pixels_inside_wrap
get_right_margin
get_rtl_context
get_tabs
get_top_margin
get_visible_rect
get_wrap_mode
im_context_filter_keypress
im_module
indent
input_hints
input_purpose
insert_at_cursor
insert_emoji
justification
left_margin
monospace
move_cursor
move_mark_onscreen
move_overlay
move_viewport
move_visually
overwrite
paste_clipboard
pixels_above_lines
pixels_below_lines
pixels_inside_wrap
place_cursor_onscreen
preedit_changed
remove
reset_cursor_blink
reset_im_context
right_margin
scroll_mark_onscreen
scroll_to_iter
scroll_to_mark
select_all
set_accepts_tab
set_anchor
set_bottom_margin
set_buffer
set_cursor_visible
set_editable
set_extra_menu
set_gutter
set_indent
set_input_hints
set_input_purpose
set_justification
set_left_margin
set_monospace
set_overwrite
set_pixels_above_lines
set_pixels_below_lines
set_pixels_inside_wrap
set_right_margin
set_tabs
set_top_margin
set_wrap_mode
snapshot_layer
starts_display_line
tabs
toggle_cursor_visible
toggle_overwrite
top_margin
window_to_buffer_coords
wrap_mode
All known members inherited from class Gtk.Widget
action_set_enabled
activate
activate_action
activate_action_variant
activate_default
add_binding
add_binding_action
add_binding_signal
add_controller
add_css_class
add_mnemonic_label
add_shortcut
add_tick_callback
allocate
allocate_size
bind_template_callback_full
bind_template_child_full
can_focus
can_target
child_focus
compute_bounds
compute_expand
compute_expand_internal
compute_point
compute_transform
contains
create_pango_context
create_pango_layout
css_changed
css_classes
css_name
cursor
destroy
direction_changed
dispose_template
error_bell
focus
focus_on_click
focusable
get_accessible_role
get_activate_signal
get_allocated_baseline
get_allocated_height
get_allocated_width
get_allocation
get_ancestor
get_can_focus
get_can_target
get_child_visible
get_clipboard
get_css_classes
get_css_name
get_cursor
get_default_direction
get_direction
get_display
get_first_child
get_focus_child
get_focus_on_click
get_focusable
get_font_map
get_font_options
get_frame_clock
get_halign
get_has_tooltip
get_height
get_hexpand
get_hexpand_set
get_last_child
get_layout_manager
get_layout_manager_type
get_mapped
get_margin_bottom
get_margin_end
get_margin_start
get_margin_top
get_name
get_native
get_next_sibling
get_opacity
get_overflow
get_pango_context
get_parent
get_preferred_size
get_prev_sibling
get_primary_clipboard
get_realized
get_receives_default
get_request_mode
get_root
get_scale_factor
get_sensitive
get_settings
get_size
get_size_request
get_state_flags
get_style_context
get_template_child
get_tooltip_markup
get_tooltip_text
get_valign
get_vexpand
get_vexpand_set
get_visible
get_width
grab_focus
halign
has_css_class
has_default
has_focus
has_tooltip
has_visible_focus
height_request
hexpand
hexpand_set
hide
in_destruction
init_template
insert_action_group
insert_after
insert_before
install_action
install_property_action
is_ancestor
is_drawable
is_focus
is_sensitive
is_visible
keynav_failed
layout_manager
list_mnemonic_labels
map
margin_bottom
margin_end
margin_start
margin_top
measure
mnemonic_activate
move_focus
name
observe_children
observe_controllers
opacity
overflow
parent
pick
query_action
query_tooltip
queue_allocate
queue_draw
queue_resize
realize
receives_default
remove_controller
remove_css_class
remove_mnemonic_label
remove_tick_callback
root
scale_factor
sensitive
set_accessible_role
set_activate_signal
set_activate_signal_from_name
set_can_focus
set_can_target
set_child_visible
set_css_classes
set_css_name
set_cursor
set_cursor_from_name
set_default_direction
set_direction
set_focus_child
set_focus_on_click
set_focusable
set_font_map
set_font_options
set_halign
set_has_tooltip
set_hexpand
set_hexpand_set
set_layout_manager
set_layout_manager_type
set_margin_bottom
set_margin_end
set_margin_start
set_margin_top
set_name
set_opacity
set_overflow
set_parent
set_receives_default
set_sensitive
set_size_request
set_state_flags
set_template
set_template_from_resource
set_template_scope
set_tooltip_markup
set_tooltip_text
set_valign
set_vexpand
set_vexpand_set
set_visible
should_layout
show
size_allocate
snapshot
snapshot_child
state_flags_changed
system_setting_changed
tooltip_markup
tooltip_text
translate_coordinates
trigger_tooltip_query
unmap
unparent
unrealize
unroot
unset_state_flags
valign
vexpand
vexpand_set
visible
width_request
All known members inherited from class GLib.Object
@get
@new
@ref
@set
add_toggle_ref
add_weak_pointer
bind_property
connect
constructed
disconnect
dispose
dup_data
dup_qdata
force_floating
freeze_notify
get_class
get_data
get_property
get_qdata
get_type
getv
interface_find_property
interface_install_property
interface_list_properties
is_floating
new_valist
new_with_properties
newv
notify
notify_property
ref_count
ref_sink
remove_toggle_ref
remove_weak_pointer
replace_data
replace_qdata
set_data
set_data_full
set_property
set_qdata
set_qdata_full
set_valist
setv
steal_data
steal_qdata
thaw_notify
unref
watch_closure
weak_ref
weak_unref
All known members inherited from interface Gtk.Accessible
accessible_role
get_accessible_role
reset_property
reset_relation
reset_state
update_property
update_property_value
update_relation
update_relation_value
update_state
update_state_value
All known members inherited from interface Gtk.Buildable
add_child
custom_finished
custom_tag_end
custom_tag_start
get_buildable_id
get_id
get_internal_child
parser_finished
set_buildable_property
set_id
All known members inherited from interface Gtk.Scrollable