Fix: Up arrow on wrapped lines navigates history instead of moving cursor#273833
Merged
Fix: Up arrow on wrapped lines navigates history instead of moving cursor#273833
Conversation
Change cursor position check to only enable history navigation when cursor is at line 1, column 1. This prevents accidental history navigation when pressing up arrow on wrapped lines. Co-authored-by: alexdima <5047891+alexdima@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cursor navigation on wrapped lines in chat
Fix: Up arrow on wrapped lines navigates history instead of moving cursor
Oct 28, 2025
alexdima
approved these changes
Oct 29, 2025
Member
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the cursor positioning logic when navigating to previous entries in chat input history. The change ensures that navigating backwards through history always positions the cursor at the start of the input (line 1, column 1), which allows continued upward navigation without interference from cursor position checks.
Key Changes
- Replaces complex wrapped-line cursor positioning logic with a simple cursor-to-start approach for previous history navigation
- Updates the "at top" cursor position check to only evaluate when the cursor is at line 1, column 1
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/chatInputPart.ts:1038
- The comment 'always leave cursor at the end' on line 1034 is now misleading. The
setValue()method is called fromnavigateHistory()withtransient: true, which then immediately overrides the cursor position (setting it to line 1, column 1 for previous navigation). The comment should clarify that the cursor position may be overridden by the caller, or should be removed since the behavior is no longer universal.
setValue(value: string, transient: boolean): void {
this.inputEditor.setValue(value);
// always leave cursor at the end
const model = this.inputEditor.getModel();
if (model) {
this.inputEditor.setPosition(getLastPosition(model));
}
Tyriar
approved these changes
Oct 29, 2025
Member
|
CI flake? |
dmitrivMS
pushed a commit
that referenced
this pull request
Oct 29, 2025
…rsor (#273833) * Initial plan * Fix cursor navigation in wrapped lines Change cursor position check to only enable history navigation when cursor is at line 1, column 1. This prevents accidental history navigation when pressing up arrow on wrapped lines. Co-authored-by: alexdima <5047891+alexdima@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexdima <5047891+alexdima@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Pressing up arrow on the second visual line of wrapped text in chat input incorrectly triggered history navigation instead of moving the cursor to the first line.
Changes
Cursor position detection: Changed
atTopcheck fromposition.lineNumber === 1 && position.column - 1 <= viewLineLengthtoposition.lineNumber === 1 && position.column === 1History navigation cursor positioning: Simplified
navigateHistory()to always position cursor at (1,1) when navigating backwardsFixes behavior where users accidentally triggered history when revising multi-line prompts.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.