Fix chat input not scrolling to top with padding when Ctrl+Home is used #264883
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.
When pressing Ctrl+Home in the chat input field, the cursor moves to the beginning of the buffer but the editor doesn't scroll properly to include the top padding area. This leaves a visible shadow artifact indicating there's more content above, even though the cursor is at the absolute beginning.
The issue occurs because the
TopCommandusesVerticalRevealType.Simplewhich performs minimal scrolling and doesn't account for editor padding. Chat inputs have top padding configured ({ top: 8, bottom: 8 }or{ top: 2, bottom: 2 }in compact mode), but this padding area remains hidden after Ctrl+Home.This change modifies the
TopCommandto detect when the cursor reaches the very beginning of the buffer (line 1, column 1) and usesVerticalRevealType.Topinstead of the default reveal behavior. This ensures the editor scrolls to include the full padding area above the first line, eliminating the shadow artifact.The fix is targeted and safe - it only affects the specific case where Ctrl+Home moves the cursor to the absolute beginning, while maintaining existing behavior for all other cursor positions.
Fixes #260977.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
electronjs.orgnode-gyp(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.