fix(tui): enter prompt history with Up only when the input is empty - #3111
fix(tui): enter prompt history with Up only when the input is empty#3111kimi-agent-bot wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 6dfd807 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@codex review |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0863e0520a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
What
Up-arrow prompt-history recall is now only entered when the input box is completely empty (or while already browsing history). With a draft in progress,
↑stays pure cursor movement: on the first visual line it just jumps to the line start, and never swaps the draft for a history entry.Why
Previously the entry condition was
first visual line && (empty || browsing || cursorCol === 0). ThecursorCol === 0clause meant that any draft could be swept into history browsing just by pressing↑at the start of the line — the root cause of draft-loss complaints (e.g. a held↑key racing the cursor to column 0 and beyond). Narrowing the entry condition eliminates that whole class of accidents by construction: history is only reachable from an empty input, so a draft in progress can never be carried into (or lost through) history browsing.Changes (all in vendored
packages/pi-tui)src/components/editor.ts—cursorUpbranch: drop thecursorCol === 0entry condition; entry now requiresisEditorEmpty() || historyIndex > -1. Continued↑/↓navigation while browsing is unchanged.src/components/editor.ts— dedicatedtui.editor.historyPreviousaction (no default binding; user-configurable): same empty-draft guard, so both recall entry points behave consistently.historyNextneeds no guard (already a no-op outside browsing).packages/pi-tui/AGENTS.md— registered as local divergence feat: add Ctrl-J newline shortcut in TUI prompt #9.Notes
cursorUpbranch as fix(tui): keep a held Up key from crossing into prompt history #3044 (held-Up repeat guard, pending local testing) and both branches register divergence feat: add Ctrl-J newline shortcut in TUI prompt #9 — whichever merges second, I'll rebase and renumber.