Skip to content

feat(input): history recall via Up/Down + /history command (port upstream PR #265)#307

Merged
quangdang46 merged 5 commits into
masterfrom
feat/input-history-recall
May 25, 2026
Merged

feat(input): history recall via Up/Down + /history command (port upstream PR #265)#307
quangdang46 merged 5 commits into
masterfrom
feat/input-history-recall

Conversation

@quangdang46
Copy link
Copy Markdown
Owner

Port of upstream PR 1jehuang/jcode#265 (open). Adds input history recall — submitted inputs are remembered across the session so the user can press Up/Down to recall prior submissions.

Up   — recall previous submission (browses backward through history)
Down — recall next submission (browses forward; wraps to current draft)
/history input    — list all entries
/history input N  — load entry N into input box
/history search <term> — filter
/history delete N — remove one entry
/history clear   — wipe all

What ships

  • Ring buffer of submitted inputs (newest at end)
  • Persisted across session restart at <JCODE_HOME>/input_history.toml
  • Dedup adjacent duplicate entries
  • Status indicator while browsing
  • Multi-press Up navigation (each press goes one further back)
  • Reset on text-edit (browsing state cleared when user starts typing)

Conflict resolution

Tests

5 cherry-picked commits include the upstream test coverage:

  • multi-press Up arrow navigation
  • history reset on edit
  • /history input N parsing
  • dedup of consecutive duplicates
  • persist + clear round-trip

Refs upstream PR 1jehuang/jcode#265.

mmacedoeu added 5 commits May 25, 2026 07:01
- Add input_history ring buffer (max 100) and input_history_index to App
- Up arrow in empty input recalls previous submitted inputs
- Down arrow navigates forward through history, clearing at the end
- Any manual edit (typing, backspace) cancels history browsing
- Consecutive duplicate inputs are not stored
- /history lists all stored inputs with indices
- /history input N loads entry N into the input box
- Works in both local and remote TUI modes
- Help overlay updated with new keybindings and /history command
- 13 unit tests covering all history operations

Closes #264
…overage

- Up arrow now works when already browsing history (not just from empty input)
- Same fix applied to both local and remote key handlers
- reset_input_history_browse added to insert_input_text, undo_input_change, and remember_input_undo_state for comprehensive coverage
- Removed redundant reset calls from individual key handlers
- Added tests for multi-press Up navigation, Down when not browsing
- 15 total tests passing
… indicator

- /history clear: wipe all entries
- /history search <term>: case-insensitive search with match count
- /history delete N: remove specific entry
- Non-consecutive dedup: re-inserting existing text moves it to the end
- Persistent history: saved to ~/.jcode/input-history.json, loaded on startup
- Status bar indicator: shows '📋 history N/M' while browsing
- input_history_browse_status() added to TuiState trait
- 20 unit tests passing (7 new)
…/history input N

Round 1: save_input_history now deletes file when history is empty so
/clear doesn't leave stale data on disk.

Round 2: Update help overlay, autocomplete description, and add /history
to command_accepts_args. Remove duplicate inherent input_history_browse_status
method in favor of trait impl.

Round 3: Better error messages for /history delete and /history input
when history is empty. Add catch-all for unknown /history subcommands.
Remove double clone.

Round 4: Add missing sync_model_picker_preview_from_input() call on
/history input N.

Round 5: Save undo state before /history input N replaces input.
@quangdang46 quangdang46 merged commit 4e344e7 into master May 25, 2026
@quangdang46 quangdang46 deleted the feat/input-history-recall branch May 25, 2026 00:08
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