restore managed textarea keymap handling (#26771)

This commit is contained in:
Sebastian
2026-05-11 01:45:59 +02:00
committed by GitHub
parent 64dde0cb15
commit 5654dd2aad
5 changed files with 53 additions and 37 deletions
@@ -712,7 +712,6 @@ export function Prompt(props: PromptProps) {
...input.traits,
...computePromptTraits({
mode: store.mode,
disabled: !!props.disabled,
autocompleteVisible: !!auto()?.visible,
}),
}
@@ -4,7 +4,6 @@ export type PromptMode = "normal" | "shell"
export interface PromptTraitsInput {
mode: PromptMode
disabled: boolean
autocompleteVisible: boolean
}
@@ -16,10 +15,9 @@ export type PromptTraits = EditorTraits & {
/**
* Compute the textarea editor traits for the prompt.
*
* `traits.suspend` gates the textarea's keybinding actions (backspace,
* delete-word, arrow movement, undo/redo, etc.). Shell mode is an active
* editing mode — only `disabled` should suspend the textarea, otherwise
* users can type in shell mode but cannot delete or move the cursor.
* The OpenTUI managed textarea keymap owns `traits.suspend`. Prompt traits
* only expose capture/status metadata so focus changes cannot unsuspend the
* keymap-managed editor mappings.
*/
export function computePromptTraits(input: PromptTraitsInput): PromptTraits {
const capture =
@@ -30,7 +28,6 @@ export function computePromptTraits(input: PromptTraitsInput): PromptTraits {
: undefined
return {
capture,
suspend: input.disabled,
status: input.mode === "shell" ? "SHELL" : undefined,
owner: "opencode",
role: "prompt",