Full-featured line input with multi-line editing, history, completion, and Kitty keyboard protocol support.
| Module | Description |
|---|---|
| term.input.completion | Completion engine with pluggable sources, layered candidate management, and support for AI-assisted secondary completions. |
| term.input.history | Command history with persistent storage, navigation, and duplicate filtering. |
| term.input.prompt | Input prompt display with optional configurable blocks. |
| term.input.renderer | Completion renderer interface and built-in inline ghost renderer. |
| Name | Signature |
|---|---|
input:event | input:event() -> action, combo |
input:run | input:run(exit_events) -> event, combo |
input:newline | input:newline() -> redraw |
input:clear_all | input:clear_all() |
input:clear_from_prompt | input:clear_from_prompt() |
input:full_redraw | input:full_redraw() -> redraw |
input:move_right | input:move_right() -> redraw |
input:move_left | input:move_left() -> redraw |
input:move_to_previous_space | input:move_to_previous_space() -> redraw |
input:move_to_next_space | input:move_to_next_space() -> redraw |
input:insert | input:insert(char) -> redraw |
input:backspace | input:backspace() -> redraw |
input:scroll_completion | input:scroll_completion(direction) -> redraw |
input:promote_completion_full | input:promote_completion_full() -> redraw |
input:promote_completion | input:promote_completion() -> redraw |
input:search_completion | input:search_completion() -> redraw |
input:search_secondary_completion | input:search_secondary_completion() -> redraw |
input:external_editor | input:external_editor() |
input:insert_last_arg | input:insert_last_arg() -> redraw |
input:copy_to_clipboard | input:copy_to_clipboard() -> success |
input:display | input:display(force) |
input:buffer_empty | input:buffer_empty() -> empty |
input:prompt_len | input:prompt_len() -> len, prompt |
input:max_width | input:max_width() -> width |
new | new(config) -> input |
input:event() ->
action,combo
Process a single keyboard event and return the action taken
Reads one key event via KKBP, handles character insertion, cursor
movement, history navigation, and completion. Returns true when a
redraw is needed, an event string like "execute" or "exit" for
terminal events, or nil when no action was taken.
input:run(
exit_events) ->event,combo
Run the input event loop until an exit event occurs
Loops calling event() and display(), handling terminal resizes.
The exit_events table maps event names to true (defaults to
{execute = true, exit = true}). Returns the triggering event name.
input:newline() ->
redraw
Insert a new line at the cursor position
input:clear_all()
Clear the entire input area and reset cursor to start
input:clear_from_prompt()
Clear the input area from the end of the prompt onward
input:full_redraw() ->
redraw
Perform a complete redraw of the prompt and input content
input:move_right() ->
redraw
Move cursor one position to the right or to the next line
input:move_left() ->
redraw
Move cursor one position to the left or to the previous line
input:move_to_previous_space() ->
redraw
Move cursor back to the previous space character
input:move_to_next_space() ->
redraw
Move cursor forward to the next space character
input:insert(
char) ->redraw
Insert a character at the current cursor position
input:backspace() ->
redraw
Delete the character before the cursor
input:scroll_completion(
direction) ->redraw
Scroll through completion candidates in the given direction
input:promote_completion_full() ->
redraw
Accept the currently selected completion candidate in full
input:promote_completion() ->
redraw
Promote completion to common prefix or accept if single candidate
Two-phase promotion logic. With a single candidate, or when the
provider signals should_promote_full(), delegates to
promote_completion_full(). With multiple candidates, appends the
longest common prefix to the input and re-runs the completion search.
input:search_completion() ->
redraw
Trigger a completion search based on current input content
When cfg.eol_only is true (the default), only searches when the
cursor is at end-of-line and the current line does not end with
whitespace. When false, searches at any cursor position and passes
the cursor position to the provider. Delegates to
completion:search() with the current line and history object.
input:search_secondary_completion() ->
redraw
Trigger secondary-layer completion search
input:external_editor()
Open the current input content in an external editor
input:insert_last_arg() ->
redraw
Insert the last argument from the previous history command
input:copy_to_clipboard() ->
success
Copy current input content to clipboard using OSC52
input:display(
force)
Decide between full and partial redraw and render accordingly
input:buffer_empty() ->
empty
Check whether the input buffer contains no text
input:prompt_len() ->
len,prompt
Return the display length and rendered prompt string
input:max_width() ->
width
Return the maximum editable width in columns
new(
config) ->input
Create a new input instance
The config table may contain:
l, c — starting line and column position
width — maximum input width
rss — raw style sheet to merge with defaults
completion — completion object instance
history — history object instance
prompt — prompt object instance
renderer — completion renderer (default: inline ghost)
eol_only — only complete at end-of-line (default: true)