[PR #987] [CLOSED] feat(tui): add prompt history navigation with up/down arrows #9770

Closed
opened 2026-02-16 18:14:08 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/987
Author: @josephschmitt
Created: 7/14/2025
Status: Closed

Base: devHead: dev


📝 Commits (10+)

  • 570ff8d feat(tui): add prompt history navigation with up/down arrows
  • e0caf83 feat: implement core HistoryStore component and integration
  • ed1fa94 feat: integrate HistoryStore with UI components and add /clear-history command
  • aa1533b feat: add unit tests and fix integration tests for history system
  • 46af29f feat: implement attachment restoration in arrow history navigation
  • 84c33e8 fix: resolve attachment restoration bug in history navigation
  • e050e78 test: add comprehensive unit tests for attachment restoration fix
  • d54cd24 ignore: update download stats 2025-07-18
  • 31fa7bd ignore: update download stats 2025-07-19
  • 0dcfa5e ignore: update download stats 2025-07-20

📊 Changes

20 files changed (+2147 additions, -30 deletions)

View changed files

📝 STATS.md (+3 -2)
docs/arrow-history/prd.md (+66 -0)
docs/arrow-history/tasks.md (+121 -0)
docs/arrow-history/tech-spec.md (+131 -0)
docs/arrow-history/technical-fix.md (+296 -0)
docs/editor-history/prd.md (+61 -0)
docs/editor-history/progress.md (+143 -0)
docs/editor-history/tech-spec.md (+171 -0)
📝 packages/tui/internal/app/app.go (+20 -0)
📝 packages/tui/internal/commands/command.go (+6 -0)
📝 packages/tui/internal/components/chat/editor.go (+47 -0)
packages/tui/internal/components/chat/editor_test.go (+58 -0)
📝 packages/tui/internal/components/chat/message.go (+2 -10)
📝 packages/tui/internal/components/list/list_test.go (+6 -16)
📝 packages/tui/internal/components/textarea/textarea.go (+201 -2)
packages/tui/internal/components/textarea/textarea_test.go (+452 -0)
📝 packages/tui/internal/config/config.go (+8 -0)
packages/tui/internal/history/history.go (+148 -0)
packages/tui/internal/history/history_test.go (+197 -0)
📝 packages/tui/internal/tui/tui.go (+10 -0)

📄 Description

Implement command prompt history navigation in the TUI textarea component. Users can now navigate through previously submitted prompts using up/down arrow keys when the cursor is at the beginning or end of an empty or unmodified line.

  • Add PromptHistory and PromptHistoryIndex fields to app.App struct
  • Store submitted prompts in history when editorComponent.Submit is called
  • Add history navigation fields (history, historyIndex, historyModified) to textarea.Model
  • Implement shouldNavigateHistory() with proper conditions:
    • Single-line input only
    • Cursor at beginning (column 0)
    • Input empty or matches current history entry and unmodified
  • Add navigateHistoryUp() and navigateHistoryDown() methods
  • Add SetHistory() method to sync textarea history with app history
  • Include comprehensive unit tests for all navigation scenarios

History navigation is disabled when input is multiline, cursor is not at the beginning, or when the user has modified a recalled history entry.

🤖 Generated with opencode


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/987 **Author:** [@josephschmitt](https://github.com/josephschmitt) **Created:** 7/14/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (10+) - [`570ff8d`](https://github.com/anomalyco/opencode/commit/570ff8d4b4b473a180bb6576685feae5655ccc1b) feat(tui): add prompt history navigation with up/down arrows - [`e0caf83`](https://github.com/anomalyco/opencode/commit/e0caf831f9d47216f4b836c416cf44a25f3e9f59) feat: implement core HistoryStore component and integration - [`ed1fa94`](https://github.com/anomalyco/opencode/commit/ed1fa9475de6946db47edce1e1cf7a0fcba27129) feat: integrate HistoryStore with UI components and add /clear-history command - [`aa1533b`](https://github.com/anomalyco/opencode/commit/aa1533bba0dc50def3f5d57badd7abb31779ce39) feat: add unit tests and fix integration tests for history system - [`46af29f`](https://github.com/anomalyco/opencode/commit/46af29f0b207aa9bef5a02218cec38de7948bd00) feat: implement attachment restoration in arrow history navigation - [`84c33e8`](https://github.com/anomalyco/opencode/commit/84c33e88a33aad2a99dc918f5a18f8b1bec93d27) fix: resolve attachment restoration bug in history navigation - [`e050e78`](https://github.com/anomalyco/opencode/commit/e050e7841abbb7cb2a94fa17ba65d6c5de05e296) test: add comprehensive unit tests for attachment restoration fix - [`d54cd24`](https://github.com/anomalyco/opencode/commit/d54cd245923328733ef8616815cc6cafa82657c1) ignore: update download stats 2025-07-18 - [`31fa7bd`](https://github.com/anomalyco/opencode/commit/31fa7bd1f37bc7cb66179a3b5bd99734784df426) ignore: update download stats 2025-07-19 - [`0dcfa5e`](https://github.com/anomalyco/opencode/commit/0dcfa5ee19571274cd592bf6ca1567e75dd81955) ignore: update download stats 2025-07-20 ### 📊 Changes **20 files changed** (+2147 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `STATS.md` (+3 -2) ➕ `docs/arrow-history/prd.md` (+66 -0) ➕ `docs/arrow-history/tasks.md` (+121 -0) ➕ `docs/arrow-history/tech-spec.md` (+131 -0) ➕ `docs/arrow-history/technical-fix.md` (+296 -0) ➕ `docs/editor-history/prd.md` (+61 -0) ➕ `docs/editor-history/progress.md` (+143 -0) ➕ `docs/editor-history/tech-spec.md` (+171 -0) 📝 `packages/tui/internal/app/app.go` (+20 -0) 📝 `packages/tui/internal/commands/command.go` (+6 -0) 📝 `packages/tui/internal/components/chat/editor.go` (+47 -0) ➕ `packages/tui/internal/components/chat/editor_test.go` (+58 -0) 📝 `packages/tui/internal/components/chat/message.go` (+2 -10) 📝 `packages/tui/internal/components/list/list_test.go` (+6 -16) 📝 `packages/tui/internal/components/textarea/textarea.go` (+201 -2) ➕ `packages/tui/internal/components/textarea/textarea_test.go` (+452 -0) 📝 `packages/tui/internal/config/config.go` (+8 -0) ➕ `packages/tui/internal/history/history.go` (+148 -0) ➕ `packages/tui/internal/history/history_test.go` (+197 -0) 📝 `packages/tui/internal/tui/tui.go` (+10 -0) </details> ### 📄 Description Implement command prompt history navigation in the TUI textarea component. Users can now navigate through previously submitted prompts using up/down arrow keys when the cursor is at the beginning or end of an empty or unmodified line. - Add PromptHistory and PromptHistoryIndex fields to app.App struct - Store submitted prompts in history when editorComponent.Submit is called - Add history navigation fields (history, historyIndex, historyModified) to textarea.Model - Implement shouldNavigateHistory() with proper conditions: - Single-line input only - Cursor at beginning (column 0) - Input empty or matches current history entry and unmodified - Add navigateHistoryUp() and navigateHistoryDown() methods - Add SetHistory() method to sync textarea history with app history - Include comprehensive unit tests for all navigation scenarios History navigation is disabled when input is multiline, cursor is not at the beginning, or when the user has modified a recalled history entry. 🤖 Generated with [opencode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:08 -05:00
yindo closed this issue 2026-02-16 18:14:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9770