Class: Gtk::TextView

Inherits:
Widget
  • Object
show all
Defined in:
(unknown)

Direct Known Subclasses

GtkSource::View

Instance Method Summary collapse

Methods inherited from Widget

#accessible_role, #accessible_role=, #action_set_enabled, #activate, #activate_action, #activate_action_variant, #activate_default, #activate_signal, #activate_signal=, #activate_signal_from_name=, #add_binding, #add_binding_action, #add_binding_signal, #add_controller, #add_css_class, #add_mnemonic_label, #add_shortcut, #add_tick_callback, #allocate, #allocated_baseline, #allocated_height, #allocated_width, #baseline, #bind_template_callback_full, #bind_template_child_full, #can_focus, #can_focus=, #can_focus?, #can_target, #can_target=, #can_target?, #child_focus, #child_visible, #child_visible=, #clipboard, #compute_bounds, #compute_expand, #compute_point, #compute_transform, #contains, #create_pango_context, #create_pango_layout, #css_classes, #css_classes=, #css_name, #css_name=, #cursor, #cursor=, #cursor_from_name=, default_direction, default_direction=, #direction, #direction=, #display, #dispose_template, #drag_check_threshold, #error_bell, #first_child, #focus_child, #focus_child=, #focus_on_click, #focus_on_click=, #focus_on_click?, #focusable, #focusable=, #focusable?, #font_map, #font_map=, #font_options, #font_options=, #frame_clock, #get_allocation, #get_ancestor, #get_color, #get_preferred_size, #get_size, #get_size_request, #get_template_child, #grab_focus, #halign, #halign=, #has_css_class, #has_default, #has_default=, #has_default?, #has_focus, #has_focus=, #has_focus?, #has_tooltip, #has_tooltip=, #has_tooltip?, #has_visible_focus, #height, #height_request, #height_request=, #hexpand, #hexpand=, #hexpand?, #hexpand_set, #hexpand_set=, #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, #last_child, #layout_manager, #layout_manager=, #layout_manager_type, #layout_manager_type=, #list_mnemonic_labels, #map, #mapped, #margin_bottom, #margin_bottom=, #margin_end, #margin_end=, #margin_start, #margin_start=, #margin_top, #margin_top=, #measure, #mnemonic_activate, #name, #name=, #native, #next_sibling, #observe_children, #observe_controllers, #opacity, #opacity=, #overflow, #overflow=, #pango_context, #parent, #parent=, #pick, #prev_sibling, #primary_clipboard, #query_action, #queue_allocate, #queue_draw, #queue_resize, #realize, #realized, #receives_default, #receives_default=, #receives_default?, #remove_controller, #remove_css_class, #remove_mnemonic_label, #remove_tick_callback, #request_mode, #root, #root=, #scale_factor, #scale_factor=, #sensitive, #sensitive=, #sensitive?, #set_size_request, #set_state_flags, #settings, #should_layout, #show, #size_allocate, #snapshot_child, #state_flags, #style_context, #template=, #template_from_resource=, #template_scope=, #tooltip_markup, #tooltip_markup=, #tooltip_text, #tooltip_text=, #translate_coordinates, #trigger_tooltip_query, #unmap, #unparent, #unrealize, #unset_state_flags, #valign, #valign=, #vexpand, #vexpand=, #vexpand?, #vexpand_set, #vexpand_set=, #vexpand_set?, #visible, #visible=, #visible?, #width, #width_request, #width_request=

Constructor Details

#initialize(buffer) ⇒ Gtk::Widget

Creates a new GtkTextView widget displaying the buffer buffer.

One buffer can be shared among many widgets. buffer may be nil to create a default buffer, in which case this function is equivalent to [ctorGtk.TextView.new]. The text view adds its own reference count to the buffer; it does not take over an existing reference.

Parameters:

Instance Method Details

#accepts_tabBoolean

Returns whether pressing the Tab key inserts a tab characters.

See [methodGtk.TextView.set_accepts_tab].

Returns:

  • (Boolean)

    true if pressing the Tab key inserts a tab character, false if pressing the Tab key moves the keyboard focus.

#accepts_tab=(accepts_tab) ⇒ Boolean

Whether Tab will result in a tab character being entered.

Parameters:

  • accepts_tab (Boolean)

Returns:

  • (Boolean)

    accepts-tab

  • (Boolean)

    accepts-tab

#accepts_tab?Boolean

Whether Tab will result in a tab character being entered.

Returns:

  • (Boolean)

    accepts-tab

#add_child_at_anchor(child, anchor) ⇒ nil

Adds a child widget in the text buffer, at the given anchor.

Parameters:

Returns:

  • (nil)

#add_overlay(child, xpos, ypos) ⇒ nil

Adds child at a fixed coordinate in the GtkTextView's text window.

The xpos and ypos must be in buffer coordinates (see [methodGtk.TextView.get_iter_location] to convert to buffer coordinates).

child will scroll with the text view.

If instead you want a widget that will not move with the GtkTextView contents see GtkOverlay.

Parameters:

  • child (Gtk::Widget)

    a GtkWidget

  • xpos (Integer)

    X position of child in window coordinates

  • ypos (Integer)

    Y position of child in window coordinates

Returns:

  • (nil)

#backward_display_line(iter) ⇒ Boolean

Moves the given iter backward by one display (wrapped) line.

A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

Returns:

  • (Boolean)

    true if iter was moved and is not on the end iterator

#backward_display_line_start(iter) ⇒ Boolean

Moves the given iter backward to the next display line start.

A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

Returns:

  • (Boolean)

    true if iter was moved and is not on the end iterator

#bottom_marginInteger

The bottom margin for text in the text view.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Don't confuse this property with [propertyGtk.Widget:margin-bottom].

Returns:

  • (Integer)

    bottom-margin

#bottom_margin=(bottom_margin) ⇒ Integer

The bottom margin for text in the text view.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Don't confuse this property with [propertyGtk.Widget:margin-bottom].

Parameters:

  • bottom_margin (Integer)

Returns:

  • (Integer)

    bottom-margin

  • (Integer)

    bottom-margin

#bufferGtk::TextBuffer

The buffer which is displayed.

Returns:

#buffer=(buffer) ⇒ Gtk::TextBuffer

The buffer which is displayed.

Parameters:

Returns:

#buffer_to_window_coords(win, buffer_x, buffer_y, window_x, window_y) ⇒ nil

Converts buffer coordinates to window coordinates.

Parameters:

  • win (Gtk::TextWindowType)

    a GtkTextWindowType

  • buffer_x (Integer)

    buffer x coordinate

  • buffer_y (Integer)

    buffer y coordinate

  • window_x (Integer)

    window x coordinate return location

  • window_y (Integer)

    window y coordinate return location

Returns:

  • (nil)

#cursor_visibleBoolean

Find out whether the cursor should be displayed.

Returns:

  • (Boolean)

    whether the insertion mark is visible

#cursor_visible=(cursor_visible) ⇒ Boolean

If the insertion cursor is shown.

Parameters:

  • cursor_visible (Boolean)

Returns:

  • (Boolean)

    cursor-visible

  • (Boolean)

    cursor-visible

#cursor_visible?Boolean

If the insertion cursor is shown.

Returns:

  • (Boolean)

    cursor-visible

#editableBoolean

Returns the default editability of the GtkTextView.

Tags in the buffer may override this setting for some ranges of text.

Returns:

  • (Boolean)

    whether text is editable by default

#editable=(editable) ⇒ Boolean

Parameters:

  • editable (Boolean)

Returns:

  • (Boolean)

    editable

  • (Boolean)

    editable

#editable?Boolean

Returns editable.

Returns:

  • (Boolean)

    editable

#extra_menuGio::MenuModel

A menu model whose contents will be appended to the context menu.

Returns:

  • (Gio::MenuModel)

    extra-menu

#extra_menu=(extra_menu) ⇒ Gio::MenuModel

A menu model whose contents will be appended to the context menu.

Parameters:

  • extra_menu (Gio::MenuModel)

Returns:

  • (Gio::MenuModel)

    extra-menu

  • (Gio::MenuModel)

    extra-menu

#forward_display_line(iter) ⇒ Boolean

Moves the given iter forward by one display (wrapped) line.

A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

Returns:

  • (Boolean)

    true if iter was moved and is not on the end iterator

#forward_display_line_end(iter) ⇒ Boolean

Moves the given iter forward to the next display line end.

A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the GtkTextBuffer.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

Returns:

  • (Boolean)

    true if iter was moved and is not on the end iterator

#get_cursor_locations(iter, strong, weak) ⇒ nil

Determine the positions of the strong and weak cursors if the insertion point is at iter.

The position of each cursor is stored as a zero-width rectangle. The strong cursor location is the location where characters of the directionality equal to the base direction of the paragraph are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction of the paragraph are inserted.

If iter is nil, the actual cursor position is used.

Note that if iter happens to be the actual cursor position, and there is currently an IM preedit sequence being entered, the returned locations will be adjusted to account for the preedit cursor’s offset within the preedit sequence.

The rectangle position is in buffer coordinates; use [methodGtk.TextView.buffer_to_window_coords] to convert these coordinates to coordinates for one of the windows in the text view.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • strong (Gdk::Rectangle)

    location to store the strong cursor position

  • weak (Gdk::Rectangle)

    location to store the weak cursor position

Returns:

  • (nil)

#get_gutter(win) ⇒ Gtk::Widget

Gets a GtkWidget that has previously been set as gutter.

See [methodGtk.TextView.set_gutter].

win must be one of %GTK_TEXT_WINDOW_LEFT, %GTK_TEXT_WINDOW_RIGHT, %GTK_TEXT_WINDOW_TOP, or %GTK_TEXT_WINDOW_BOTTOM.

Parameters:

Returns:

#get_iter_at_location(iter, x, y) ⇒ Boolean

Retrieves the iterator at buffer coordinates x and y.

Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with [methodGtk.TextView.window_to_buffer_coords].

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • x (Integer)

    x position, in buffer coordinates

  • y (Integer)

    y position, in buffer coordinates

Returns:

  • (Boolean)

    true if the position is over text

#get_iter_at_position(iter, trailing, x, y) ⇒ Boolean

Retrieves the iterator pointing to the character at buffer coordinates x and y.

Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with [methodGtk.TextView.window_to_buffer_coords].

Note that this is different from [methodGtk.TextView.get_iter_at_location], which returns cursor locations, i.e. positions between characters.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • trailing (Integer)

    if non-nil, location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.

  • x (Integer)

    x position, in buffer coordinates

  • y (Integer)

    y position, in buffer coordinates

Returns:

  • (Boolean)

    true if the position is over text

#get_iter_location(iter, location) ⇒ nil

Gets a rectangle which roughly contains the character at iter.

The rectangle position is in buffer coordinates; use [methodGtk.TextView.buffer_to_window_coords] to convert these coordinates to coordinates for one of the windows in the text view.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • location (Gdk::Rectangle)

    bounds of the character at iter

Returns:

  • (nil)

#get_line_at_y(target_iter, y, line_top) ⇒ nil

Gets the GtkTextIter at the start of the line containing the coordinate y.

y is in buffer coordinates, convert from window coordinates with [methodGtk.TextView.window_to_buffer_coords]. If non-nil, line_top will be filled with the coordinate of the top edge of the line.

Parameters:

  • target_iter (Gtk::TextIter)

    a GtkTextIter

  • y (Integer)

    a y coordinate

  • line_top (Integer)

    return location for top coordinate of the line

Returns:

  • (nil)

#get_line_yrange(iter, y, height) ⇒ nil

Gets the y coordinate of the top of the line containing iter, and the height of the line.

The coordinate is a buffer coordinate; convert to window coordinates with [methodGtk.TextView.buffer_to_window_coords].

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • y (Integer)

    return location for a y coordinate

  • height (Integer)

    return location for a height

Returns:

  • (nil)

#get_visible_rect(visible_rect) ⇒ nil

Fills visible_rect with the currently-visible region of the buffer, in buffer coordinates.

Convert to window coordinates with [methodGtk.TextView.buffer_to_window_coords].

Parameters:

  • visible_rect (Gdk::Rectangle)

    rectangle to fill

Returns:

  • (nil)

#im_context_filter_keypress(event) ⇒ Boolean

Allow the GtkTextView input method to internally handle key press and release events.

If this function returns true, then no further processing should be done for this key event. See [methodGtk.IMContext.filter_keypress].

Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the GtkTextView.

static gboolean
gtk_foo_bar_key_press_event (GtkWidget *widget,
                             GdkEvent  *event)
{
  guint keyval;

  gdk_event_get_keyval ((GdkEvent*)event, &keyval);

  if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter)
    {
      if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event))
        return TRUE;
    }

  // Do some stuff

  return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event);
}

Parameters:

  • event (Gdk::Event)

    the key event

Returns:

  • (Boolean)

    true if the input method handled the key event.

#im_moduleString

Which IM (input method) module should be used for this text_view.

See [classGtk.IMMulticontext].

Setting this to a non-nil value overrides the system-wide IM module setting. See the GtkSettings [propertyGtk.Settings:gtk-im-module] property.

Returns:

  • (String)

    im-module

#im_module=(im_module) ⇒ String

Which IM (input method) module should be used for this text_view.

See [classGtk.IMMulticontext].

Setting this to a non-nil value overrides the system-wide IM module setting. See the GtkSettings [propertyGtk.Settings:gtk-im-module] property.

Parameters:

  • im_module (String)

Returns:

  • (String)

    im-module

  • (String)

    im-module

#indentInteger

Amount to indent the paragraph, in pixels.

A negative value of indent will produce a hanging indentation. That is, the first line will have the full width, and subsequent lines will be indented by the absolute value of indent.

Returns:

  • (Integer)

    indent

#indent=(indent) ⇒ Integer

Amount to indent the paragraph, in pixels.

A negative value of indent will produce a hanging indentation. That is, the first line will have the full width, and subsequent lines will be indented by the absolute value of indent.

Parameters:

  • indent (Integer)

Returns:

  • (Integer)

    indent

  • (Integer)

    indent

#input_hintsGtk::InputHints

Additional hints (beyond [propertyGtk.TextView:input-purpose]) that allow input methods to fine-tune their behaviour.

Returns:

#input_hints=(input_hints) ⇒ Gtk::InputHints

Additional hints (beyond [propertyGtk.TextView:input-purpose]) that allow input methods to fine-tune their behaviour.

Parameters:

Returns:

#input_purposeGtk::InputPurpose

The purpose of this text field.

This property can be used by on-screen keyboards and other input methods to adjust their behaviour.

Returns:

#input_purpose=(input_purpose) ⇒ Gtk::InputPurpose

The purpose of this text field.

This property can be used by on-screen keyboards and other input methods to adjust their behaviour.

Parameters:

Returns:

#justificationGtk::Justification

Returns justification.

Returns:

#justification=(justification) ⇒ Gtk::Justification

Parameters:

Returns:

#left_marginInteger

The default left margin for text in the text view.

Tags in the buffer may override the default.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Returns:

  • (Integer)

    left-margin

#left_margin=(left_margin) ⇒ Integer

The default left margin for text in the text view.

Tags in the buffer may override the default.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Parameters:

  • left_margin (Integer)

Returns:

  • (Integer)

    left-margin

  • (Integer)

    left-margin

#ltr_contextPango::Context

Gets the PangoContext that is used for rendering LTR directed text layouts.

The context may be replaced when CSS changes occur.

Returns:

  • (Pango::Context)

    a PangoContext

#monospaceBoolean

Gets whether the GtkTextView uses monospace styling.

Returns:

  • (Boolean)

    true if monospace fonts are desired

#monospace=(monospace) ⇒ Boolean

Whether text should be displayed in a monospace font.

If true, set the .monospace style class on the text view to indicate that a monospace font is desired.

Parameters:

  • monospace (Boolean)

Returns:

  • (Boolean)

    monospace

  • (Boolean)

    monospace

#monospace?Boolean

Whether text should be displayed in a monospace font.

If true, set the .monospace style class on the text view to indicate that a monospace font is desired.

Returns:

  • (Boolean)

    monospace

#move_mark_onscreen(mark) ⇒ Boolean

Moves a mark within the buffer so that it's located within the currently-visible text area.

Parameters:

Returns:

  • (Boolean)

    true if the mark moved (wasn’t already onscreen)

#move_overlay(child, xpos, ypos) ⇒ nil

Updates the position of a child.

See [methodGtk.TextView.add_overlay].

Parameters:

  • child (Gtk::Widget)

    a widget already added with [methodGtk.TextView.add_overlay]

  • xpos (Integer)

    new X position in buffer coordinates

  • ypos (Integer)

    new Y position in buffer coordinates

Returns:

  • (nil)

#move_visually(iter, count) ⇒ Boolean

Move the iterator a given number of characters visually, treating it as the strong cursor position.

If count is positive, then the new strong cursor position will be count positions to the right of the old cursor position. If count is negative then the new strong cursor position will be count positions to the left of the old cursor position.

In the presence of bi-directional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off of the end of a run.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • count (Integer)

    number of characters to move (negative moves left, positive moves right)

Returns:

  • (Boolean)

    true if iter moved and is not on the end iterator

#overwriteBoolean

Returns whether the GtkTextView is in overwrite mode or not.

Returns:

  • (Boolean)

    whether text_view is in overwrite mode or not.

#overwrite=(overwrite) ⇒ Boolean

Whether entered text overwrites existing contents.

Parameters:

  • overwrite (Boolean)

Returns:

  • (Boolean)

    overwrite

  • (Boolean)

    overwrite

#overwrite?Boolean

Whether entered text overwrites existing contents.

Returns:

  • (Boolean)

    overwrite

#pixels_above_linesInteger

Returns pixels-above-lines.

Returns:

  • (Integer)

    pixels-above-lines

#pixels_above_lines=(pixels_above_lines) ⇒ Integer

Parameters:

  • pixels_above_lines (Integer)

Returns:

  • (Integer)

    pixels-above-lines

  • (Integer)

    pixels-above-lines

#pixels_below_linesInteger

Returns pixels-below-lines.

Returns:

  • (Integer)

    pixels-below-lines

#pixels_below_lines=(pixels_below_lines) ⇒ Integer

Parameters:

  • pixels_below_lines (Integer)

Returns:

  • (Integer)

    pixels-below-lines

  • (Integer)

    pixels-below-lines

#pixels_inside_wrapInteger

Returns pixels-inside-wrap.

Returns:

  • (Integer)

    pixels-inside-wrap

#pixels_inside_wrap=(pixels_inside_wrap) ⇒ Integer

Parameters:

  • pixels_inside_wrap (Integer)

Returns:

  • (Integer)

    pixels-inside-wrap

  • (Integer)

    pixels-inside-wrap

#place_cursor_onscreenBoolean

Moves the cursor to the currently visible region of the buffer.

Returns:

  • (Boolean)

    true if the cursor had to be moved.

#remove(child) ⇒ nil

Removes a child widget from text_view.

Parameters:

Returns:

  • (nil)

Ensures that the cursor is shown.

This also resets the time that it will stay blinking (or visible, in case blinking is disabled).

This function should be called in response to user input (e.g. from derived classes that override the textview's event handlers).

Returns:

  • (nil)

#reset_im_contextnil

Reset the input method context of the text view if needed.

This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.

Returns:

  • (nil)

#right_marginInteger

The default right margin for text in the text view.

Tags in the buffer may override the default.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Returns:

  • (Integer)

    right-margin

#right_margin=(right_margin) ⇒ Integer

The default right margin for text in the text view.

Tags in the buffer may override the default.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Parameters:

  • right_margin (Integer)

Returns:

  • (Integer)

    right-margin

  • (Integer)

    right-margin

#rtl_contextPango::Context

Gets the PangoContext that is used for rendering RTL directed text layouts.

The context may be replaced when CSS changes occur.

Returns:

  • (Pango::Context)

    a PangoContext

#scroll_mark_onscreen(mark) ⇒ nil

Scrolls text_view the minimum distance such that mark is contained within the visible area of the widget.

Parameters:

Returns:

  • (nil)

#scroll_to_iter(iter, within_margin, use_align, xalign, yalign) ⇒ Boolean

Scrolls text_view so that iter is on the screen in the position indicated by xalign and yalign.

An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is false, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin.

Note that this function uses the currently-computed height of the lines in the text buffer. Line heights are computed in an idle handler; so this function may not have the desired effect if it’s called before the height computations. To avoid oddness, consider using [methodGtk.TextView.scroll_to_mark] which saves a point to be scrolled to after line validation.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

  • within_margin (Float)

    margin as a [0.0,0.5) fraction of screen size

  • use_align (Boolean)

    whether to use alignment arguments (if false, just get the mark onscreen)

  • xalign (Float)

    horizontal alignment of mark within visible area

  • yalign (Float)

    vertical alignment of mark within visible area

Returns:

  • (Boolean)

    true if scrolling occurred

#scroll_to_mark(mark, within_margin, use_align, xalign, yalign) ⇒ nil

Scrolls text_view so that mark is on the screen in the position indicated by xalign and yalign.

An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If use_align is false, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of size within_margin.

Parameters:

  • mark (Gtk::TextMark)

    a GtkTextMark

  • within_margin (Float)

    margin as a [0.0,0.5) fraction of screen size

  • use_align (Boolean)

    whether to use alignment arguments (if false, just get the mark onscreen)

  • xalign (Float)

    horizontal alignment of mark within visible area

  • yalign (Float)

    vertical alignment of mark within visible area

Returns:

  • (nil)

#set_gutter(win, widget) ⇒ nil

Places widget into the gutter specified by win.

win must be one of %GTK_TEXT_WINDOW_LEFT, %GTK_TEXT_WINDOW_RIGHT, %GTK_TEXT_WINDOW_TOP, or %GTK_TEXT_WINDOW_BOTTOM.

Parameters:

Returns:

  • (nil)

#starts_display_line(iter) ⇒ Boolean

Determines whether iter is at the start of a display line.

See [methodGtk.TextView.forward_display_line] for an explanation of display lines vs. paragraphs.

Parameters:

  • iter (Gtk::TextIter)

    a GtkTextIter

Returns:

  • (Boolean)

    true if iter begins a wrapped line

#tabsPango::TabArray

Returns tabs.

Returns:

  • (Pango::TabArray)

    tabs

#tabs=(tabs) ⇒ Pango::TabArray

Parameters:

  • tabs (Pango::TabArray)

Returns:

  • (Pango::TabArray)

    tabs

  • (Pango::TabArray)

    tabs

#top_marginInteger

The top margin for text in the text view.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Don't confuse this property with [propertyGtk.Widget:margin-top].

Returns:

  • (Integer)

    top-margin

#top_margin=(top_margin) ⇒ Integer

The top margin for text in the text view.

Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme.

Don't confuse this property with [propertyGtk.Widget:margin-top].

Parameters:

  • top_margin (Integer)

Returns:

  • (Integer)

    top-margin

  • (Integer)

    top-margin

#window_to_buffer_coords(win, window_x, window_y, buffer_x, buffer_y) ⇒ nil

Converts coordinates on the window identified by win to buffer coordinates.

Parameters:

  • win (Gtk::TextWindowType)

    a GtkTextWindowType

  • window_x (Integer)

    window x coordinate

  • window_y (Integer)

    window y coordinate

  • buffer_x (Integer)

    buffer x coordinate return location

  • buffer_y (Integer)

    buffer y coordinate return location

Returns:

  • (nil)

#wrap_modeGtk::WrapMode

Returns wrap-mode.

Returns:

#wrap_mode=(wrap_mode) ⇒ Gtk::WrapMode

Parameters:

Returns: