Class: GtkSource::Buffer

Inherits:
Gtk::TextBuffer show all
Extended by:
GLib::Deprecatable
Defined in:
lib/gtksourceview5/deprecated.rb

Instance Method Summary collapse

Methods inherited from Gtk::TextBuffer

#add_mark, #add_selection_clipboard, #apply_tag, #apply_tag_by_name, #backspace, #begin_irreversible_action, #begin_user_action, #can_redo, #can_redo=, #can_redo?, #can_undo, #can_undo=, #can_undo?, #char_count, #copy_clipboard, #create_child_anchor, #create_mark, #create_tag, #cursor_position, #cursor_position=, #cut_clipboard, #delete, #delete_interactive, #delete_mark, #delete_mark_by_name, #delete_selection, #enable_undo, #enable_undo=, #enable_undo?, #end_irreversible_action, #end_user_action, #get_bounds, #get_end_iter, #get_iter_at_child_anchor, #get_iter_at_line, #get_iter_at_line_index, #get_iter_at_line_offset, #get_iter_at_mark, #get_iter_at_offset, #get_mark, #get_selection_bounds, #get_slice, #get_start_iter, #get_text, #has_selection, #has_selection=, #has_selection?, #insert, #insert_at_cursor, #insert_child_anchor, #insert_interactive, #insert_interactive_at_cursor, #insert_markup, #insert_paintable, #insert_range, #insert_range_interactive, #insert_with_tags, #insert_with_tags_by_name, #line_count, #max_undo_levels, #max_undo_levels=, #modified, #modified=, #move_mark, #move_mark_by_name, #paste_clipboard, #place_cursor, #redo, #remove_all_tags, #remove_selection_clipboard, #remove_tag, #remove_tag_by_name, #select_range, #selection_bound, #selection_content, #set_text, #tag_table, #tag_table=, #text, #text=, #undo

Constructor Details

#initialize(language) ⇒ GtkSource::Buffer

Creates a new source buffer using the highlighting patterns in language.

This is equivalent to creating a new source buffer with a new tag table and then calling [methodBuffer.set_language]. according to the highlighting patterns in language.

Parameters:

Instance Method Details

#backward_iter_to_source_mark(iter, category) ⇒ Boolean

Moves iter to the position of the previous [classMark] of the given category.

Returns true if iter was moved. If category is NULL, the previous source mark can be of any category.

Parameters:

  • iter (Gtk::TextIter)

    an iterator.

  • category (String)

    category to search for, or nil

Returns:

  • (Boolean)

    whether iter was moved.

#change_case(case_type, start, end) ⇒ nil

Changes the case of the text between the specified iterators.

Since 5.4, this function will update the position of start and end to surround the modified text.

Parameters:

  • case_type (GtkSource::ChangeCaseType)

    how to change the case.

  • start (Gtk::TextIter)

    a Gtk::TextIter.

  • end (Gtk::TextIter)

    a Gtk::TextIter.

Returns:

  • (nil)

#create_source_mark(name, category, where) ⇒ GtkSource::Mark

Creates a source mark in the buffer of category category.

A source mark is a [classGtk.TextMark] but organized into categories. Depending on the category a pixbuf can be specified that will be displayed along the line of the mark.

Like a [classGtk.TextMark], a [classMark] can be anonymous if the passed name is nil. 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..

Parameters:

  • name (String)

    the name of the mark, or nil.

  • category (String)

    a string defining the mark category.

  • where (Gtk::TextIter)

    location to place the mark.

Returns:

#create_source_tag(tag_name, first_property_name, array) ⇒ Gtk::TextTag

In short, this is the same function as [methodGtk.TextBuffer.create_tag] but instead of creating a [classGtk.TextTag], this function creates a [classTag].

This function creates a [classTag] and adds it to the tag table for buffer. Equivalent to calling [ctorGtk.TextTag.new] and then adding the tag to the buffer’s tag table. The returned tag is owned by the buffer’s tag table, so the ref count will be equal to one.

If tag_name is nil, the tag is anonymous.

If tag_name is non-nil, a tag called tag_name must not already exist in the tag table for this buffer.

The first_property_name argument and subsequent arguments are a list of properties to set on the tag, as with [methodGObject.Object.set].

Parameters:

  • tag_name (String)

    name of the new tag, or nil

  • first_property_name (String)

    name of first property to set, or nil

  • array (Array)

    nil-terminated list of property names and values

Returns:

#ensure_highlight(start, end) ⇒ nil

Forces buffer to analyze and highlight the given area synchronously.

Note:

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.

Parameters:

  • start (Gtk::TextIter)

    start of the area to highlight.

  • end (Gtk::TextIter)

    end of the area to highlight.

Returns:

  • (nil)

#forward_iter_to_source_mark(iter, category) ⇒ Boolean

Moves iter to the position of the next [classMark] of the given category.

Returns true if iter was moved. If category is NULL, the next source mark can be of any category.

Parameters:

  • iter (Gtk::TextIter)

    an iterator.

  • category (String)

    category to search for, or nil

Returns:

  • (Boolean)

    whether iter was moved.

#get_context_classes_at_iter(iter) ⇒ Array<String>

Get all defined context classes at iter.

See the [classBuffer] description for the list of default context classes. terminated array of context class names. Use g_strfreev() to free the array if it is no longer needed.

Parameters:

  • iter (Gtk::TextIter)

    a Gtk::TextIter.

Returns:

  • (Array<String>)

    a new nil

#get_source_marks_at_iter(iter, category) ⇒ GLib::SList<GtkSource::Mark>

Returns the list of marks of the given category at iter.

If category is nil it returns all marks at iter. a newly allocated #GSList.

Parameters:

  • iter (Gtk::TextIter)

    an iterator.

  • category (String)

    category to search for, or nil

Returns:

#get_source_marks_at_line(line, category) ⇒ GLib::SList<GtkSource::Mark>

Returns the list of marks of the given category at line.

If category is nil, all marks at line are returned. a newly allocated #GSList.

Parameters:

  • line (Integer)

    a line number.

  • category (String)

    category to search for, or nil

Returns:

#highlight_matching_bracketsBoolean

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

Returns:

  • (Boolean)

    true if the source buffer will highlight matching

#highlight_matching_brackets=(highlight_matching_brackets) ⇒ Boolean

Whether to highlight matching brackets in the buffer.

Parameters:

  • highlight_matching_brackets (Boolean)

Returns:

  • (Boolean)

    highlight-matching-brackets

  • (Boolean)

    highlight-matching-brackets

#highlight_matching_brackets?Boolean

Whether to highlight matching brackets in the buffer.

Returns:

  • (Boolean)

    highlight-matching-brackets

#highlight_syntaxBoolean

Determines whether syntax highlighting is activated in the source buffer.

Returns:

  • (Boolean)

    true if syntax highlighting is enabled, false otherwise.

#highlight_syntax=(highlight_syntax) ⇒ Boolean

Whether to highlight syntax in the buffer.

Parameters:

  • highlight_syntax (Boolean)

Returns:

  • (Boolean)

    highlight-syntax

  • (Boolean)

    highlight-syntax

#highlight_syntax?Boolean

Whether to highlight syntax in the buffer.

Returns:

  • (Boolean)

    highlight-syntax

#implicit_trailing_newlineBoolean

Returns whether the buffer has an implicit trailing newline.

Returns:

  • (Boolean)

    whether the buffer has an implicit trailing newline.

#implicit_trailing_newline=(implicit_trailing_newline) ⇒ Boolean

Whether the buffer has an implicit trailing newline. See [methodBuffer.set_implicit_trailing_newline].

Parameters:

  • implicit_trailing_newline (Boolean)

Returns:

  • (Boolean)

    implicit-trailing-newline

  • (Boolean)

    implicit-trailing-newline

#implicit_trailing_newline?Boolean

Whether the buffer has an implicit trailing newline. See [methodBuffer.set_implicit_trailing_newline].

Returns:

  • (Boolean)

    implicit-trailing-newline

#iter_backward_to_context_class_toggle(iter, context_class) ⇒ Boolean

Moves backward to the next toggle (on or off) of the context class.

If no matching context class toggles are found, returns false, otherwise true. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.

See the [classBuffer] description for the list of default context classes.

Parameters:

  • iter (Gtk::TextIter)

    a Gtk::TextIter.

  • context_class (String)

    the context class.

Returns:

  • (Boolean)

    whether we found a context class toggle before iter

#iter_forward_to_context_class_toggle(iter, context_class) ⇒ Boolean

Moves forward to the next toggle (on or off) of the context class.

If no matching context class toggles are found, returns false, otherwise true. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.

See the [classBuffer] description for the list of default context classes.

Parameters:

  • iter (Gtk::TextIter)

    a Gtk::TextIter.

  • context_class (String)

    the context class.

Returns:

  • (Boolean)

    whether we found a context class toggle after iter

#iter_has_context_class(iter, context_class) ⇒ Boolean

Check if the class context_class is set on iter.

See the [classBuffer] description for the list of default context classes.

Parameters:

  • iter (Gtk::TextIter)

    a Gtk::TextIter.

  • context_class (String)

    class to search for.

Returns:

  • (Boolean)

    whether iter has the context class.

#join_lines(start, end) ⇒ nil

Joins the lines of text between the specified iterators.

Parameters:

  • start (Gtk::TextIter)

    a Gtk::TextIter.

  • end (Gtk::TextIter)

    a Gtk::TextIter.

Returns:

  • (nil)

#languageGtkSource::Language

Returns language.

Returns:

#language=(language) ⇒ GtkSource::Language

Parameters:

Returns:

#loadingBoolean

Returns:

  • (Boolean)

#loading=(loading) ⇒ Boolean

The "loading" property denotes that a GtkSourceFileLoader is currently loading the buffer.

Applications may want to use this setting to avoid doing work while the buffer is loading such as spellchecking.

Parameters:

  • loading (Boolean)

Returns:

  • (Boolean)

    loading

  • (Boolean)

    loading

#loading?Boolean

The "loading" property denotes that a GtkSourceFileLoader is currently loading the buffer.

Applications may want to use this setting to avoid doing work while the buffer is loading such as spellchecking.

Returns:

  • (Boolean)

    loading

#remove_source_marks(start, end, category) ⇒ nil

Remove all marks of category between start and end from the buffer.

If category is NULL, all marks in the range will be removed.

Parameters:

  • start (Gtk::TextIter)

    a Gtk::TextIter.

  • end (Gtk::TextIter)

    a Gtk::TextIter.

  • category (String)

    category to search for, or nil.

Returns:

  • (nil)

#sort_lines(start, end, flags, column) ⇒ nil

Sort the lines of text between the specified iterators.

Parameters:

  • start (Gtk::TextIter)

    a Gtk::TextIter.

  • end (Gtk::TextIter)

    a Gtk::TextIter.

  • flags (GtkSource::SortFlags)

    Gtk::SourceSortFlags specifying how the sort should behave

  • column (Integer)

    sort considering the text starting at the given column

Returns:

  • (nil)

#style_schemeGtkSource::StyleScheme

Style scheme. It contains styles for syntax highlighting, optionally foreground, background, cursor color, current line color, and matching brackets style.

Returns:

#style_scheme=(style_scheme) ⇒ GtkSource::StyleScheme

Style scheme. It contains styles for syntax highlighting, optionally foreground, background, cursor color, current line color, and matching brackets style.

Parameters:

Returns: