Input line editing

In “line-editing mode” most keystrokes add to or modify an editing area in the domterm window, but are not sent to the application until you type Enter. This enables editing of input lines similar to GNU readliune.

The keystroke ctrl-shift-L cycles between char mode (most characters sent immeditably to the application), line mode (most characaters modify local editring area), and auto mode (automatically switches between char mode and line mode depending on whether the application requests “raw” (char) input or “canonical” (line) input).

The following special keys are supported. N is a repeat count, which by default is 1. The word “caret” refers to the text cursor (as opposed to the mouse cursor). The names in parentheses are the corresponding action names that can be used if changing the key-bindings.

Left (backward-char)
Right (forward-char)

Move caret N characters left or right.

Ctrl-Left (backward-word)
Ctrl-Right (forward-word)

Move caret N words left or right.

Home (beginning-of-line)
End (end-of-line)

Move caret to start/end of line.

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

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

Ctrl-Shift-Left (backward-word-extend)
Ctrl-Shift-Right (forward-word-extend)

Extends the current selection by one word.

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

Extend selection to start/end of line.

Backspace (backward-delete-char)
Delete (forward-delete-char)

Delete N characters to the left or right of the caret.

Ctrl-Backspace (backward-delete-word)
Ctrl-Delete (forward-delete-word)

Delete N words to the left or right of the caret.

Enter (accept-line)

Send input line to application. Also, if line is non-empty, add it to the history list.

Alt-Enter (insert-newline)

Insert a literal newline. Splits the current line at the current position, creating two new lines, with the caret after the new break.

Ctrl-C
Ctrl-Shift-C

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

Ctrl-V
Ctrl-Shift-V

Paste selection from clipboard.

Ctrl-X
Ctrl-Shift-X

Cut (deleted) selection and copy to clipboard. The selection should be wholly within the input area.

Up (up-line-or-history)
Down (down-line-or-history)

Move up/down in history. If the current command is multi-line, first moves within the current command before moving to commands in the history.

Ctrl-R (backward-search-history)

Enter history-search-mode.

Alt-Minus
Alt-digit

Set or extend a repeat count. For example Alt-1 Alt-2 Left moves 12 characters left, while Alt-Minus Alt-2 Ctrl-Left moves 2 words right (because of the minus).

Ctrl-A (beginning-of-line)
Ctrl-B (backward-char)
Ctrl-D (delete-char)
Ctrl-E (end-of-line)
Ctrl-F (forward-char)
Ctrl-N (down-line-or-history)
Ctrl-P (up-line-or-history)
Alt-B (backward-word)
Alt-F (forward-word)

Emacs-style alternate keybindings.

The “standard” mouse commands should work as expected. If you click before/after the input area, the caret is moved to the start/end of the input area.

Not implemented yet, but planned: Emacs-style key-bindings should be controlled by a separate option; some bindings are missing, such as Ctrl-T, and the ones prefixed by Esc. Command-completion, using some protocol to be defined. A plug-in replacement for GNU readline using LD_PRELOAD would be nice. (The idea is for an enhanced readline to detect it is running under DomTerm, in which case it would delegate most editing to DomTerm. This would allow using bash completion logic.) Auto-completion (completion as you type).

Searching in history

The Ctrl-R key enters history-search mode. As you type characters, a search string is created, which is matched against the items in the history list.

printable-char

Append (or insert) printable-char to the search string, which may update the selected history item.

Left
Right

Move caret within search string.

Backspace
Delete

Delete character from search string. This may change the selected history item.

Ctrl-R
Ctrl-S

Search for previous/next history item matching the current search string. If the search string is empty, use previous search string. For example Ctrl-R Ctrl-R repeats previous search.

Enter

Exit search mode, accept current item, and send it to the application.

Up
Down

Exit search mode, and move to previous/next history item.

Tab

Exit search mode, accept current item, but continue editing it.

Changing keybindings

You can override the keymap (map from keystrokes to action) used for input line editing (but not yet override other key-bindings). The keymap.line-edit is a list (separated by commas or newlines), where each item is a quoted keystroke string, followed by a colon, followed by an action name. An action name is a string, but quotes are optional. The following example disables the binding for Ctrl-A and adds a binding that maps Ctrl-H to the beginning-of-line action.

keymap.line-edit =
 | "Ctrl-A": ignore-action
 | 'Ctrl-H': beginning-of-line

Password fields

A “password field” is an input area where the typed characters are hidden or obscured. DomTerm will display each character as a black circle instead of the actual character. (The replacement character is the passwordHideChar property.) The most recently typed character is displayed briefly (depending on the passwordShowCharTimeout property) before it too is replaced by a black circle. On Enter, all circles are removed.

Using these circles makes it easier see how many characters you’ve typed, and to move around using the mouse or cursor keys.

A password field is automatically created when we’re in line-editing mode and echoing is turned off by the program reading the input.