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 Emacs shell mode or GNU readline.
The area affected by insertions and edits during line-edit mode is called the input area, and it is by default high-lighted using a dashed brown border. Normally, the input area is a single line (or the part of a line following a prompt) but it can be multiple lines.
If output arrives while the input area is active the output buffer is updated as if the input area is not there: The input area is removed, the output with escape sequence is processed, and then the input area is re-inserted at the position of the output caret.
A mouse click on a match move the base position to the start of the match, and selects the match. A click not on a match sets the base position to the clicked location, and selects the first following match. (Id the search direction is backwards ....)
accept-line
)Send the contents of the input area to the application, along with a final newline. Also, if the input area is non-empty, add it to the history list.
If you want to send the contents of the input area without a final newline, you can switch the input mode to character mode (using either the menu or one-or-more Ctrl+Shift+L commands). This removes the text of the input area, but echo from the application will normally replace it. You can then optionally switch back to line mode.
insert-newline
)Insert a literal newline. Splits the current line at the current position, creating two new lines out of one old line, with the caret after the new break.
A mouse click in the input area moves the caret, as you would expect. For convenience, clicking outside the input area but on an input line also works, moving the mouse to the beginning or end of that line. Clicking on a line that does not contain part of the input area has no effect (except to make the window active).
Swiping the mouse (mouse-down followed by moving the muse followed by mouse-up) selects the region of text swiped, as expected. However, unlike many text editors, the input caret is not moved: The selection and the input caret are independent. A reason for difference is that the input caret is restricted to the input area, while the selection can be any part of the buffer.
Note that the end of the swept area (correspondiong to mouse-up) is indicated with a special marker (by default a brown I-beam) called the focus caret. More on that later.
Clicking while the shift key is pressed extends the selection as if you swept the mouse from the orginal end-point to the new click position.
The following special keys are supported. 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.
Many of the following keyboard commands can be modified by previously-typed repeat count.
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).
You can also repeat self-inserting characters: Alt+2 Alt+0 * inserts 20 asterisks.
Commands that are affected by a repeat count contain count in the description. By default the count is one, and it is reset after each command.
backward-char
)forward-char
)Move caret count characters left or right.
backward-word
)forward-word
)Move caret count words left or right.
beginning-of-line
)end-of-line
)Move caret to start/end of line.
beginning-of-input
)end-of-input
)Move caret to start/end of the input area. (Different from start/end of line if there are multiple lines in the input area.)
You can also delete using the selection; see later.
backward-delete-char
)forward-delete-char
)Delete count characters to the left or right of the caret.
backward-delete-word
)forward-delete-word
)Delete count words to the left or right of the caret.
The keystrokes Ctrl+C, Ctrl+Z, Ctrl+Z are handled specially, because of traditional Unix shell functionality. They are passed to the process - but only under certain conditions, because of other compatibility issues.
copy-text-or-interrupt
) (except macOS)client-action
) (only macOS)If there is a non-empty selection and this is not macOS, copy the selection to the clipboard. Otherwise, send Ctrl+C literally to the process (which traditionally interrupts it).
delete-char-or-eof
)Send Ctrl+D literally to the process (which on Unix system traditionally treats it as end-of-file), but only if the input area is empty. Otherwise (for Emacs/readline compatibility), delete the character following the caret.
client-action
)Send a literal Ctrl+Z (traditionally used in Unix to suspend the current job) to the process (following any existing text in the input area).
You can use the general scrolling shortcuts available in all modes, but in line-edit mode you don’t need to press Shift, and you can use a repeat count.
scroll-page-up
)scroll-page-down
)Scroll count pages up or down, respectively.
scroll-line-up
)scroll-line-down
)Scroll count lines up or down, respectively.
scroll-top
)scroll-bottom
)Scroll to top or bottom, respectively.
beginning-of-line
)backward-char
)end-of-line
)forward-char
)down-line-or-history
)up-line-or-history
)backward-word
)forward-word
)Emacs-style alternate keybindings.
delete-char-or-eof
)If the input area is empty, send the character literally (usually interpreted as end-of-file on Unix-like system). Otherwise, delete the character following.
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).
The “history” is the list of previously entered input lines.
up-line-or-history
)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.
backward-search-history
)Enter history-search-mode.
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.
Append (or insert) printable-char to the search string, which may update the selected history item.
Move caret within search string.
Delete character from search string. This may change the selected history item.
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.
Exit search mode, accept current item, and send it to the application.
Exit search mode, and move to previous/next history item.
Exit search mode, accept current item, but continue editing it.
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 password-hide-char
setting.)
The most recently typed character is displayed briefly (depending on
the password-show-char-timeout
setting) 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.
You can override the keymap (map from keystrokes to action)
used for input line editing.
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