ChatTextArea(
self,
**kwargs: Any = {},
)TextAreaTextArea subclass with custom key handling for chat input.
Key bindings for the chat text area.
These are the single source of truth for shortcut keys. _NEWLINE_KEYS
is derived from this list so that _on_key stays in sync automatically.
Inline slash-command argument hint rendered at the end of the line.
Render a single line, appending any argument hint at line end.
The built-in TextArea.suggestion renders at the cursor position,
but slash-command argument hints should stay attached to the end of the
command text regardless of cursor movement.
Scroll to make the cursor visible, guarding against cursor/document desync.
Textual's WrappedDocument.location_to_offset has an off-by-one in its
line-index clamp (len(...) instead of len(...) - 1). When a reactive
watcher (e.g. _watch_show_vertical_scrollbar) fires between a document
replacement and cursor update, the stale cursor location triggers a
ValueError. Guard here since scroll_cursor_visible is the sole
caller of _recompute_cursor_offset.
Set whether the app should show the cursor as active.
Set whether completion suggestions are visible.
Insert a newline character.
Move cursor up, or navigate to the previous history entry at top.
When select is true or a selection is active, falls through to
TextArea's default so shift+up extends selection rather than
triggering navigation. History fires only when moving up cannot
advance the cursor — handled via the wrapped-document navigator so
soft-wrap is respected.
Move cursor down, or navigate to the next history entry at bottom.
Mirrors action_cursor_up: defers to TextArea on selection or when
the cursor still has somewhere to move; otherwise fires history.
Replace a [Pasted text #id] placeholder with full text in place.
Used when the same content is pasted again: the compact placeholder is expanded back to the original text where it sits, preserving surrounding input.
Set text from history navigation.
Move the cursor to the end of the current text.
Clear the text area.
Clear the draft via an undoable edit (restorable with ctrl+z).
Unlike clear_text, the deletion is recorded in the undo history and
the resulting Changed event is allowed to propagate, so completion
and argument-hint state stay in sync.
Message sent when text is submitted.
Request previous history entry.
Request next history entry.
Message sent when paste payload resolves to file paths.
Message sent when a paste is large enough to be collapsed.
The full text is carried in the message so ChatInput can store it
and insert a compact placeholder into the text area instead.
Posted when the user presses a printable key or backspace.
Relayed by ChatInput as ChatInput.Typing for the app to track
typing activity.