Skip to content

fix(macapp): restore cursor-aware Up and Down prompt-history navigation #998

Description

@dennisonbertram

Parent: #991

Summary

The completed #927 acceptance requires Up/Down prompt-history recall at the first/last composer line. Production code stores history but exposes only “recall the last prompt,” has no history cursor/forward traversal, and never calls that method from the composer.

Evidence

  • macapp/Sources/GoCodeUI/RunSession.swift:25-26,74-75 — history is appended.
  • RunSession.swift:205-208 — recall always selects only promptHistory.last.
  • macapp/Sources/GoCodeUI/ChatView.swift:888-893 — composer handles submit and draft changes, but no Up/Down key navigation.
  • Repository search finds no production caller of recallPreviousPrompt().
  • feat(macapp): composer — submit, multiline, prompt history #927 is closed as completed despite this acceptance item being unreachable.

Scope

  • Add a history cursor with previous/next traversal and restoration of the in-progress draft.
  • Intercept Up only at the first visual line/caret boundary; intercept Down only at the last.
  • Preserve normal arrow-key caret movement everywhere else.
  • Reset cursor appropriately after edit/submit while keeping draft text across section navigation.
  • Keep Enter/Shift+Enter behavior intact.

Tests first

  • Pure history-state tests: empty, one, many, repeated previous, forward traversal, return to draft, submit reset.
  • Editor-boundary tests for first/middle/last line so caret movement is not stolen.
  • Production-reachability test proving composer key events invoke history navigation.
  • Manual keyboard smoke with multi-line drafts.

Acceptance criteria

  • Up/Down traverse prompt history only at the documented caret boundaries.
  • Down past newest restores the user's pre-navigation draft.
  • Normal multi-line caret movement remains native.
  • Draft survives navigating away/back.
  • Completed feat(macapp): composer — submit, multiline, prompt history #927 acceptance is covered by behavior tests.
  • swift test, Swift build, formatting, strict format lint, and keyboard smoke pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorrectnessCorrectness bugs and logic errorsmacappNative macOS app (macapp/)mediumMedium effort: 1-3 daysuxUser experience improvementswell-specifiedIssue is clear, scoped, and ready to implement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions