Trait sourceview5::BufferExt[][src]

pub trait BufferExt: 'static {
    fn change_case(
        &self,
        case_type: ChangeCaseType,
        start: &mut TextIter,
        end: &mut TextIter
    );
fn create_source_mark(
        &self,
        name: Option<&str>,
        category: &str,
        where_: &TextIter
    ) -> Option<Mark>;
fn ensure_highlight(&self, start: &TextIter, end: &TextIter);
fn get_context_classes_at_iter(&self, iter: &TextIter) -> Vec<GString>;
fn get_highlight_matching_brackets(&self) -> bool;
fn get_highlight_syntax(&self) -> bool;
fn get_implicit_trailing_newline(&self) -> bool;
fn get_language(&self) -> Option<Language>;
fn get_source_marks_at_iter(
        &self,
        iter: &mut TextIter,
        category: Option<&str>
    ) -> Vec<Mark>;
fn get_source_marks_at_line(
        &self,
        line: i32,
        category: Option<&str>
    ) -> Vec<Mark>;
fn get_style_scheme(&self) -> Option<StyleScheme>;
fn iter_has_context_class(
        &self,
        iter: &TextIter,
        context_class: &str
    ) -> bool;
fn join_lines(&self, start: &mut TextIter, end: &mut TextIter);
fn remove_source_marks(
        &self,
        start: &TextIter,
        end: &TextIter,
        category: Option<&str>
    );
fn set_highlight_matching_brackets(&self, highlight: bool);
fn set_highlight_syntax(&self, highlight: bool);
fn set_implicit_trailing_newline(&self, implicit_trailing_newline: bool);
fn set_language(&self, language: Option<&Language>);
fn set_style_scheme(&self, scheme: Option<&StyleScheme>);
fn sort_lines(
        &self,
        start: &mut TextIter,
        end: &mut TextIter,
        flags: SortFlags,
        column: i32
    );
fn connect_bracket_matched<F: Fn(&Self, Option<&TextIter>, BracketMatchType) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_cursor_moved<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_highlight_updated<F: Fn(&Self, &TextIter, &TextIter) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_source_mark_updated<F: Fn(&Self, &TextMark) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_highlight_matching_brackets_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_highlight_syntax_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_implicit_trailing_newline_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_language_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId;
fn connect_property_style_scheme_notify<F: Fn(&Self) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId; }

Trait containing all Buffer methods.

Implementors

Buffer

Required methods

fn change_case(
    &self,
    case_type: ChangeCaseType,
    start: &mut TextIter,
    end: &mut TextIter
)
[src]

Changes the case of the text between the specified iterators.

case_type

how to change the case.

start

a gtk::TextIter.

end

a gtk::TextIter.

fn create_source_mark(
    &self,
    name: Option<&str>,
    category: &str,
    where_: &TextIter
) -> Option<Mark>
[src]

Creates a source mark in the self of category category. A source mark is a gtk::TextMark but organised into categories. Depending on the category a pixbuf can be specified that will be displayed along the line of the mark.

Like a gtk::TextMark, a Mark can be anonymous if the passed name is None. Also, the buffer owns the marks so you shouldn’t unreference it.

Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in.

Typical uses for a source mark are bookmarks, breakpoints, current executing instruction indication in a source file, etc..

name

the name of the mark, or None.

category

a string defining the mark category.

where_

location to place the mark.

Returns

a new Mark, owned by the buffer.

fn ensure_highlight(&self, start: &TextIter, end: &TextIter)[src]

Forces buffer to analyze and highlight the given area synchronously.

<note> <para> This is a potentially slow operation and should be used only when you need to make sure that some text not currently visible is highlighted, for instance before printing. </para> </note>

start

start of the area to highlight.

end

end of the area to highlight.

fn get_context_classes_at_iter(&self, iter: &TextIter) -> Vec<GString>[src]

Get all defined context classes at iter.

See the Buffer description for the list of default context classes.

iter

a gtk::TextIter.

Returns

a new None terminated array of context class names. Use g_strfreev to free the array if it is no longer needed.

fn get_highlight_matching_brackets(&self) -> bool[src]

Determines whether bracket match highlighting is activated for the source buffer.

Returns

true if the source buffer will highlight matching brackets.

fn get_highlight_syntax(&self) -> bool[src]

Determines whether syntax highlighting is activated in the source buffer.

Returns

true if syntax highlighting is enabled, false otherwise.

fn get_implicit_trailing_newline(&self) -> bool[src]

Returns

whether the self has an implicit trailing newline.

fn get_language(&self) -> Option<Language>[src]

Returns the Language associated with the buffer, see BufferExt::set_language. The returned object should not be unreferenced by the user.

Returns

the Language associated with the buffer, or None.

fn get_source_marks_at_iter(
    &self,
    iter: &mut TextIter,
    category: Option<&str>
) -> Vec<Mark>
[src]

Returns the list of marks of the given category at iter. If category is None it returns all marks at iter.

iter

an iterator.

category

category to search for, or None

Returns

a newly allocated glib::SList.

fn get_source_marks_at_line(
    &self,
    line: i32,
    category: Option<&str>
) -> Vec<Mark>
[src]

Returns the list of marks of the given category at line. If category is None, all marks at line are returned.

line

a line number.

category

category to search for, or None

Returns

a newly allocated glib::SList.

fn get_style_scheme(&self) -> Option<StyleScheme>[src]

Returns the StyleScheme associated with the buffer, see BufferExt::set_style_scheme. The returned object should not be unreferenced by the user.

Returns

the StyleScheme associated with the buffer, or None.

fn iter_has_context_class(&self, iter: &TextIter, context_class: &str) -> bool[src]

Check if the class context_class is set on iter.

See the Buffer description for the list of default context classes.

iter

a gtk::TextIter.

context_class

class to search for.

Returns

whether iter has the context class.

fn join_lines(&self, start: &mut TextIter, end: &mut TextIter)[src]

Joins the lines of text between the specified iterators.

start

a gtk::TextIter.

end

a gtk::TextIter.

fn remove_source_marks(
    &self,
    start: &TextIter,
    end: &TextIter,
    category: Option<&str>
)
[src]

Remove all marks of category between start and end from the buffer. If category is NULL, all marks in the range will be removed.

start

a gtk::TextIter.

end

a gtk::TextIter.

category

category to search for, or None.

fn set_highlight_matching_brackets(&self, highlight: bool)[src]

Controls the bracket match highlighting function in the buffer. If activated, when you position your cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or closing bracket character will be highlighted.

highlight

true if you want matching brackets highlighted.

fn set_highlight_syntax(&self, highlight: bool)[src]

Controls whether syntax is highlighted in the buffer.

If highlight is true, the text will be highlighted according to the syntax patterns specified in the Language set with BufferExt::set_language.

If highlight is false, syntax highlighting is disabled and all the gtk::TextTag objects that have been added by the syntax highlighting engine are removed from the buffer.

highlight

true to enable syntax highlighting, false to disable it.

fn set_implicit_trailing_newline(&self, implicit_trailing_newline: bool)[src]

Sets whether the self has an implicit trailing newline.

If an explicit trailing newline is present in a gtk::TextBuffer, gtk::TextView shows it as an empty line. This is generally not what the user expects.

If implicit_trailing_newline is true (the default value):

  • when a FileLoader loads the content of a file into the self, the trailing newline (if present in the file) is not inserted into the self.
  • when a FileSaver saves the content of the self into a file, a trailing newline is added to the file.

On the other hand, if implicit_trailing_newline is false, the file’s content is not modified when loaded into the self, and the self’s content is not modified when saved into a file.

implicit_trailing_newline

the new value.

fn set_language(&self, language: Option<&Language>)[src]

Associates a Language with the buffer.

Note that a Language affects not only the syntax highlighting, but also the [context classes][context-classes]. If you want to disable just the syntax highlighting, see BufferExt::set_highlight_syntax.

The buffer holds a reference to language.

language

a Language to set, or None.

fn set_style_scheme(&self, scheme: Option<&StyleScheme>)[src]

Sets a StyleScheme to be used by the buffer and the view.

Note that a StyleScheme affects not only the syntax highlighting, but also other View features such as highlighting the current line, matching brackets, the line numbers, etc.

Instead of setting a None scheme, it is better to disable syntax highlighting with BufferExt::set_highlight_syntax, and setting the StyleScheme with the “classic” or “tango” ID, because those two style schemes follow more closely the GTK+ theme (for example for the background color).

The buffer holds a reference to scheme.

scheme

a StyleScheme or None.

fn sort_lines(
    &self,
    start: &mut TextIter,
    end: &mut TextIter,
    flags: SortFlags,
    column: i32
)
[src]

Sort the lines of text between the specified iterators.

start

a gtk::TextIter.

end

a gtk::TextIter.

flags

SortFlags specifying how the sort should behave

column

sort considering the text starting at the given column

fn connect_bracket_matched<F: Fn(&Self, Option<&TextIter>, BracketMatchType) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

iter is set to a valid iterator pointing to the matching bracket if state is BracketMatchType::Found. Otherwise iter is meaningless.

The signal is emitted only when the state changes, typically when the cursor moves.

A use-case for this signal is to show messages in a gtk::Statusbar.

iter

if found, the location of the matching bracket.

state

state of bracket matching.

fn connect_cursor_moved<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId[src]

The “cursor-moved” signal is emitted when then insertion mark has moved.

Feature: v5_0

fn connect_highlight_updated<F: Fn(&Self, &TextIter, &TextIter) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

The ::highlight-updated signal is emitted when the syntax highlighting and [context classes][context-classes] are updated in a certain region of the buffer.

start

the start of the updated region

end

the end of the updated region

fn connect_source_mark_updated<F: Fn(&Self, &TextMark) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

The ::source-mark-updated signal is emitted each time a mark is added to, moved or removed from the buffer.

mark

the Mark

fn connect_property_highlight_matching_brackets_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_highlight_syntax_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_implicit_trailing_newline_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_language_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

fn connect_property_style_scheme_notify<F: Fn(&Self) + 'static>(
    &self,
    f: F
) -> SignalHandlerId
[src]

Loading content...

Implementors

impl<O: IsA<Buffer>> BufferExt for O[src]

Loading content...