Repository navigation
Add tab navigation and partial submission for question batches - #431
Merged
Merged
Conversation
sproott
force-pushed
the
question-tabs
branch
from
November 14, 2026 13:59
7471fbb to
57bd1a3
Compare
sproott
marked this pull request as draft
November 14, 2026 13:59
sproott
force-pushed
the
question-tabs
branch
10 times, most recently
from
November 14, 2026 15:58
943520b to
0da943f
Compare
Bold question text, a ❯ pointer, one hint line joined with " · " in Claude Code's wording, and the header as a highlighted chip under the top border instead of a [header] line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sproott
force-pushed
the
question-tabs
branch
from
November 14, 2026 16:28
0da943f to
485d999
Compare
2 tasks done
sproott
marked this pull request as ready for review
November 14, 2026 16:38
Several questions in one call now share one TUI form: Tab/Shift+Tab or Left/Right move between questions and a Submit review, answers survive navigation, and submitting with questions unanswered marks them skipped while keeping the answers given. A cancel declines the whole call. Each question keeps its own remote offer, and the idle timeout reports confirmed answers plus checked options. A lone question goes through the same form. The question model becomes tagged unions (rows, per-mode state, answers) in place of the isOther/wasCustom/index flags. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sproott
force-pushed
the
question-tabs
branch
from
November 14, 2026 17:15
485d999 to
48e8b8b
Compare
render spliced the header chip into the cached lines after buildQuestionLines returned, which left QuestionView.header and the `[header]` branch unreachable. The chip is now built where the other lines are, from the header passed in the view, and the splice and the dead branch are gone. The multiSelect hint named no navigation keys. It now reads "Space to toggle · ↑/↓ to navigate · Enter to confirm · Esc to cancel".
The tabbed form takes the restyled overlay: the ❯ pointer, hints joined with " · ", the question in bold and the header chip on a lone question. Assertions that hard-coded the "> " pointer, the "•" hints and the "[header]" line follow.
Biome reported cognitive complexity above 15 for receive, handleQuestionInput, handleReviewInput and renderTabs. - receive returns early on a remote cancel instead of nesting the rest. - handleQuestionInput hands the editor keys to handleTypingInput and the checkbox toggle to toggleChecked. - handleReviewInput tests its keys as one chain and takes the chosen entry from chooseReviewOption. - renderTabs takes the visible range from a module-level tabWindow. No behaviour changes.
With two questions, the first answered at the keyboard and the second by a remote responder, the call stayed pending on the Submit tab: the form submitted on a remote answer only when every question had been answered remotely. On main the same sequence returned both answers. A remote answer now submits the form whenever it leaves every question answered, whoever answered the others. The per-question remotelyAnswered flag existed only for the old condition and is removed.
A question of a batch was offered on pi-code:question:v1 only on its first visit, so a user who jumped to the Submit tab left the remaining questions never offered, and a listener holding several live offers had nothing to tell which call or position each belonged to. - Every question is offered before the form opens. The offers of a call with several questions carry an optional batch field: an id shared by the call, the 1-based index and the total. A single question's offer is unchanged and has no batch field. - A reply accepted for an earlier question while a later one is still being offered is delivered when the form attaches, instead of being dropped after the settle handle returned true. - docs/session-extras.md states what differs for batches: several live offers, an accepted answer the local user may still change before submit, and a remote cancel ending the whole call.
A multiSelect question confirmed with Alpha, revisited and given Beta with Space but no Enter, rendered both boxes checked and its tab as answered while the result reported only Alpha: the confirmed answer was a snapshot that later toggles did not touch. A toggle on a confirmed question now updates its answer, and the question reads as unanswered while nothing is checked. Enter with nothing checked still leaves a batch question unanswered. The two tests that pinned the snapshot rule, on submit and on timeout, assert the checked set instead.
Shift+Tab or Left on the first question landed on Submit, and Tab or Right on Submit landed on the first question. Claude Code clamps: the previous index is max(0, i - 1) and the next stops at the last tab. Navigation now stops at both ends. The test that reached Submit by pressing Left on the first question presses Right twice instead.
The hint under a multiSelect question of a batch was 91 columns wide and was truncated on an 80 column terminal, hiding "Esc to cancel". A batch now names its navigation as "Tab/Arrow keys to navigate", the wording of Claude Code's batch hint, in place of the separate arrow and tab entries. The longest variant is 80 columns. A test renders every variant (single, multiSelect, editor, batch, review) and asserts its text and its visible width.
The tab bar sized its tabs with String.length, so a header of double-width characters counted for half the columns it occupies. With three nine-character CJK headers at 40 columns the bar kept two tabs, overflowed, and truncation cut the active tab. Tabs are measured with visibleWidth, so the visible range is chosen from the columns each tab takes.
The form renders from its state on every call and keeps no line cache, but one test was titled "reuses its cached lines at an unchanged width until the host invalidates" and another's comment said the cache must be keyed on width. The first now asserts what holds without a cache: the same lines at an unchanged width, the new state on the render after input with no invalidate in between, and no change from an invalidate. The comment states that render lays out at the width it is given.
docs/session-extras.md said Claude Code drops every answer on a partial
submit and that keeping them is a pi-code divergence. Claude Code
2.1.325 keeps the answered questions ("Your questions have been
answered: ...") and leaves the unanswered ones out; it reports "The
user did not answer the questions." only when nothing was answered.
The doc now states that, and the one real difference: pi-code names
each unanswered question as skipped in the result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several questions in one call used to be asked one after another, with no way back to an earlier answer. They now share one tabbed form that ends in a Submit review. A lone question goes through the same form, without tabs.
Third-party listeners on
pi-code:question:v1see a lifecycle change. Each question is offered once, on its first visit, and the offer stays live until that question is answered or the form closes, whichever tab has focus. A remote answer saves to its own question.Rows, answers and per-question state are now tagged unions, replacing the isOther/wasCustom/index flags.
#435 (restyle) touches the same render code, so whichever of the two merges later needs a small rebase.
npm run checkpasses (Biome, strict tsc, Vitest)🤖 Generated with Claude Code