Skip to content

feat(desktop): arrow-key history + queue editing in composer#40234

Merged
OutThisLife merged 2 commits into
mainfrom
bb/desktop-queue-arrow-edit-v2
Jun 6, 2026
Merged

feat(desktop): arrow-key history + queue editing in composer#40234
OutThisLife merged 2 commits into
mainfrom
bb/desktop-queue-arrow-edit-v2

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

What

Adds arrow-key navigation to the composer — sent-message history recall and in-place editing of queued turns — building on and superseding #39088.

Supersedes #39088 (by @naqerl), which added the ArrowUp/ArrowDown history store and nav. That work is carried in here verbatim (store + tests), then integrated with the message queue so ArrowUp behaves correctly when a queue exists — the gap #39088 had on its own: it recalled queued/sent text as a dead paste rather than an editable turn.

Behavior

ArrowUp / ArrowDown resolve in priority order:

  1. Editing a queued turn → walk older (Up) / newer (Down) through queued entries, saving each edit as you pass. ArrowDown past the newest exits edit mode and restores the pre-edit draft.
  2. Empty composer + queued turns → ArrowUp opens the newest queued entry for editing (same as the row's edit pencil). Enter then saves it back to the queue instead of firing a brand-new message.
  3. Otherwise → sent-message history recall (the feat(desktop): arrow up/down history navigation in composer #39088 behavior), derived live from $messages — single source of truth, no mirror.

Also:

  • Esc cancels an in-progress queue edit (otherwise interrupts the running turn, as before).
  • Browse state resets on session switch and on every real send (drain, submit, voice).

Tests

Closes #39088

naqerl and others added 2 commits June 5, 2026 20:32
Builds on @naqerl's arrow up/down history (previous commit), making
ArrowUp do the right thing when a queue exists.

ArrowUp/ArrowDown priority:
1. Editing a queued turn → walk older/newer through queued entries,
   saving each edit; ArrowDown past the newest exits and restores the
   pre-edit draft.
2. Empty composer + queued turns → ArrowUp opens the newest queued entry
   for editing (the row's pencil), so Enter saves it back to the queue
   instead of firing a new message — the gap the history nav had alone.
3. Otherwise → sent-message history recall (unchanged).

Also: Esc cancels an in-progress queue edit (else interrupts).

Cleanups on the integrated code: fold the browse-state reset into the
existing session-change effect (drop the duplicate ref+effect); reuse
loadIntoComposer for history recall; sort imports; add curly braces +
the runDrain sessionId dep (lint).
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🔎 Lint report: bb/desktop-queue-arrow-edit-v2 vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9870 on HEAD, 9870 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5119 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@OutThisLife OutThisLife enabled auto-merge June 6, 2026 01:35
@OutThisLife OutThisLife merged commit ac177ce into main Jun 6, 2026
20 checks passed
@OutThisLife OutThisLife deleted the bb/desktop-queue-arrow-edit-v2 branch June 6, 2026 01:38
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.

2 participants