About all my projects
Gnome::Gtk4::TextView

Gnome::Gtk4::TextView

Description

A widget that displays the contents of a Gnome::Gtk4::TextBuffer.

No caption

You may wish to begin by reading the [conceptual overview](section-text-widget.html), which gives an overview of all the objects and data types related to the text widget and how they work together.

CSS nodes

Gnome::Gtk4::TextView has a main css node with name textview and style class .view, and subnodes for each of the border windows, and the main text area, with names border and text, respectively. The border nodes each get one of the style classes .left, .right, .top or .bottom.

A node representing the selection will appear below the text node.

If a context menu is opened, the window node will appear as a subnode of the main node.

Accessibility

Gnome::Gtk4::TextView uses the GTK_ACCESSIBLE_ROLE_TEXT_BOX role.

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-textview

Creates a new Gnome::Gtk4::TextView.

If you don’t call .set-buffer() before using the text view, an empty default buffer will be created for you. Get the buffer with .get-buffer(). If you want to specify your own buffer, consider .new-with-buffer().

method new-textview ( --> Gnome::Gtk4::TextView \)

new-with-buffer

Creates a new Gnome::Gtk4::TextView widget displaying the buffer $buffer.

One buffer can be shared among many widgets. $buffer may be undefined to create a default buffer, in which case this function is equivalent to .newtextview(). The text view adds its own reference count to the buffer; it does not take over an existing reference.

method new-with-buffer ( N-Object() $buffer --> Gnome::Gtk4::TextView \)
  • $buffer; a Gnome::Gtk4::TextBuffer.

Methods

add-child-at-anchor

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

method add-child-at-anchor ( N-Object() $child, N-Object() $anchor )
  • $child; a Gnome::Gtk4::Widget.

  • $anchor; a Gnome::Gtk4::TextChildAnchor in the Gnome::Gtk4::TextBuffer for $text-view.

add-overlay

Adds $child at a fixed coordinate in the Gnome::Gtk4::TextView's text window.

The $xpos and $ypos must be in buffer coordinates (see .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 Gnome::Gtk4::TextView contents see Gnome::Gtk4::Overlay.

method add-overlay ( N-Object() $child, Int() $xpos, Int() $ypos )
  • $child; a Gnome::Gtk4::Widget.

  • $xpos; X position of child in window coordinates.

  • $ypos; Y position of child in window coordinates.

backward-display-line

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 Gnome::Gtk4::TextBuffer.

method backward-display-line ( N-Object $iter --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

Return value; True if $iter was moved and is not on the end iterator.

backward-display-line-start

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 Gnome::Gtk4::TextBuffer.

method backward-display-line-start ( N-Object $iter --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

Return value; True if $iter was moved and is not on the end iterator.

buffer-to-window-coords

Converts buffer coordinates to window coordinates.

method buffer-to-window-coords ( GtkTextWindowType $win, Int() $buffer-x, Int() $buffer-y, Array[Int] $window-x, Array[Int] $window-y )
  • $win; a enumeration GtkTextWindowType defined in Gnome::Gtk4::T-textview.

  • $buffer-x; buffer x coordinate.

  • $buffer-y; buffer y coordinate.

  • $window-x; (transfer ownership: full) window x coordinate return location.

  • $window-y; (transfer ownership: full) window y coordinate return location.

forward-display-line

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 Gnome::Gtk4::TextBuffer.

method forward-display-line ( N-Object $iter --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

Return value; True if $iter was moved and is not on the end iterator.

forward-display-line-end

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 Gnome::Gtk4::TextBuffer.

method forward-display-line-end ( N-Object $iter --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

Return value; True if $iter was moved and is not on the end iterator.

get-accepts-tab

Returns whether pressing the <kbd>Tab</kbd> key inserts a tab characters.

See .set-accepts-tab().

method get-accepts-tab (--> Bool )

Return value; True if pressing the Tab key inserts a tab character, False if pressing the Tab key moves the keyboard focus..

get-bottom-margin

Gets the bottom margin for text in the $text-view.

method get-bottom-margin (--> Int )

Return value; bottom margin in pixels.

get-buffer

Returns the Gnome::Gtk4::TextBuffer being displayed by this text view.

The reference count on the buffer is not incremented; the caller of this function won’t own a new reference.

method get-buffer (--> N-Object )

Return value; a Gnome::Gtk4::TextBuffer.

get-cursor-locations

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 undefined, 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 .buffer-to-window-coords() to convert these coordinates to coordinates for one of the windows in the text view.

method get-cursor-locations ( N-Object $iter, N-Object $strong, N-Object $weak )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $strong; location to store the strong cursor position

  • $weak; location to store the weak cursor position

get-cursor-visible

Find out whether the cursor should be displayed.

method get-cursor-visible (--> Bool )

Return value; whether the insertion mark is visible.

get-editable

Returns the default editability of the Gnome::Gtk4::TextView.

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

method get-editable (--> Bool )

Return value; whether text is editable by default.

get-extra-menu

Gets the menu model that gets added to the context menu or undefined if none has been set.

method get-extra-menu (--> N-Object )

Return value; the menu model.

get-gutter

Gets a Gnome::Gtk4::Widget that has previously been set as gutter.

See .set-gutter(). $win must be one of GTK_TEXT_WINDOW_LEFT, GTK_TEXT_WINDOW_RIGHT, GTK_TEXT_WINDOW_TOP, or GTK_TEXT_WINDOW_BOTTOM.

method get-gutter ( GtkTextWindowType $win --> N-Object )
  • $win; a enumeration GtkTextWindowType defined in Gnome::Gtk4::T-textview.

Return value; a Gnome::Gtk4::Widget.

get-indent

Gets the default indentation of paragraphs in $text-view.

Tags in the view’s buffer may override the default. The indentation may be negative.

method get-indent (--> Int )

Return value; number of pixels of indentation.

get-input-hints

Gets the input-hints` of the Gnome::Gtk4::TextView.

method get-input-hints (--> UInt )

Return value; No documentation about its value and use.

get-input-purpose

Gets the input-purpose` of the Gnome::Gtk4::TextView.

method get-input-purpose (--> GtkInputPurpose )

Return value; No documentation about its value and use.

get-iter-at-location

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 .window-to-buffer-coords().

method get-iter-at-location ( N-Object $iter, Int() $x, Int() $y --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $x; x position, in buffer coordinates.

  • $y; y position, in buffer coordinates.

Return value; True if the position is over text.

get-iter-at-position

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 .window-to-buffer-coords().

Note that this is different from .get-iter-at-location(), which returns cursor locations, i.e. positions between characters.

method get-iter-at-position ( N-Object $iter, Array[Int] $trailing, Int() $x, Int() $y --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $trailing; (transfer ownership: full) if non-undefined, 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; x position, in buffer coordinates.

  • $y; y position, in buffer coordinates.

Return value; True if the position is over text.

get-iter-location

Gets a rectangle which roughly contains the character at $iter.

The rectangle position is in buffer coordinates; use .buffer-to-window-coords() to convert these coordinates to coordinates for one of the windows in the text view.

method get-iter-location ( N-Object $iter, N-Object $location )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $location; bounds of the character at $iter

get-justification

Gets the default justification of paragraphs in $text-view.

Tags in the buffer may override the default.

method get-justification (--> GtkJustification )

Return value; default justification.

get-left-margin

Gets the default left margin size of paragraphs in the $text-view.

Tags in the buffer may override the default.

method get-left-margin (--> Int )

Return value; left margin in pixels.

get-line-at-y

Gets the Gnome::Gtk4::N-TextIter at the start of the line containing the coordinate $y. $y is in buffer coordinates, convert from window coordinates with .window-to-buffer-coords(). If non-undefined, $line-top will be filled with the coordinate of the top edge of the line.

method get-line-at-y ( N-Object $target-iter, Int() $y, Array[Int] $line-top )
  • $target-iter; a Gnome::Gtk4::N-TextIter

  • $y; a y coordinate.

  • $line-top; (transfer ownership: full) return location for top coordinate of the line.

get-line-yrange

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 .buffer-to-window-coords().

method get-line-yrange ( N-Object $iter, Array[Int] $y, Array[Int] $height )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $y; (transfer ownership: full) return location for a y coordinate.

  • $height; (transfer ownership: full) return location for a height.

get-ltr-context

Gets the Gnome::Pango::Context that is used for rendering LTR directed text layouts.

The context may be replaced when CSS changes occur.

method get-ltr-context (--> N-Object )

Return value; a Gnome::Pango::Context.

get-monospace

Gets whether the Gnome::Gtk4::TextView uses monospace styling.

method get-monospace (--> Bool )

Return value; True if monospace fonts are desired.

get-overwrite

Returns whether the Gnome::Gtk4::TextView is in overwrite mode or not.

method get-overwrite (--> Bool )

Return value; whether $text-view is in overwrite mode or not..

get-pixels-above-lines

Gets the default number of pixels to put above paragraphs.

Adding this function with .get-pixels-below-lines() is equal to the line space between each paragraph.

method get-pixels-above-lines (--> Int )

Return value; default number of pixels above paragraphs.

get-pixels-below-lines

Gets the default number of pixels to put below paragraphs.

The line space is the sum of the value returned by this function and the value returned by .get-pixels-above-lines().

method get-pixels-below-lines (--> Int )

Return value; default number of blank pixels below paragraphs.

get-pixels-inside-wrap

Gets the default number of pixels to put between wrapped lines inside a paragraph.

method get-pixels-inside-wrap (--> Int )

Return value; default number of pixels of blank space between wrapped lines.

get-right-margin

Gets the default right margin for text in $text-view.

Tags in the buffer may override the default.

method get-right-margin (--> Int )

Return value; right margin in pixels.

get-rtl-context

Gets the Gnome::Pango::Context that is used for rendering RTL directed text layouts.

The context may be replaced when CSS changes occur.

method get-rtl-context (--> N-Object )

Return value; a Gnome::Pango::Context.

get-tabs

Gets the default tabs for $text-view.

Tags in the buffer may override the defaults. The returned array will be undefined if “standard” (8-space) tabs are used. Free the return value with .free() in class Gnome::Pango::N-TabArray.

method get-tabs (--> N-Object )

Return value; copy of default tab array, or undefined if standard tabs are used; must be freed with .free() in class Gnome::Pango::N-TabArray..

get-top-margin

Gets the top margin for text in the $text-view.

method get-top-margin (--> Int )

Return value; top margin in pixels.

get-visible-rect

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

Convert to window coordinates with .buffer-to-window-coords().

method get-visible-rect ( N-Object $visible-rect )
  • $visible-rect; rectangle to fill

get-wrap-mode

Gets the line wrapping for the view.

method get-wrap-mode (--> GtkWrapMode )

Return value; the line wrap setting.

im-context-filter-keypress

Allow the Gnome::Gtk4::TextView 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 .filter-keypress() in class Gnome::Gtk4::IMContext.

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 Gnome::Gtk4::TextView.

method im-context-filter-keypress ( N-Object() $event --> Bool )
  • $event; the key event.

Return value; True if the input method handled the key event..

move-mark-onscreen

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

method move-mark-onscreen ( N-Object() $mark --> Bool )
  • $mark; a Gnome::Gtk4::TextMark.

Return value; True if the mark moved (wasn’t already onscreen).

move-overlay

Updates the position of a child.

See .add-overlay().

method move-overlay ( N-Object() $child, Int() $xpos, Int() $ypos )
  • $child; a widget already added with .add-overlay().

  • $xpos; new X position in buffer coordinates.

  • $ypos; new Y position in buffer coordinates.

move-visually

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.

method move-visually ( N-Object $iter, Int() $count --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $count; number of characters to move (negative moves left, positive moves right).

Return value; True if $iter moved and is not on the end iterator.

place-cursor-onscreen

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

method place-cursor-onscreen (--> Bool )

Return value; True if the cursor had to be moved..

remove

Removes a child widget from $text-view.

method remove ( N-Object() $child )
  • $child; the child to remove.

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).

method reset-cursor-blink ( )

reset-im-context

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.

method reset-im-context ( )

scroll-mark-onscreen

Scrolls $text-view the minimum distance such that $mark is contained within the visible area of the widget.

method scroll-mark-onscreen ( N-Object() $mark )
  • $mark; a mark in the buffer for $text-view.

scroll-to-iter

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 .scroll-to-mark() which saves a point to be scrolled to after line validation.

method scroll-to-iter ( N-Object $iter, Num() $within-margin, Bool() $use-align, Num() $xalign, Num() $yalign --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

  • $within-margin; margin as a [0.0,0.5) fraction of screen size.

  • $use-align; whether to use alignment arguments (if False, just get the mark onscreen).

  • $xalign; horizontal alignment of mark within visible area.

  • $yalign; vertical alignment of mark within visible area.

Return value; True if scrolling occurred.

scroll-to-mark

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.

method scroll-to-mark ( N-Object() $mark, Num() $within-margin, Bool() $use-align, Num() $xalign, Num() $yalign )
  • $mark; a Gnome::Gtk4::TextMark.

  • $within-margin; margin as a [0.0,0.5) fraction of screen size.

  • $use-align; whether to use alignment arguments (if False, just get the mark onscreen).

  • $xalign; horizontal alignment of mark within visible area.

  • $yalign; vertical alignment of mark within visible area.

set-accepts-tab

Sets the behavior of the text widget when the <kbd>Tab</kbd> key is pressed.

If $accepts-tab is True, a tab character is inserted. If $accepts-tab is False the keyboard focus is moved to the next widget in the focus chain.

Focus can always be moved using <kbd>Ctrl</kbd>+<kbd>Tab</kbd>.

method set-accepts-tab ( Bool() $accepts-tab )
  • $accepts-tab; True if pressing the Tab key should insert a tab character, False, if pressing the Tab key should move the keyboard focus..

set-bottom-margin

Sets the bottom margin for text in $text-view.

Note that this function is confusingly named. In CSS terms, the value set here is padding.

method set-bottom-margin ( Int() $bottom-margin )
  • $bottom-margin; bottom margin in pixels.

set-buffer

Sets $buffer as the buffer being displayed by $text-view.

The previous buffer displayed by the text view is unreferenced, and a reference is added to $buffer. If you owned a reference to $buffer before passing it to this function, you must remove that reference yourself; Gnome::Gtk4::TextView will not “adopt” it.

method set-buffer ( N-Object() $buffer )
  • $buffer; a Gnome::Gtk4::TextBuffer.

set-cursor-visible

Toggles whether the insertion point should be displayed.

A buffer with no editable text probably shouldn’t have a visible cursor, so you may want to turn the cursor off.

Note that this property may be overridden by the gtk-keynav-use-caret defined in Gnome::Gtk4::Settings setting.

method set-cursor-visible ( Bool() $setting )
  • $setting; whether to show the insertion cursor.

set-editable

Sets the default editability of the Gnome::Gtk4::TextView.

You can override this default setting with tags in the buffer, using the “editable” attribute of tags.

method set-editable ( Bool() $setting )
  • $setting; whether it’s editable.

set-extra-menu

Sets a menu model to add when constructing the context menu for $text-view.

You can pass undefined to remove a previously set extra menu.

method set-extra-menu ( N-Object() $model )
  • $model; a Gnome::Gio::MenuModel.

set-gutter

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.

method set-gutter ( GtkTextWindowType $win, N-Object() $widget )
  • $win; a enumeration GtkTextWindowType defined in Gnome::Gtk4::T-textview.

  • $widget; a Gnome::Gtk4::Widget.

set-indent

Sets the default indentation for paragraphs in $text-view.

Tags in the buffer may override the default.

method set-indent ( Int() $indent )
  • $indent; indentation in pixels.

set-input-hints

Sets the input-hints` of the Gnome::Gtk4::TextView.

The input-hints` allow input methods to fine-tune their behaviour.

method set-input-hints ( UInt $hints )
  • $hints; the hints.

set-input-purpose

Sets the input-purpose` of the Gnome::Gtk4::TextView.

The input-purpose` can be used by on-screen keyboards and other input methods to adjust their behaviour.

method set-input-purpose ( GtkInputPurpose $purpose )
  • $purpose; the purpose.

set-justification

Sets the default justification of text in $text-view.

Tags in the view’s buffer may override the default.

method set-justification ( GtkJustification $justification )
  • $justification; justification.

set-left-margin

Sets the default left margin for text in $text-view.

Tags in the buffer may override the default.

Note that this function is confusingly named. In CSS terms, the value set here is padding.

method set-left-margin ( Int() $left-margin )
  • $left-margin; left margin in pixels.

set-monospace

Sets whether the Gnome::Gtk4::TextView should display text in monospace styling.

method set-monospace ( Bool() $monospace )
  • $monospace; True to request monospace styling.

set-overwrite

Changes the Gnome::Gtk4::TextView overwrite mode.

method set-overwrite ( Bool() $overwrite )
  • $overwrite; True to turn on overwrite mode, False to turn it off.

set-pixels-above-lines

Sets the default number of blank pixels above paragraphs in $text-view.

Tags in the buffer for $text-view may override the defaults.

method set-pixels-above-lines ( Int() $pixels-above-lines )
  • $pixels-above-lines; pixels above paragraphs.

set-pixels-below-lines

Sets the default number of pixels of blank space to put below paragraphs in $text-view.

May be overridden by tags applied to $text-view’s buffer.

method set-pixels-below-lines ( Int() $pixels-below-lines )
  • $pixels-below-lines; pixels below paragraphs.

set-pixels-inside-wrap

Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph.

May be overridden by tags in $text-view’s buffer.

method set-pixels-inside-wrap ( Int() $pixels-inside-wrap )
  • $pixels-inside-wrap; default number of pixels between wrapped lines.

set-right-margin

Sets the default right margin for text in the text view.

Tags in the buffer may override the default.

Note that this function is confusingly named. In CSS terms, the value set here is padding.

method set-right-margin ( Int() $right-margin )
  • $right-margin; right margin in pixels.

set-tabs

Sets the default tab stops for paragraphs in $text-view.

Tags in the buffer may override the default.

method set-tabs ( N-Object $tabs )
  • $tabs; tabs as a Gnome::Pango::N-TabArray

set-top-margin

Sets the top margin for text in $text-view.

Note that this function is confusingly named. In CSS terms, the value set here is padding.

method set-top-margin ( Int() $top-margin )
  • $top-margin; top margin in pixels.

set-wrap-mode

Sets the line wrapping for the view.

method set-wrap-mode ( GtkWrapMode $wrap-mode )
  • $wrap-mode; a enumeration GtkWrapMode defined in Gnome::Gtk4::T-enums.

starts-display-line

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

See .forward-display-line() for an explanation of display lines vs. paragraphs.

method starts-display-line ( N-Object $iter --> Bool )
  • $iter; a Gnome::Gtk4::N-TextIter

Return value; True if $iter begins a wrapped line.

window-to-buffer-coords

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

method window-to-buffer-coords ( GtkTextWindowType $win, Int() $window-x, Int() $window-y, Array[Int] $buffer-x, Array[Int] $buffer-y )
  • $win; a enumeration GtkTextWindowType defined in Gnome::Gtk4::T-textview.

  • $window-x; window x coordinate.

  • $window-y; window y coordinate.

  • $buffer-x; (transfer ownership: full) buffer x coordinate return location.

  • $buffer-y; (transfer ownership: full) buffer y coordinate return location.

Signals

backspace

Gets emitted when the user asks for it.

The backspace signal is a [keybinding signal](class.SignalAction.html).

The default bindings for this signal are <kbd>Backspace</kbd> and <kbd>Shift</kbd>+<kbd>Backspace</kbd>.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

copy-clipboard

Gets emitted to copy the selection to the clipboard.

The copy-clipboard signal is a [keybinding signal](class.SignalAction.html).

The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>c</kbd> and <kbd>Ctrl</kbd>+<kbd>Insert</kbd>.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

cut-clipboard

Gets emitted to cut the selection to the clipboard.

The cut-clipboard signal is a [keybinding signal](class.SignalAction.html).

The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>x</kbd> and <kbd>Shift</kbd>+<kbd>Delete</kbd>.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

delete-from-cursor

Gets emitted when the user initiates a text deletion.

The delete-from-cursor signal is a [keybinding signal](class.SignalAction.html).

If the $type is GTK_DELETE_CHARS, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters.

The default bindings for this signal are <kbd>Delete</kbd> for deleting a character, <kbd>Ctrl</kbd>+<kbd>Delete</kbd> for deleting a word and <kbd>Ctrl</kbd>+<kbd>Backspace</kbd> for deleting a word backwards.

method handler (
   $type,
  gint $count,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $type; the granularity of the deletion, as a enumeration GtkDeleteType defined in Gnome::Gtk4::T-enums.

  • $count; the number of $type units to delete.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

extend-selection

Emitted when the selection needs to be extended at $location.

method handler (
   $granularity,
  N-Object $location,
  N-Object $start,
  N-Object $end,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
  --> gboolean
)
  • $granularity; the granularity type.

  • $location; the location where to extend the selection.

  • $start; where the selection should start.

  • $end; where the selection should end.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

Return value; GDK_EVENT_STOP to stop other handlers from being invoked for the event. GDK_EVENT_PROPAGATE to propagate the event further.

insert-at-cursor

Gets emitted when the user initiates the insertion of a fixed string at the cursor.

The insert-at-cursor signal is a [keybinding signal](class.SignalAction.html).

This signal has no default bindings.

method handler (
  Str $string,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $string; the string to insert.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

insert-emoji

Gets emitted to present the Emoji chooser for the $text-view.

The insert-emoji signal is a [keybinding signal](class.SignalAction.html).

The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>.</kbd> and <kbd>Ctrl</kbd>+<kbd>;</kbd>

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

move-cursor

Gets emitted when the user initiates a cursor movement.

The move-cursor signal is a [keybinding signal](class.SignalAction.html). If the cursor is not visible in $text-view, this signal causes the viewport to be moved instead.

Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.

The default bindings for this signal come in two variants, the variant with the <kbd>Shift</kbd> modifier extends the selection, the variant without it does not. There are too many key combinations to list them all here.

  • <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd> move by individual characters/lines

  • <kbd>Ctrl</kbd>+<kbd>←</kbd>, etc. move by words/paragraphs

  • <kbd>Home</kbd> and <kbd>End</kbd> move to the ends of the buffer

  • <kbd>PgUp</kbd> and <kbd>PgDn</kbd> move vertically by pages

  • <kbd>Ctrl</kbd>+<kbd>PgUp</kbd> and <kbd>Ctrl</kbd>+<kbd>PgDn</kbd> move horizontally by pages

method handler (
   $step,
  gint $count,
  gboolean $extend-selection,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $step; the granularity of the move, as a enumeration GtkMovementStep defined in Gnome::Gtk4::T-enums.

  • $count; the number of $step units to move.

  • $extend-selection; True if the move should extend the selection.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

move-viewport

Gets emitted to move the viewport.

The move-viewport signal is a [keybinding signal](class.SignalAction.html), which can be bound to key combinations to allow the user to move the viewport, i.e. change what part of the text view is visible in a containing scrolled window.

There are no default bindings for this signal.

method handler (
   $step,
  gint $count,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $step; the granularity of the movement, as a enumeration GtkScrollStep defined in Gnome::Gtk4::T-enums.

  • $count; the number of $step units to move.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

paste-clipboard

Gets emitted to paste the contents of the clipboard into the text view.

The paste-clipboard signal is a [keybinding signal](class.SignalAction.html).

The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>Shift</kbd>+<kbd>Insert</kbd>.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

preedit-changed

Emitted when preedit text of the active IM changes.

If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.

This signal is only emitted if the text at the given position is actually editable.

method handler (
  Str $preedit,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $preedit; the current preedit string.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

select-all

Gets emitted to select or unselect the complete contents of the text view.

The select-all signal is a [keybinding signal](class.SignalAction.html).

The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>a</kbd> and <kbd>Ctrl</kbd>+<kbd>/</kbd> for selecting and <kbd>Shift</kbd>+<kbd>Ctrl</kbd>+<kbd>a</kbd> and <kbd>Ctrl</kbd>+<kbd>\</kbd> for unselecting.

method handler (
  gboolean $select,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $select; True to select, False to unselect.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

set-anchor

Gets emitted when the user initiates settings the "anchor" mark.

The set-anchor signal is a [keybinding signal](class.SignalAction.html) which gets emitted when the user initiates setting the "anchor" mark. The "anchor" mark gets placed at the same position as the "insert" mark.

This signal has no default bindings.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

toggle-cursor-visible

Gets emitted to toggle the cursor-visible` property.

The toggle-cursor-visible signal is a [keybinding signal](class.SignalAction.html).

The default binding for this signal is <kbd>F7</kbd>.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

toggle-overwrite

Gets emitted to toggle the overwrite mode of the text view.

The toggle-overwrite signal is a [keybinding signal](class.SignalAction.html).

The default binding for this signal is <kbd>Insert</kbd>.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::TextView :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::TextView object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.