Repository navigation
Restore next-history selection after Ctrl-O - #2173
Open
ViktorBystrov72 wants to merge 1 commit into
Open
ViktorBystrov72 wants to merge 1 commit into
ViktorBystrov72 wants to merge 1 commit into
Conversation
Apply the next history position after the following prompt finishes loading its history. Track the position from the end so partially loaded history and appending the accepted command do not shift the target. Only schedule the operation after successful validation. Leave the buffer alone if the user edits it or selects another history entry while loading. Ignore stale, cancelled, and failed history loads. Add prompt-session regressions for memory and threaded history, partial loads, duplicate entries, input during loading, and validation failure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1936 and #1504.
Ctrl-O accepts the selected history entry, but the next prompt remains empty: the saved history index is applied before the buffer's asynchronous history load has populated its working lines.
Select the next entry after that load completes. Keep the position relative to the end so partially loaded history and duplicate entries retain the correct position, accounting for whether accepting the command appended a history entry. Skip the pending selection if the user has already edited or navigated the next prompt, and don't queue it when validation rejects Ctrl-O.
The 14 regression cases use real
PromptSessioninput, bothInMemoryHistoryandThreadedHistory, duplicate commands, explicitly paused history loads, intervening typing/navigation, and rejected validation. Synchronization uses events, not timing sleeps. Nine cases fail on unmodified main and five are passing controls; all pass with the fix.Validation on macOS, Python 3.13.13:
git diff --checkpassed.OpenAI Codex assisted with implementation, tests, and this description. The reported checks were run locally; no human review is claimed.