Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 3, 2025

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 TopCommand uses VerticalRevealType.Simple which 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 TopCommand to detect when the cursor reaches the very beginning of the buffer (line 1, column 1) and uses VerticalRevealType.Top instead of the default reveal behavior. This ensures the editor scrolls to include the full padding area above the first line, eliminating the shadow artifact.

// Before: Always used default reveal behavior
viewModel.revealAllCursors(args.source, true);

// After: Use padding-aware reveal when at absolute beginning
const primaryCursor = newCursorStates[0];
if (primaryCursor && primaryCursor.modelState.position.lineNumber === 1 && primaryCursor.modelState.position.column === 1) {
    // Show full padding area
    const range = Range.fromPositions(primaryCursor.modelState.position);
    const viewRange = viewModel.coordinatesConverter.convertModelRangeToViewRange(range);
    viewModel.revealRange(args.source, true, viewRange, VerticalRevealType.Top, ScrollType.Smooth);
} else {
    // Default behavior for other positions
    viewModel.revealAllCursors(args.source, true);
}

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.org
    • Triggering command: node-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.

Copilot AI changed the title [WIP] Chat input isn't scrolled to the top when ctrl+home is used Fix chat input not scrolling to top with padding when Ctrl+Home is used Sep 3, 2025
Copilot AI requested a review from hediet September 3, 2025 09:52
@hediet hediet added this to the September 2025 milestone Sep 3, 2025
@hediet hediet modified the milestones: September 2025, October 2025 Sep 30, 2025
@hediet hediet modified the milestones: October 2025, November 2025 Nov 6, 2025
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.

Chat input isn't scrolled to the top when ctrl+home is used

2 participants