Editors are the primary way of manipulating Buffers. They’re graphical editing components which display the contents of a buffer visually and lets the user manipulate them. An editor always contains a buffer, and is typically always shown to the user.
See also:
Contains a Chunk representing the currently active text block. If no selection is present, the chunk contains the entire buffer. With a selection present, the chunk spans the current selection.
Contains a list of the currently active lines. If no selection is present, this will contain one element, the current line. With a selection present, this holds all Lines included in the current selection.
Contains the current Buffer.
Assigning another buffer to this property would cause that buffer to be
displayed in the editor, and would cause the before-buffer-switch
and
after-buffer-switch
signals to be emitted.
A Cursor instance for the particular editor. Can be used to access and manipulate the cursor.
A boolean controlling whether the line containing the cursor is highlighted.
Note that this is typically controlled via the cursor_line_highlighted
configuration variable instead of being set explicitly for an editor instance.
Contains the currently active context, i.e. the context for the current cursor position. Read-only.
Contains the currently active line, i.e. the line that the cursor is currently positioned on. Read-only.
A boolean controlling whether the editor shows a horizontal scrollbar or not.
Note that this is typically controlled via the horizontal_scrollbar
configuration variable instead of being set explicitly for an editor instance.
Controls how indentation guides are shown for the particular editor. Valid values are (strings):
none
: No indentation guides are shownreal
: Indentation guides are shown inside real indentation white spaceon
: Indentation guides are shownNote that this is typically controlled via the indentation_guides
configuration variable instead of being set explicitly for an editor instance.
A table of “indicators” for the current editor. An error is raised if you try to access an unknown indicator (see register_indicator for more information).
Example of modifying an existing indicator from a key handler:
howl.bindings.push { editor: { shift_i: (editor) -> editor.indicator.vi.label = 'My interesting VI info text' } }
A boolean controlling whether the editor shows line number to the left of the text or not.
Note that this is typically controlled via the line_numbers
configuration
variable instead of being set explicitly for an editor instance.
Controls how line wrapping is performed. Valid values are (strings):
none
: Lines are not wrappedword
: Lines are wrapped on word boundariescharacter
: Lines are wrapped on character boundariesNote that this is typically controlled via the line_wrapping
configuration
variable instead of being set explicitly for an editor instance.
Holds the number of lines currently visible on the screen. Read-only.
A boolean indicating whether typing inserts new characters in the .buffer or overwrites them.
A Searcher instance for the particular editor. Can be used to initialize and manipulate searches for the containing editor.
A Selection instance for the particular editor. Can be used to access and manipulate the selection.
A boolean controlling whether the editor shows a vertical scrollbar or not.
Note that this is typically controlled via the vertical_scrollbar
configuration variable instead of being set explicitly for an editor instance.
Constructs a new Editor instance, displaying the specified buffer
. You would
typically not use this directly, but instead create a new editor via
Application.new_editor.
Registers an indicator with the specified id
. Placement indicates where the
indicator should be place. Possible values (strings) are:
top_left
: Adds the the indicator to the top indicator bar, to the left.top_right
: Adds the the indicator to the top indicator bar, to the right.bottom_left
: Adds the the indicator to the bottom indicator bar, to the left.bottom_right
: Adds the the indicator to the bottom indicator bar, to the right.Unregisters the indicator with the specified id
.
Moves the cursor backwards to the next reverse match of str
, within the
current line. Does nothing if str
could not be found.
Comments the current line or selection, if possible, by forwarding the request to the current mode.
Starts a completion at the current cursor position.
Copies the current line to the clipboard.
Deletes the current line.
Deletes from the current cursor column to the end of the current line.
Duplicates the current line if no selection is present. With a selection present, duplicates the text included in the selection.
Moves the cursor forward to the next match of str
, within the current line.
Does nothing if str
could not be found in the remainder of the line.
Grabs focus for the specified editor, i.e. causes the editor to be focused.
Indents the current line or selection, if possible, by forwarding the request to the current mode.
Indents all lines in the current buffer if possible, by selecting all lines and forwarding the request to the current mode.
Inserts text
at the current cursor position.
Joins the current line with the following line. Any space between the two lines is collapsed to one space. The cursor is positioned at the end of the current line, as it was before the join.
Inserts a new line at the current cursor position.
Pastes the contents of the clipboard at the current cursor position.
Redo:s the last undone edit operation, if any.
Removes any popup currently showing for the editor.
Scrolls the editor window down one line, if possible. I.e. causes the line below the currently last showing line to be visible.
Scrolls the editor window up one line, if possible. I.e. causes the line before the currently first showing line to be visible.
If a selection is present, shift the entire selection one indent level to the left. With no selection present, the current line is shifted one indentation level to the left.
If a selection is present, shift the entire selection one indent level to the right. With no selection present, the current line is shifted one indentation level to the right.
Display the popup for the specific editor. The popup is displayed at
the current cursor position, unless otherwise specified in options
. The can
only be one popup for a given editor at one time, invoking show_popup
when an
existing popup is active will cause that popup to close.
options
can contain the
following keys:
position
: The character position at which to show the popup.persistent
: A boolean indicating whether the popup should remain shown as the user types. The default behaviour is to automatically remove the popup in response to a key press.Inserts a tab if no selection is present, and indents the current selection on indentation level to the right if a selection is present.
The behaviour in the first case is dependent on several configuration variables.
use_tabs
variable.smart_tab
when in leading white-space causes the current line to be indented if the tab_indents
variable is set to true.Dedents the current selection on indentation level to the left if a selection is present.
If a selection is not present, then:
Returns the Gtk view for the Editor.
Comments or uncomments the current line or selection, if possible, by forwarding the request to the current mode.
A helper for transforming .active_lines within the scope of
Buffer.as_one_undo for the current buffer. Invokes
f
with .active_lines, with any modifications being recorded as one undo
operation.
Uncomments the current line or selection, if possible, by forwarding the request to the current mode.
Undo:s the last edit operation, if any.
Invokes f
, and restores the position to the original line and column after f
has returned. Should the indentation level for the current line have changed,
attempts to automatically adjust the column for the new indentation.