Add TUI building blocks for inline async question editing (#42889)

## What changed

- Introduce an async-question editor component with per-question drafts, navigation, replay deduplication, and submit or queue handling using the shared composer.
- Add bounded `AnsweredQuestion` framing that truncates question text at a UTF-8 boundary and flattens line breaks before prepending it to an answer.
- Add `prompt_stack_back` and `skip_question` keybinding actions and the `tui.question_esc_back` setting. Normalize `Ctrl+]` and `Ctrl+5` for key matching and conflict detection, and let default question shortcuts yield to explicit bindings.
- Flush buffered typing in both the main composer and the covering view so background input cannot keep the draw loop waiting.

The async-question component is not yet connected to the TUI event flow.

## Testing

Add regression coverage for bounded Unicode question framing, question-shortcut conflicts, and paste-buffer flushing in background and covering editors.

GitOrigin-RevId: 4098043cf588ddafc05c27505645495edd690cb9
This commit is contained in:
Ian MacLeod authored and copyberry committed 2026-09-04 23:56:25 +00:00
1 parent 574a36ff99
commit 6ae8dcf6e1
32 files changed
+750 -44

No files matched your search

+26 -1
View File
@@ -3889,6 +3889,8 @@
"interrupt_turn": null,
"next_permission_mode": null,
"previous_permission_mode": null,
"prompt_stack_back": null,
"skip_question": null,
"toggle_voice_mute": null
},
"composer": {
@@ -4085,6 +4087,11 @@
"default": "composer",
"description": "Where the terminal pet should anchor vertically.\n\nDefaults to `composer`, which follows the current TUI composer viewport."
},
"question_esc_back": {
"default": true,
"description": "Escape returns from async questions to the composer, preserving the answer draft.",
"type": "boolean"
},
"raw_output_mode": {
"default": false,
"description": "Start the TUI in raw scrollback mode for copy-friendly transcript output. Defaults to `false`.",
@@ -4303,7 +4310,7 @@
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Edit the most recently queued message."
"description": "Move up through pending async questions, then edit the most recently queued message."
},
"increase_reasoning_effort": {
"allOf": [
@@ -4337,6 +4344,22 @@
],
"description": "Switch to the previous available permission mode."
},
"prompt_stack_back": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Move back through pending async questions toward the composer."
},
"skip_question": {
"allOf": [
{
"$ref": "#/definitions/KeybindingsSpec"
}
],
"description": "Skip the focused question."
},
"toggle_voice_mute": {
"allOf": [
{
@@ -4690,6 +4713,8 @@
"interrupt_turn": null,
"next_permission_mode": null,
"previous_permission_mode": null,
"prompt_stack_back": null,
"skip_question": null,
"toggle_voice_mute": null
}
},