Working with the Selection

The selection is the highlighted region (by default blue) of the buffer. A Copy operation copies the contents of the selection to the clipboard. View and line-edit modes have extra shortcuts and other conveniences for working with the selection. Unless otherwise noted, this section applies to both.

images/dt-viewselect1

The two end-points of the selection are called the anchor and the focus points. The anchor is where you start the selection (typically on mouse-down), while the focus is current/active end of the selection: As you drag the mouse the focus follow the mouse, until mouse-up. In paging and line-edit modes the focus end is indicated with a vertical bar, by default purple.

The commands in this section do not move the edit caret, only the focus position.

Commands that move the focus will scroll the view so the focus remains in the view.

Ctrl+Shift+C (copy-text)
Ctrl+Insert
Cmd+C (only macOS)

Copy selection to clipboard. (Selection can be partly or fully outside input area.)

Ctrl+C (copy-text-or-interrupt) (except macOS)

If there is no selection send Ctrl+C to the process - which normally interrupts it. If the previous keycommand was also a Ctrl+C, do as the no-selection case, so typing Ctrl+C twice will always interrupt. If there is a selection, copy it to the clipboard.

Ctrl+! (swap-focus-anchor)

If there is a non-collapsed selection, swap focus and anchor (selection ends).

Cut and paste (line-edit mode only)

The following commands modify the buffer, so are only available in line-edit mode, not view mode:

Ctrl+V (paste-text)
Ctrl+Shift+V
Shift+Insert (Only Electron, Qt, Webview)

Paste selection from clipboard.

Ctrl+X (cut-text)
Ctrl+Shift+X

Cut (delete) the selection and copy the contents to clipboard. Only removes text within the input area.

Extending the selection

Pressing Shift while executing a movement command (such as Left) will extend the selection: The focus is moved as specified by the unshifted command (such as Left to move one character left), but the anchor stays where it was. The selected area expands or shrinks, depending on the movement. If there was no selection, the anchor is set to the initial location of the focus (in view mode) or the edit caret (in line-edit mode).

These operations will scroll as needed so the focus remains visible.

A mouse click (button-1) with Shift held will extend the selection by moving the focus position leaving the anchor position in place.

Shift+Left (backward-char-extend)
Shift+Right (forward-char-extend)

Extends the current selection by count characters (If there is no selection, the caret position is treated as a zero-size selection.)

Ctrl+Shift+Left (Alt+Shift+Left on macOS) (backward-word-extend)
Ctrl+Shift+Right (Alt+Shift+Right on macOS) (forward-word-extend)

Extend(or reduce) the current selection by count words

Shift+Home (beginning-of-line-extend)
Shift+End (end-of-line-extend)

Extend selection to start/end of line.

Shift+Up (up-line-extend)
Shift+Down (down-line-extend)

Extend selection by moving focus up/down count lines.

Alt+Shift+Home (paging mode only) (beginning-of-buffer-extend)
Alt+Shift+End (paging mode only) (end-of-buffer-extend)

Extend selection by moving focus position to start/end of the buffer.

Alt+Shift+Home (line-edit mode only) (beginning-of-input-extend)
Alt+Shift+End (line-edit mode only) (end-of-input-extend)

Extend selection by moving focus position to start/end of the input area.

Extend mode

Extend mode allows extending (or shrinking) the selection using keyboard commands without pressing Shift. The effect is similar to setting the mark in the Emacs editor. For example when extend mode is active, pressing the Right key extends the selection by one character (executing forward-char-extend), as if Shift+Right was pressed.

Ctrl+@

Toggle extend mode.

A visual indication of extend mode is that the focus caret changes color from purple to orange, and the color of the selection changes.

Generally, if some key X is pressed in extend mode and Shift+X is bound to a command whose name ends with -extend, that command is executed instead.

Left (backward-char-extend)
Right (forward-char-extend)
Ctrl+Left (Alt+Left on macOS) (backward-word-extend)
Ctrl+Right (Alt+Right on macOS) (forward-word-extend)
Up (up-line-extend)
Down (down-line-extend)
Home (beginning-of-line-extend)
End (end-of-line-extend)
Alt+Home (paging mode only) ((beginning-of-buffer-extend)
Alt+End (paging mode only) ((end-of-buffer-extend)
Alt+Home (line-edit mode only) (beginning-of-input-extend)
Alt+End (line-edit mode only) (end-of-input-extend)

Extends the selection, as if Shift was pressed.

Esc

Exit extend mode, returning to plain view or line-edit mode.