Trait sourceview4::prelude::ViewExt
source · pub trait ViewExt: IsA<View> + Sealed + 'static {
Show 68 methods
// Provided methods
fn is_auto_indent(&self) -> bool { ... }
fn background_pattern(&self) -> BackgroundPatternType { ... }
fn completion(&self) -> Option<Completion> { ... }
fn gutter(&self, window_type: TextWindowType) -> Option<Gutter> { ... }
fn is_highlight_current_line(&self) -> bool { ... }
fn is_indent_on_tab(&self) -> bool { ... }
fn indent_width(&self) -> i32 { ... }
fn is_insert_spaces_instead_of_tabs(&self) -> bool { ... }
fn right_margin_position(&self) -> u32 { ... }
fn shows_line_marks(&self) -> bool { ... }
fn shows_line_numbers(&self) -> bool { ... }
fn shows_right_margin(&self) -> bool { ... }
fn is_smart_backspace(&self) -> bool { ... }
fn smart_home_end(&self) -> SmartHomeEndType { ... }
fn space_drawer(&self) -> Option<SpaceDrawer> { ... }
fn tab_width(&self) -> u32 { ... }
fn visual_column(&self, iter: &TextIter) -> u32 { ... }
fn indent_lines(&self, start: &mut TextIter, end: &mut TextIter) { ... }
fn set_auto_indent(&self, enable: bool) { ... }
fn set_background_pattern(&self, background_pattern: BackgroundPatternType) { ... }
fn set_highlight_current_line(&self, highlight: bool) { ... }
fn set_indent_on_tab(&self, enable: bool) { ... }
fn set_indent_width(&self, width: i32) { ... }
fn set_insert_spaces_instead_of_tabs(&self, enable: bool) { ... }
fn set_mark_attributes(
&self,
category: &str,
attributes: &impl IsA<MarkAttributes>,
priority: i32
) { ... }
fn set_right_margin_position(&self, pos: u32) { ... }
fn set_show_line_marks(&self, show: bool) { ... }
fn set_show_line_numbers(&self, show: bool) { ... }
fn set_show_right_margin(&self, show: bool) { ... }
fn set_smart_backspace(&self, smart_backspace: bool) { ... }
fn set_smart_home_end(&self, smart_home_end: SmartHomeEndType) { ... }
fn set_tab_width(&self, width: u32) { ... }
fn unindent_lines(&self, start: &mut TextIter, end: &mut TextIter) { ... }
fn connect_change_case<F: Fn(&Self, ChangeCaseType) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_change_case(&self, case_type: ChangeCaseType) { ... }
fn connect_change_number<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_change_number(&self, count: i32) { ... }
fn connect_join_lines<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_join_lines(&self) { ... }
fn connect_line_mark_activated<F: Fn(&Self, &TextIter, &Event) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_move_lines<F: Fn(&Self, bool) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_move_lines(&self, down: bool) { ... }
fn connect_move_to_matching_bracket<F: Fn(&Self, bool) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_move_to_matching_bracket(&self, extend_selection: bool) { ... }
fn connect_move_words<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_move_words(&self, count: i32) { ... }
fn connect_redo<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_redo(&self) { ... }
fn connect_show_completion<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn emit_show_completion(&self) { ... }
fn connect_smart_home_end<F: Fn(&Self, &TextIter, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_undo<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { ... }
fn emit_undo(&self) { ... }
fn connect_auto_indent_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_background_pattern_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_completion_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_highlight_current_line_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_indent_on_tab_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_indent_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_insert_spaces_instead_of_tabs_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_right_margin_position_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_show_line_marks_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_show_line_numbers_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_show_right_margin_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_smart_backspace_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_smart_home_end_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_space_drawer_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
fn connect_tab_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId { ... }
}
Expand description
Provided Methods§
sourcefn is_auto_indent(&self) -> bool
fn is_auto_indent(&self) -> bool
sourcefn background_pattern(&self) -> BackgroundPatternType
fn background_pattern(&self) -> BackgroundPatternType
Returns the BackgroundPatternType
specifying if and how
the background pattern should be displayed for this self
.
Returns
sourcefn completion(&self) -> Option<Completion>
fn completion(&self) -> Option<Completion>
Gets the Completion
associated with self
. The returned object is
guaranteed to be the same for the lifetime of self
. Each View
object has a different Completion
.
Returns
the Completion
associated with self
.
sourcefn gutter(&self, window_type: TextWindowType) -> Option<Gutter>
fn gutter(&self, window_type: TextWindowType) -> Option<Gutter>
Returns the Gutter
object associated with window_type
for self
.
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.
window_type
the gutter window type.
Returns
the Gutter
.
sourcefn is_highlight_current_line(&self) -> bool
fn is_highlight_current_line(&self) -> bool
sourcefn is_indent_on_tab(&self) -> bool
fn is_indent_on_tab(&self) -> bool
sourcefn indent_width(&self) -> i32
fn indent_width(&self) -> i32
Returns the number of spaces to use for each step of indent.
See set_indent_width()
for details.
Returns
indent width.
sourcefn is_insert_spaces_instead_of_tabs(&self) -> bool
fn is_insert_spaces_instead_of_tabs(&self) -> bool
sourcefn right_margin_position(&self) -> u32
fn right_margin_position(&self) -> u32
sourcefn shows_line_marks(&self) -> bool
fn shows_line_marks(&self) -> bool
sourcefn shows_line_numbers(&self) -> bool
fn shows_line_numbers(&self) -> bool
sourcefn shows_right_margin(&self) -> bool
fn shows_right_margin(&self) -> bool
sourcefn is_smart_backspace(&self) -> bool
fn is_smart_backspace(&self) -> bool
sourcefn smart_home_end(&self) -> SmartHomeEndType
fn smart_home_end(&self) -> SmartHomeEndType
Returns a SmartHomeEndType
end value specifying
how the cursor will move when HOME and END keys are pressed.
Returns
a SmartHomeEndType
value.
sourcefn space_drawer(&self) -> Option<SpaceDrawer>
fn space_drawer(&self) -> Option<SpaceDrawer>
Gets the SpaceDrawer
associated with self
. The returned object is
guaranteed to be the same for the lifetime of self
. Each View
object has a different SpaceDrawer
.
Returns
the SpaceDrawer
associated with self
.
sourcefn visual_column(&self, iter: &TextIter) -> u32
fn visual_column(&self, iter: &TextIter) -> u32
sourcefn indent_lines(&self, start: &mut TextIter, end: &mut TextIter)
fn indent_lines(&self, start: &mut TextIter, end: &mut TextIter)
Inserts one indentation level at the beginning of the specified lines. The empty lines are not indented.
start
gtk::TextIter
of the first line to indent
end
gtk::TextIter
of the last line to indent
sourcefn set_auto_indent(&self, enable: bool)
fn set_auto_indent(&self, enable: bool)
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 <emphasis>
not</emphasis>
a
“smart indentation” where an indentation level is added or removed depending
on the context.
enable
whether to enable auto indentation.
sourcefn set_background_pattern(&self, background_pattern: BackgroundPatternType)
fn set_background_pattern(&self, background_pattern: BackgroundPatternType)
Set if and how the background pattern should be displayed.
background_pattern
sourcefn set_highlight_current_line(&self, highlight: bool)
fn set_highlight_current_line(&self, highlight: bool)
sourcefn set_indent_on_tab(&self, enable: bool)
fn set_indent_on_tab(&self, enable: bool)
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.
enable
whether to indent a block when tab is pressed.
sourcefn set_indent_width(&self, width: i32)
fn set_indent_width(&self, width: i32)
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
gtk::TextBuffer
.
The test-widget program (available in the GtkSourceView repository) may be useful to better understand the indentation settings (enable the space drawing!).
width
indent width in characters.
sourcefn set_insert_spaces_instead_of_tabs(&self, enable: bool)
fn set_insert_spaces_instead_of_tabs(&self, enable: bool)
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
gtk::TextBuffer
API.
enable
whether to insert spaces instead of tabs.
sourcefn set_mark_attributes(
&self,
category: &str,
attributes: &impl IsA<MarkAttributes>,
priority: i32
)
fn set_mark_attributes( &self, category: &str, attributes: &impl IsA<MarkAttributes>, priority: i32 )
Sets attributes and priority for the category
.
category
the category.
attributes
mark attributes.
priority
priority of the category.
sourcefn set_right_margin_position(&self, pos: u32)
fn set_right_margin_position(&self, pos: u32)
Sets the position of the right margin in the given self
.
pos
the width in characters where to position the right margin.
sourcefn set_show_line_marks(&self, show: bool)
fn set_show_line_marks(&self, show: bool)
sourcefn set_show_line_numbers(&self, show: bool)
fn set_show_line_numbers(&self, show: bool)
sourcefn set_show_right_margin(&self, show: bool)
fn set_show_right_margin(&self, show: bool)
sourcefn set_smart_backspace(&self, smart_backspace: bool)
fn set_smart_backspace(&self, smart_backspace: bool)
When set to true
, pressing the Backspace key will try to delete spaces
up to the previous tab stop.
smart_backspace
whether to enable smart Backspace handling.
sourcefn set_smart_home_end(&self, smart_home_end: SmartHomeEndType)
fn set_smart_home_end(&self, smart_home_end: SmartHomeEndType)
Set the desired movement of the cursor when HOME and END keys are pressed.
smart_home_end
the desired behavior among SmartHomeEndType
.
sourcefn set_tab_width(&self, width: u32)
fn set_tab_width(&self, width: u32)
Sets the width of tabulation in characters. The gtk::TextBuffer
still contains
\t characters, but they can take a different visual width in a View
widget.
width
width of tab in characters.
sourcefn unindent_lines(&self, start: &mut TextIter, end: &mut TextIter)
fn unindent_lines(&self, start: &mut TextIter, end: &mut TextIter)
Removes one indentation level at the beginning of the specified lines.
start
gtk::TextIter
of the first line to indent
end
gtk::TextIter
of the last line to indent
sourcefn connect_change_case<F: Fn(&Self, ChangeCaseType) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_change_case<F: Fn(&Self, ChangeCaseType) + 'static>( &self, f: F ) -> SignalHandlerId
Keybinding signal to change case of the text at the current cursor position.
case_type
the case to use
fn emit_change_case(&self, case_type: ChangeCaseType)
sourcefn connect_change_number<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_change_number<F: Fn(&Self, i32) + 'static>( &self, f: F ) -> SignalHandlerId
Keybinding signal to edit a number at the current cursor position.
count
the number to add to the number at the current position
fn emit_change_number(&self, count: i32)
sourcefn connect_join_lines<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn connect_join_lines<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Keybinding signal to join the lines currently selected.
fn emit_join_lines(&self)
sourcefn connect_line_mark_activated<F: Fn(&Self, &TextIter, &Event) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_line_mark_activated<F: Fn(&Self, &TextIter, &Event) + 'static>( &self, f: F ) -> SignalHandlerId
sourcefn connect_move_lines<F: Fn(&Self, bool) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_move_lines<F: Fn(&Self, bool) + 'static>( &self, f: F ) -> SignalHandlerId
fn emit_move_lines(&self, down: bool)
sourcefn connect_move_to_matching_bracket<F: Fn(&Self, bool) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_move_to_matching_bracket<F: Fn(&Self, bool) + 'static>( &self, f: F ) -> SignalHandlerId
Keybinding signal to move the cursor to the matching bracket.
extend_selection
true
if the move should extend the selection
fn emit_move_to_matching_bracket(&self, extend_selection: bool)
sourcefn connect_move_words<F: Fn(&Self, i32) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_move_words<F: Fn(&Self, i32) + 'static>( &self, f: F ) -> SignalHandlerId
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.
count
the number of words to move over
fn emit_move_words(&self, count: i32)
fn connect_redo<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
fn emit_redo(&self)
sourcefn connect_show_completion<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_show_completion<F: Fn(&Self) + 'static>( &self, f: F ) -> SignalHandlerId
The ::show-completion 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>
.
This will create a CompletionContext
with the activation
type as CompletionActivation::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.