feat(tui): wrap and page question dialogs

This commit is contained in:
Turtle
2026-08-03 17:15:04 +08:00
parent ca9bf213b7
commit 3b58ed65b7
19 changed files with 1231 additions and 178 deletions

View File

@@ -29,7 +29,10 @@ interface PendingQuestion {
}
/** Collaborators the question queue needs from the chat channel. */
export type QuestionQueueDeps = ChatChannelDeps
export interface QuestionQueueDeps extends ChatChannelDeps {
/** Current row budget after reserving the editor. */
questionMaxHeight(): number
}
/** Ask-user-question controller for one chat channel. */
export interface QuestionQueue {
@@ -85,6 +88,7 @@ export function createQuestionQueue(deps: QuestionQueueDeps): QuestionQueue {
pending.request.questions.length,
pending.request.questions.length - pending.answers.length,
resolved.maxQuestionOptions,
() => deps.questionMaxHeight(),
palette,
(selection) => {
pending.overlay = undefined
@@ -102,10 +106,8 @@ export function createQuestionQueue(deps: QuestionQueueDeps): QuestionQueue {
options: {
width: resolved.questionDialogWidth,
maxHeight: resolved.questionDialogMaxHeight,
anchor: 'bottom-left',
margin: { bottom: 1 },
},
})
}, 'inline')
pending.overlay = session
void session.closed.then((result) => {
if (pending.overlay !== session) return