GtkSourceView: GtkSourceView 3 Reference Manual

## GtkSourceView GtkSourceView — Widget that displays a GtkSourceBuffer |

## Functions

GtkWidget * | gtk_source_view_new ()
GtkWidget * | gtk_source_view_new_with_buffer ()
void | gtk_source_view_set_show_line_numbers ()
gboolean | gtk_source_view_get_show_line_numbers ()
void | gtk_source_view_set_show_right_margin ()
gboolean | gtk_source_view_get_show_right_margin ()
void | gtk_source_view_set_right_margin_position ()
guint | gtk_source_view_get_right_margin_position ()
void | gtk_source_view_set_highlight_current_line ()
gboolean | gtk_source_view_get_highlight_current_line ()
void | gtk_source_view_set_auto_indent ()
gboolean | gtk_source_view_get_auto_indent ()
void | gtk_source_view_set_indent_on_tab ()
gboolean | gtk_source_view_get_indent_on_tab ()
void | gtk_source_view_set_tab_width ()
guint | gtk_source_view_get_tab_width ()
void | gtk_source_view_set_indent_width ()
gint | gtk_source_view_get_indent_width ()
void | gtk_source_view_set_insert_spaces_instead_of_tabs ()
gboolean | gtk_source_view_get_insert_spaces_instead_of_tabs ()
void | gtk_source_view_indent_lines ()
void | gtk_source_view_unindent_lines ()
guint | gtk_source_view_get_visual_column ()
void | gtk_source_view_set_smart_backspace ()
gboolean | gtk_source_view_get_smart_backspace ()
void | gtk_source_view_set_smart_home_end ()
GtkSourceSmartHomeEndType | gtk_source_view_get_smart_home_end ()
void | gtk_source_view_set_mark_attributes ()
GtkSourceMarkAttributes * | gtk_source_view_get_mark_attributes ()
void | gtk_source_view_set_show_line_marks ()
gboolean | gtk_source_view_get_show_line_marks ()
void | gtk_source_view_set_draw_spaces ()
GtkSourceDrawSpacesFlags | gtk_source_view_get_draw_spaces ()
GtkSourceCompletion * | gtk_source_view_get_completion ()
GtkSourceGutter * | gtk_source_view_get_gutter ()
void | gtk_source_view_set_background_pattern ()
GtkSourceBackgroundPatternType | gtk_source_view_get_background_pattern ()

## Properties

gboolean | auto-indent | Read / Write
GtkSourceBackgroundPatternType | background-pattern | Read / Write
GtkSourceCompletion * | completion | Read
GtkSourceDrawSpacesFlags | draw-spaces | Read / Write
gboolean | highlight-current-line | Read / Write
gboolean | indent-on-tab | Read / Write
gint | indent-width | Read / Write
gboolean | insert-spaces-instead-of-tabs | Read / Write
guint | right-margin-position | Read / Write
gboolean | show-line-marks | Read / Write
gboolean | show-line-numbers | Read / Write
gboolean | show-right-margin | Read / Write
gboolean | smart-backspace | Read / Write
GtkSourceSmartHomeEndType | smart-home-end | Read / Write
guint | tab-width | Read / Write

## Signals

void | change-case | Action
void | change-number | Action
void | join-lines | Action
void | line-mark-activated | Run Last
void | move-lines | Action
void | move-to-matching-bracket | Action
void | move-words | Action
void | redo | Action
void | show-completion | Action
void | smart-home-end | Run Last
void | undo | Action

## Types and Values

| GtkSourceView
enum | GtkSourceSmartHomeEndType
enum | GtkSourceDrawSpacesFlags
enum | GtkSourceViewGutterPosition
enum | GtkSourceBackgroundPatternType

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkTextView
                        ╰── GtkSourceView
                            ╰── GtkSourceMap

## Implemented Interfaces

GtkSourceView implements AtkImplementorIface, GtkBuildable and GtkScrollable.

## Includes

    #include <gtksourceview/gtksource.h>

## Description

GtkSourceView is the main class of the GtkSourceView library. Use a GtkSourceBuffer 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;

- A way to visualize white spaces (by drawing symbols);

- 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 GtkBuildable interface exposes the “completion” object with the internal-child "completion".

An example of a UI definition fragment with GtkSourceView:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    <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>

## Functions

### gtk_source_view_new ()

    GtkWidget *
    gtk_source_view_new (void);

Creates a new GtkSourceView. An empty default GtkSourceBuffer will be created for you and can be retrieved with `gtk_text_view_get_buffer()`. If you want to specify your own buffer, consider `gtk_source_view_new_with_buffer()`.

#### Returns

a new GtkSourceView.

### gtk_source_view_new_with_buffer ()

    GtkWidget *
    gtk_source_view_new_with_buffer (GtkSourceBuffer *buffer);

Creates a new GtkSourceView widget displaying the buffer `buffer` . One buffer can be shared among many widgets.

#### Parameters

buffer | a GtkSourceBuffer. |

#### Returns

a new GtkSourceView.

### gtk_source_view_set_show_line_numbers ()

    void
    gtk_source_view_set_show_line_numbers (GtkSourceView *view,
                                           gboolean show);

If `TRUE` line numbers will be displayed beside the text.

#### Parameters

view | a GtkSourceView. |
show | whether line numbers should be displayed. |

### gtk_source_view_get_show_line_numbers ()

    gboolean
    gtk_source_view_get_show_line_numbers (GtkSourceView *view);

Returns whether line numbers are displayed beside the text.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if the line numbers are displayed.

### gtk_source_view_set_show_right_margin ()

    void
    gtk_source_view_set_show_right_margin (GtkSourceView *view,
                                           gboolean show);

If `TRUE` a right margin is displayed.

#### Parameters

view | a GtkSourceView. |
show | whether to show a right margin. |

### gtk_source_view_get_show_right_margin ()

    gboolean
    gtk_source_view_get_show_right_margin (GtkSourceView *view);

Returns whether a right margin is displayed.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if the right margin is shown.

### gtk_source_view_set_right_margin_position ()

    void
    gtk_source_view_set_right_margin_position
                                   (GtkSourceView *view,
                                    guint pos);

Sets the position of the right margin in the given `view` .

#### Parameters

view | a GtkSourceView. |
pos | the width in characters where to position the right margin. |

### gtk_source_view_get_right_margin_position ()

    guint
    gtk_source_view_get_right_margin_position
                                   (GtkSourceView *view);

Gets the position of the right margin in the given `view` .

#### Parameters

view | a GtkSourceView. |

#### Returns

the position of the right margin.

### gtk_source_view_set_highlight_current_line ()

    void
    gtk_source_view_set_highlight_current_line
                                   (GtkSourceView *view,
                                    gboolean highlight);

If `highlight` is `TRUE` the current line will be highlighted.

#### Parameters

view | a GtkSourceView. |
highlight | whether to highlight the current line. |

### gtk_source_view_get_highlight_current_line ()

    gboolean
    gtk_source_view_get_highlight_current_line
                                   (GtkSourceView *view);

Returns whether the current line is highlighted.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if the current line is highlighted.

### gtk_source_view_set_auto_indent ()

    void
    gtk_source_view_set_auto_indent (GtkSourceView *view,
                                     gboolean enable);

If `TRUE` auto-indentation of text is enabled.

When Enter is pressed to create a new line, the auto-indentation inserts the same indentation as the previous line. This is not a "smart indentation" where an indentation level is added or removed depending on the context.

#### Parameters

view | a GtkSourceView. |
enable | whether to enable auto indentation. |

### gtk_source_view_get_auto_indent ()

    gboolean
    gtk_source_view_get_auto_indent (GtkSourceView *view);

Returns whether auto-indentation of text is enabled.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if auto indentation is enabled.

### gtk_source_view_set_indent_on_tab ()

    void
    gtk_source_view_set_indent_on_tab (GtkSourceView *view,
                                       gboolean enable);

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. Shift+Tab unindents the selection.

If the first or last line is not selected completely, it is also indented or unindented.

When the selection doesn't span several lines, the tab key always replaces the selection with a normal \t character.

#### Parameters

view | a GtkSourceView. |
enable | whether to indent a block when tab is pressed. |

### gtk_source_view_get_indent_on_tab ()

    gboolean
    gtk_source_view_get_indent_on_tab (GtkSourceView *view);

Returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if the selection is indented when tab is pressed.

### gtk_source_view_set_tab_width ()

    void
    gtk_source_view_set_tab_width (GtkSourceView *view,
                                   guint width);

Sets the width of tabulation in characters. The GtkTextBuffer still contains \t characters, but they can take a different visual width in a GtkSourceView widget.

#### Parameters

view | a GtkSourceView. |
width | width of tab in characters. |

### gtk_source_view_get_tab_width ()

    guint
    gtk_source_view_get_tab_width (GtkSourceView *view);

Returns the width of tabulation in characters.

#### Parameters

view | a GtkSourceView. |

#### Returns

width of tab.

### gtk_source_view_set_indent_width ()

    void
    gtk_source_view_set_indent_width (GtkSourceView *view,
                                      gint 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 GtkTextBuffer.

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

#### Parameters

view | a GtkSourceView. |
width | indent width in characters. |

### gtk_source_view_get_indent_width ()

    gint
    gtk_source_view_get_indent_width (GtkSourceView *view);

Returns the number of spaces to use for each step of indent. See `gtk_source_view_set_indent_width()` for details.

#### Parameters

view | a GtkSourceView. |

#### Returns

indent width.

### gtk_source_view_set_insert_spaces_instead_of_tabs ()

    void
    gtk_source_view_set_insert_spaces_instead_of_tabs
                                   (GtkSourceView *view,
                                    gboolean enable);

If `TRUE` a tab key pressed is replaced by a group of space characters. Of course it is still possible to insert a real \t programmatically with the GtkTextBuffer API.

#### Parameters

view | a GtkSourceView. |
enable | whether to insert spaces instead of tabs. |

### gtk_source_view_get_insert_spaces_instead_of_tabs ()

    gboolean
    gtk_source_view_get_insert_spaces_instead_of_tabs
                                   (GtkSourceView *view);

Returns whether when inserting a tabulator character it should be replaced by a group of space characters.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if spaces are inserted instead of tabs.

### gtk_source_view_indent_lines ()

    void
    gtk_source_view_indent_lines (GtkSourceView *view,
                                  GtkTextIter *start,
                                  GtkTextIter *end);

Insert one indentation level at the beginning of the specified lines.

#### Parameters

view | a GtkSourceView. |
start | GtkTextIter of the first line to indent |
end | GtkTextIter of the last line to indent |

Since: 3.16

### gtk_source_view_unindent_lines ()

    void
    gtk_source_view_unindent_lines (GtkSourceView *view,
                                    GtkTextIter *start,
                                    GtkTextIter *end);

Removes one indentation level at the beginning of the specified lines.

#### Parameters

view | a GtkSourceView. |
start | GtkTextIter of the first line to indent |
end | GtkTextIter of the last line to indent |

Since: 3.16

### gtk_source_view_get_visual_column ()

    guint
    gtk_source_view_get_visual_column (GtkSourceView *view,
                                       const GtkTextIter *iter);

Determines the visual column at `iter` taking into consideration the “tab-width” of `view` .

#### Parameters

view | a GtkSourceView. |
iter | a position in `view` . |

#### Returns

the visual column at `iter` .

### gtk_source_view_set_smart_backspace ()

    void
    gtk_source_view_set_smart_backspace (GtkSourceView *view,
                                         gboolean smart_backspace);

When set to `TRUE`, pressing the Backspace key will try to delete spaces up to the previous tab stop.

#### Parameters

view | a GtkSourceView. |
smart_backspace | whether to enable smart Backspace handling. |

Since: 3.18

### gtk_source_view_get_smart_backspace ()

    gboolean
    gtk_source_view_get_smart_backspace (GtkSourceView *view);

Returns `TRUE` if pressing the Backspace key will try to delete spaces up to the previous tab stop.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if smart Backspace handling is enabled.

Since: 3.18

### gtk_source_view_set_smart_home_end ()

    void
    gtk_source_view_set_smart_home_end (GtkSourceView *view,
                                        GtkSourceSmartHomeEndType smart_home_end);

Set the desired movement of the cursor when HOME and END keys are pressed.

#### Parameters

view | a GtkSourceView. |
smart_home_end | the desired behavior among GtkSourceSmartHomeEndType. |

### gtk_source_view_get_smart_home_end ()

    GtkSourceSmartHomeEndType
    gtk_source_view_get_smart_home_end (GtkSourceView *view);

Returns a GtkSourceSmartHomeEndType end value specifying how the cursor will move when HOME and END keys are pressed.

#### Parameters

view | a GtkSourceView. |

#### Returns

a GtkSourceSmartHomeEndType value.

### gtk_source_view_set_mark_attributes ()

    void
    gtk_source_view_set_mark_attributes (GtkSourceView *view,
                                         const gchar *category,
                                         GtkSourceMarkAttributes *attributes,
                                         gint priority);

Sets attributes and priority for the `category` .

#### Parameters

view | a GtkSourceView. |
category | the category. |
attributes | mark attributes. |
priority | priority of the category. |

### gtk_source_view_get_mark_attributes ()

    GtkSourceMarkAttributes *
    gtk_source_view_get_mark_attributes (GtkSourceView *view,
                                         const gchar *category,
                                         gint *priority);

Gets attributes and priority for the `category` .

#### Parameters

view | a GtkSourceView. |
category | the category. |
priority | place where priority of the category will be stored. |

#### Returns

GtkSourceMarkAttributes for the `category` . The object belongs to `view` , so it must not be unreffed.

[transfer none]

### gtk_source_view_set_show_line_marks ()

    void
    gtk_source_view_set_show_line_marks (GtkSourceView *view,
                                         gboolean show);

If `TRUE` line marks will be displayed beside the text.

#### Parameters

view | a GtkSourceView. |
show | whether line marks should be displayed. |

Since: 2.2

### gtk_source_view_get_show_line_marks ()

    gboolean
    gtk_source_view_get_show_line_marks (GtkSourceView *view);

Returns whether line marks are displayed beside the text.

#### Parameters

view | a GtkSourceView. |

#### Returns

`TRUE` if the line marks are displayed.

Since: 2.2

### gtk_source_view_set_draw_spaces ()

    void
    gtk_source_view_set_draw_spaces (GtkSourceView *view,
                                     GtkSourceDrawSpacesFlags flags);

Set if and how the spaces should be visualized. Specifying `flags` as 0 will disable display of spaces.

For a finer-grained method, there is also the GtkSourceTag's “draw-spaces” property.

#### Parameters

view | a GtkSourceView. |
flags | GtkSourceDrawSpacesFlags specifing how white spaces should be displayed |

### gtk_source_view_get_draw_spaces ()

    GtkSourceDrawSpacesFlags
    gtk_source_view_get_draw_spaces (GtkSourceView *view);

Returns the GtkSourceDrawSpacesFlags specifying if and how spaces should be displayed for this `view` .

#### Parameters

view | a GtkSourceView |

#### Returns

the GtkSourceDrawSpacesFlags, 0 if no spaces should be drawn.

### gtk_source_view_get_completion ()

    GtkSourceCompletion *
    gtk_source_view_get_completion (GtkSourceView *view);

Gets the GtkSourceCompletion associated with `view` .

#### Parameters

view | a GtkSourceView. |

#### Returns

the GtkSourceCompletion associated with `view` .

[type GtkSource.Completion][transfer none]

### gtk_source_view_get_gutter ()

    GtkSourceGutter *
    gtk_source_view_get_gutter (GtkSourceView *view,
                                GtkTextWindowType window_type);

Returns the GtkSourceGutter object associated with `window_type` for `view` . Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the left gutter.

#### Parameters

view | a GtkSourceView. |
window_type | the gutter window type. |

#### Returns

the GtkSourceGutter.

[transfer none]

Since: 2.8

### gtk_source_view_set_background_pattern ()

    void
    gtk_source_view_set_background_pattern
                                   (GtkSourceView *view,
                                    GtkSourceBackgroundPatternType background_pattern);

Set if and how the background pattern should be displayed.

#### Parameters

view | a GtkSourceView. |
background_pattern | the GtkSourceBackgroundPatternType. |

Since: 3.16

### gtk_source_view_get_background_pattern ()

    GtkSourceBackgroundPatternType
    gtk_source_view_get_background_pattern
                                   (GtkSourceView *view);

Returns the GtkSourceBackgroundPatternType specifying if and how the background pattern should be displayed for this `view` .

#### Parameters

view | a GtkSourceView |

#### Returns

the GtkSourceBackgroundPatternType.

Since: 3.16

## Types and Values

### GtkSourceView

    typedef struct _GtkSourceView GtkSourceView;

### enum GtkSourceSmartHomeEndType

#### Members

GTK_SOURCE_SMART_HOME_END_DISABLED | smart-home-end disabled. |
GTK_SOURCE_SMART_HOME_END_BEFORE | move to the first/last non-whitespace character on the first press of the HOME/END keys and to the beginning/end of the line on the second press. |
GTK_SOURCE_SMART_HOME_END_AFTER | move to the beginning/end of the line on the first press of the HOME/END keys and to the first/last non-whitespace character on the second press. |
GTK_SOURCE_SMART_HOME_END_ALWAYS | always move to the first/last non-whitespace character when the HOME/END keys are pressed. |

### enum GtkSourceDrawSpacesFlags

GtkSourceDrawSpacesFlags determine what kind of spaces whould be drawn. If none of GTK_SOURCE_DRAW_SPACES_LEADING, GTK_SOURCE_DRAW_SPACES_TEXT or GTK_SOURCE_DRAW_SPACES_TRAILING is specified, whitespaces at any position in the line will be drawn (i.e. it has the same effect as specifying all of them).

#### Members

GTK_SOURCE_DRAW_SPACES_SPACE | whether the space character should be drawn. |
GTK_SOURCE_DRAW_SPACES_TAB | whether the tab character should be drawn. |
GTK_SOURCE_DRAW_SPACES_NEWLINE | whether the line breaks should be drawn. |
GTK_SOURCE_DRAW_SPACES_NBSP | whether the non-breaking whitespaces should be drawn. |
GTK_SOURCE_DRAW_SPACES_LEADING | whether leading whitespaces should be drawn. |
GTK_SOURCE_DRAW_SPACES_TEXT | whether whitespaces inside text should be drawn. |
GTK_SOURCE_DRAW_SPACES_TRAILING | whether trailing whitespaces should be drawn. |
GTK_SOURCE_DRAW_SPACES_ALL | wheter all kind of spaces should be drawn. |

### enum GtkSourceViewGutterPosition

#### Members

GTK_SOURCE_VIEW_GUTTER_POSITION_LINES | the gutter position of the lines renderer |
GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS | the gutter position of the marks renderer |

### enum GtkSourceBackgroundPatternType

#### Members

GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE | no pattern |
GTK_SOURCE_BACKGROUND_PATTERN_TYPE_GRID | grid pattern |

Since: 3.16

## Property Details

### The `“auto-indent”` property

      “auto-indent”              gboolean

Whether to enable auto indentation.

Flags: Read / Write

Default value: FALSE

### The `“background-pattern”` property

      “background-pattern”       GtkSourceBackgroundPatternType

Draw a specific background pattern on the view.

Flags: Read / Write

Default value: GTK_SOURCE_BACKGROUND_PATTERN_TYPE_NONE

Since: 3.16

### The `“completion”` property

      “completion”               GtkSourceCompletion *

The completion object associated with the view

Flags: Read

### The `“draw-spaces”` property

      “draw-spaces”              GtkSourceDrawSpacesFlags

Set if and how the spaces should be visualized.

For a finer-grained method, there is also the GtkSourceTag's “draw-spaces” property.

Flags: Read / Write

Since: 2.4

### The `“highlight-current-line”` property

      “highlight-current-line”   gboolean

Whether to highlight the current line.

Flags: Read / Write

Default value: FALSE

### The `“indent-on-tab”` property

      “indent-on-tab”            gboolean

Whether to indent the selected text when the tab key is pressed.

Flags: Read / Write

Default value: TRUE

### The `“indent-width”` property

      “indent-width”             gint

Width of an indentation step expressed in number of spaces.

Flags: Read / Write

Allowed values: [-1,32]

Default value: -1

### The `“insert-spaces-instead-of-tabs”` property

      “insert-spaces-instead-of-tabs” gboolean

Whether to insert spaces instead of tabs.

Flags: Read / Write

Default value: FALSE

### The `“right-margin-position”` property

      “right-margin-position”    guint

Position of the right margin.

Flags: Read / Write

Allowed values: [1,1000]

Default value: 80

### The `“show-line-marks”` property

      “show-line-marks”          gboolean

Whether to display line mark pixbufs

Flags: Read / Write

Default value: FALSE

### The `“show-line-numbers”` property

      “show-line-numbers”        gboolean

Whether to display line numbers

Flags: Read / Write

Default value: FALSE

### The `“show-right-margin”` property

      “show-right-margin”        gboolean

Whether to display the right margin.

Flags: Read / Write

Default value: FALSE

### The `“smart-backspace”` property

      “smart-backspace”          gboolean

Whether smart Backspace should be used.

Flags: Read / Write

Default value: FALSE

Since: 3.18

### The `“smart-home-end”` property

      “smart-home-end”           GtkSourceSmartHomeEndType

Set the behavior of the HOME and END keys.

Flags: Read / Write

Default value: GTK_SOURCE_SMART_HOME_END_DISABLED

Since: 2.0

### The `“tab-width”` property

      “tab-width”                guint

Width of a tab character expressed in number of spaces.

Flags: Read / Write

Allowed values: [1,32]

Default value: 8

## Signal Details

### The `“change-case”` signal

    void
    user_function (GtkSourceView          *view,
                   GtkSourceChangeCaseType case_type,
                   gpointer                user_data)

Keybinding signal to change case of the text at the current cursor position.

#### Parameters

view | the GtkSourceView |
case_type | the case to use |
user_data | user data set when the signal handler was connected. |

Flags: Action

Since: 3.16

### The `“change-number”` signal

    void
    user_function (GtkSourceView *view,
                   gint           count,
                   gpointer       user_data)

Keybinding signal to edit a number at the current cursor position.

#### Parameters

view | the GtkSourceView |
count | the number to add to the number at the current position |
user_data | user data set when the signal handler was connected. |

Flags: Action

Since: 3.16

### The `“join-lines”` signal

    void
    user_function (GtkSourceView *view,
                   gpointer       user_data)

Keybinding signal to join the lines currently selected.

#### Parameters

view | the GtkSourceView |
user_data | user data set when the signal handler was connected. |

Flags: Action

Since: 3.16

### The `“line-mark-activated”` signal

    void
    user_function (GtkSourceView *view,
                   GtkTextIter   *iter,
                   GdkEvent      *event,
                   gpointer       user_data)

Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter). You can use `iter` to determine on which line the activation took place.

#### Parameters

view | the GtkSourceView |
iter | a GtkTextIter |
event | the GdkEvent that activated the event |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“move-lines”` signal

    void
    user_function (GtkSourceView *view,
                   gboolean       copy,
                   gint           count,
                   gpointer       user_data)

The ::move-lines signal is a keybinding which gets emitted when the user initiates moving a line. The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the current line by `count` . For the moment, only `count` of -1 or 1 is valid.

#### Parameters

view | the GtkSourceView which received the signal |
copy | `TRUE` if the line should be copied, `FALSE` if it should be moved |
count | the number of lines to move over. |
user_data | user data set when the signal handler was connected. |

Flags: Action

Since: 2.10

### The `“move-to-matching-bracket”` signal

    void
    user_function (GtkSourceView *view,
                   gboolean       extend_selection,
                   gpointer       user_data)

Keybinding signal to move the cursor to the matching bracket.

#### Parameters

view | the GtkSourceView |
extend_selection | `TRUE` if the move should extend the selection |
user_data | user data set when the signal handler was connected. |

Flags: Action

Since: 3.16

### The `“move-words”` signal

    void
    user_function (GtkSourceView *view,
                   gint           count,
                   gpointer       user_data)

The ::move-words signal is a keybinding which gets emitted when the user initiates moving a word. The default binding key is Alt+Left/Right Arrow and moves the current selection, or the current word by one word.

#### Parameters

view | the GtkSourceView which received the signal |
count | the number of words to move over |
user_data | user data set when the signal handler was connected. |

Flags: Action

Since: 3.0

### The `“redo”` signal

    void
    user_function (GtkSourceView *sourceview,
                   gpointer       user_data)

Flags: Action

### The `“show-completion”` signal

    void
    user_function (GtkSourceView *view,
                   gpointer       user_data)

The ::show-completion signal is a key binding signal which gets emitted when the user requests a completion, by pressing

Control+space.

This will create a GtkSourceCompletionContext with the activation type as `GTK_SOURCE_COMPLETION_ACTIVATION_USER_REQUESTED`.

Applications should not connect to it, but may emit it with `g_signal_emit_by_name()` if they need to activate the completion by another means, for example with another key binding or a menu entry.

#### Parameters

view | The GtkSourceView who emits the signal |
user_data | user data set when the signal handler was connected. |

Flags: Action

### The `“smart-home-end”` signal

    void
    user_function (GtkSourceView *view,
                   GtkTextIter   *iter,
                   gint           count,
                   gpointer       user_data)

Emitted when a the cursor was moved according to the smart home end setting. The signal is emitted after the cursor is moved, but during the GtkTextView::move-cursor action. This can be used to find out whether the cursor was moved by a normal home/end or by a smart home/end.

#### Parameters

view | the GtkSourceView |
iter | a GtkTextIter |
count | the count |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 3.0

### The `“undo”` signal

    void
    user_function (GtkSourceView *sourceview,
                   gpointer       user_data)

Flags: Action

## See Also

GtkTextView, GtkSourceBuffer