mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 17:00:59 +00:00
feat(tui): add prompt history navigation with Up/Down arrows
Browse previously submitted prompts using Up/Down arrow keys, similar to shell history and Claude Code's prompt history feature. - Up arrow when editor is empty: browse to older prompts - Down arrow when browsing: return to newer prompts or clear editor - Cursor movement within multi-line history entries supported - History is session-scoped, stores up to 100 entries - Consecutive duplicates are not added to history Includes 15 new tests for history navigation behavior.
This commit is contained in:
parent
029a04c43b
commit
c550ed2bca
5 changed files with 350 additions and 18 deletions
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- **Prompt History Navigation**: Browse previously submitted prompts using Up/Down arrow keys when the editor is empty. Press Up to cycle through older prompts, Down to return to newer ones or clear the editor. Similar to shell history and Claude Code's prompt history feature. History is session-scoped and stores up to 100 entries.
|
||||
|
||||
## [0.12.10] - 2025-12-04
|
||||
|
||||
### Added
|
||||
|
|
|
|||
|
|
@ -661,6 +661,8 @@ Change queue mode with `/queue` command. Setting is saved in `~/.pi/agent/settin
|
|||
|
||||
**Navigation:**
|
||||
- **Arrow keys**: Move cursor (Up/Down navigate visual lines, Left/Right move by character)
|
||||
- **Up Arrow** (empty editor): Browse previous prompts (history)
|
||||
- **Down Arrow** (browsing history): Browse newer prompts or return to empty editor
|
||||
- **Option+Left** / **Ctrl+Left**: Move word backwards
|
||||
- **Option+Right** / **Ctrl+Right**: Move word forwards
|
||||
- **Ctrl+A** / **Home**: Jump to start of line
|
||||
|
|
|
|||
|
|
@ -516,6 +516,9 @@ export class TuiRenderer {
|
|||
// Update pending messages display
|
||||
this.updatePendingMessagesDisplay();
|
||||
|
||||
// Add to history for up/down arrow navigation
|
||||
this.editor.addToHistory(text);
|
||||
|
||||
// Clear editor
|
||||
this.editor.setText("");
|
||||
this.ui.requestRender();
|
||||
|
|
@ -526,6 +529,9 @@ export class TuiRenderer {
|
|||
if (this.onInputCallback) {
|
||||
this.onInputCallback(text);
|
||||
}
|
||||
|
||||
// Add to history for up/down arrow navigation
|
||||
this.editor.addToHistory(text);
|
||||
};
|
||||
|
||||
// Start the UI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue