Skip to content

Composer history: a recalled command is one step, however many lines it has (#389) - #438

Merged
raiseCatError merged 1 commit into
devfrom
feature/v022-history-browse
Oct 21, 2026
Merged

raiseCatError merged 1 commit into
devfrom
feature/v022-history-browse

Conversation

@raiseCatError

@raiseCatError raiseCatError commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Draft, do not merge before v0.21 ships. #430 has carried dev into release/v0.21.0; a fix v0.21's physical QA needs would reach the release the same way, so anything merged into dev before the release would ride along. Part of v0.22 (#431); approved as decision D1.

Why (#389)

After Up recalled a multiline or soft-wrapped command, further Up presses moved the caret through its rows before history moved on. On dev a recalled five-line command took five extra presses to pass (trace on the issue), and a test codified that behavior.

What changed

  • While the composer shows an unchanged recalled entry and you have done nothing else since, Up and Down step one entry at a time, however many explicit or wrapped rows the entry has (TerminalApp.historyStep).
  • Any other composer key makes the recalled command a draft again: typing, pasting, deleting, moving the caret or a word, Home/End, selecting, Select All. Up/Down then move between its rows as for any draft, and the next recall starts a fresh snapshot. The browsing flag is combined with ComposerHistory's own text check, so anything else that replaces the text also ends browsing.
  • Unchanged: editing a fresh multiline draft (Up/Down move by row first and cross into history at the first or last row); Down past the newest entry restores the exact draft; oldest-entry behavior (no wrap); the completion and slash menus, agent shelf and background bar keep their precedence; key ownership while a program reads input or owns the terminal (composerHistoryEligible); CommandEditor, /history, history providers and journals.
  • The slash-menu exit path and the running-command path use the same step.
  • The composer's caret is not placed by mouse clicks today, so there is no click transition to handle.

The History n/N position indicator is a separate slice, as decided.

Verification

  • Regressions: the test that codified the old behavior is replaced. New tests cover five-line and soft-wrapped entries stepping once per press in both directions, the oldest and newest ends, the exact multiline draft restored (caret included), and each way of leaving browsing (typing, caret, word, Home, selection, paste). The running-command test is updated. 4 fail on dev a8b383c2; the transitions test passes there too, since dev never browses (it guards the new state).
  • Suites: composer history (idle and running), composer layout and dividers, Flow, frontend history, history providers, ranking, search, viewport, reuse (live), prompt history fidelity, queue history (unit and app), slash routing, structured history, command queue (live): 79/79. Full canonical npm run verify on 29d73a69: 3143 pass, 1 fail, 2 skipped (load 9 at start, 20 at the end). The one failure is the live compatibility harness timing out waiting for a prompt (tests/compatibilityHarness.test.ts); with that file and the live input-ownership tests rerun at load 5: 16/16. CI runs on this PR.

Physical QA (not done)

Ghostty and Terminal.app; zsh, Bash and Fish. Run a multi-line command (Ctrl+J between lines) and a few one-line commands. From an empty composer: Up recalls the newest; each further Up moves one command, passing the multi-line one in one press; Down comes back the same way; Down past the newest restores what you had typed. Recall the multi-line command, press Left (or type a character), then Up: the caret moves within it. Narrow window (about 46 columns) with a long one-line command: one press per entry.

Refs #389

…it has

#389 (approved for v0.22): after Up recalled a multiline or soft-wrapped
command, further Up presses moved the caret through its rows before history
moved on: a recalled five-line command took five extra presses to pass, and
tests/composerHistory.test.ts codified that.

- TerminalApp: while the composer shows an unchanged recalled entry and the
  person has done nothing else since, Up and Down step entry by entry
  (historyStep). Any other composer key (typing, pasting, deleting, moving
  the caret or a word, Home/End, selecting, Select All) makes it a draft
  again: Up/Down move between its rows as before, and the next recall
  starts a fresh snapshot. The flag is combined with ComposerHistory's text
  check, so anything else that replaces the text also ends browsing.
- The slash-menu exit path and the running-command path use the same step.
  Down past the newest entry restores the exact draft, as before. Editing a
  fresh multiline draft, completion and slash menus, the agent shelf and
  the background bar keep their precedence. CommandEditor is unchanged.

The test that codified the old behavior is replaced. New tests: five-line
and soft-wrapped entries step once per press both ways, oldest and newest
ends, the exact multiline draft restored, and each way of leaving browsing
(typing, caret, word, Home, selection, paste). Four fail on dev.

Refs #389
raiseCatError added a commit that referenced this pull request Oct 18, 2026
…QA passes

The ledger lists every slice and PR with its verification and open
risks; the physical QA checklist gains the held-input states and passes
for #437, #438/#441, #439 and #440; the NL design records the decisions
and the first slice's scope.
@raiseCatError
raiseCatError merged commit 1e65c96 into dev Oct 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant