Skip to content

feat(desktop): Alt+Up / Alt+Down prompt history in the composer#3121

Open
HUQIANTAO wants to merge 1 commit into
esengine:main-v2from
HUQIANTAO:feat/composer-history
Open

feat(desktop): Alt+Up / Alt+Down prompt history in the composer#3121
HUQIANTAO wants to merge 1 commit into
esengine:main-v2from
HUQIANTAO:feat/composer-history

Conversation

@HUQIANTAO
Copy link
Copy Markdown
Contributor

Most terminals and editors have shell-style history recall; the desktop composer was a plain textarea. Wire ⌥↑ / ⌥↓ to step through the user's last 200 sent prompts (most-recent first), persisted in localStorage.

Behavior matches readline:

  • First ⌥↑ stashes the in-progress draft and shows the most recent prompt.
  • ⌥↓ walks forward; stepping past the newest entry restores the stashed draft.
  • The modifier is Alt (Alt on Linux/Windows, Option on macOS) — plain ArrowUp/Down still drive the slash / @-file / arg menus.
  • isComposing guards IME confirmation (pinyin, kana).
  • submit() resets the cursor and the draft.

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 4, 2026
Most terminals and editors have shell-style history recall; the desktop
composer was a plain textarea. Wire ⌥↑ / ⌥↓ to step through the user's
last 200 sent prompts (most-recent first), persisted in localStorage at
reasonix.composer.history.

Behavior matches readline:
  - First ⌥↑ stashes the in-progress draft and shows the most recent
    prompt; subsequent presses walk further back.
  - ⌥↓ walks forward; stepping past the newest entry restores the
    stashed draft so the user's typing isn't lost.
  - The modifier is Alt (Alt on Linux/Windows, Option on macOS) — plain
    ArrowUp/Down still drive the slash / @-file / arg menus, so the two
    paths don't fight.
  - isComposing guards IME confirmation (pinyin, kana) so an in-progress
    composition is never swallowed by a recall.
  - submit() resets the cursor and the draft, so the next recall starts
    fresh.
  - Sending pushes the typed text (post-trim, attachments excluded) to
    the head of the list, deduped.

New file lib/composerHistory.ts (pushHistory / snapshot / clearHistory,
capped at 200 entries, defensively copies on read so a caller can't
mutate the cache).
@HUQIANTAO HUQIANTAO force-pushed the feat/composer-history branch from 17baa07 to 82fbd7d Compare June 5, 2026 01:43
@HUQIANTAO HUQIANTAO requested a review from SivanCola as a code owner June 5, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant