Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Smart scroll in the Output view originally locked/unlocked based on cursor position. This PR adds scroll-based unlocking while retaining the original cursor-based behavior, providing users with two ways to re-enable auto-scrolling.

Changes

outputView.ts

  • Retain onDidChangeCursorPosition listener for original cursor-based behavior
  • Add onDidScrollChange listener for new scroll-based behavior
  • Check scrollTopChanged to filter horizontal scroll events
  • Both behaviors work together: unlock by clicking last line OR scrolling to bottom
  • Lock logic for scroll: scrollLock = !(scrollTop + viewportHeight >= scrollHeight)

output.contribution.ts

  • Update setting description to reflect both cursor and scroll-based behaviors

outputView.test.ts

  • Add unit tests for scroll lock states at different positions

Implementation

Both listeners now coexist:

// Original cursor-based behavior
this._register(codeEditor.onDidChangeCursorPosition((e) => {
    if (e.reason !== CursorChangeReason.Explicit) return;
    if (!this.configurationService.getValue('output.smartScroll.enabled')) return;
    
    const model = codeEditor.getModel();
    if (model) {
        const newPositionLine = e.position.lineNumber;
        const lastLine = model.getLineCount();
        this.scrollLock = lastLine !== newPositionLine;
    }
}));

// New scroll-based behavior
this._register(codeEditor.onDidScrollChange((e) => {
    if (!e.scrollTopChanged) return;
    if (!this.configurationService.getValue('output.smartScroll.enabled')) return;
    
    const layoutInfo = codeEditor.getLayoutInfo();
    const isAtBottom = e.scrollTop + layoutInfo.height >= e.scrollHeight;
    this.scrollLock = !isAtBottom;
}));

Users can now unlock auto-scrolling by:

  1. Clicking on the last line (original behavior)
  2. Scrolling to the bottom (new enhancement)
Original prompt

This section details on the original issue you should resolve

<issue_title>Smart Scroll: Unlock when scrolling down to the last line</issue_title>
<issue_description>I would like to propose to improve the useability of smart scroll.
If I have a lot of console output, it is nice that it automatically locks the scrolling so I can read an output.
But if I then want to unlock and see the newest output its quite inconvenient having to click that last line or click the lock icon.

Feature request: Unlock when scrolling down to the last line.

With this solution, there would be no need to click anything. Just scrolling with the mouse would do all the work.

image</issue_description>

<agent_instructions>Check this comment on what to implement

#127063 (comment)</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@roblourens I was about to file the same issue, and I think this should be assigned to @sandy081, just checking. Some more motivation:
  • Open output channel
  • cmd+f, find something
  • The output channel editor scrolls to the match
  • Then more output loads, and it scrolls back to the bottom

Put another way, I think that smart scroll should not be based on the cursor position, but on the editor scroll position, and it should be enabled when I scroll to the bottom and disabled when I scroll up.</comment_new>


✨ 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 and others added 4 commits December 15, 2025 14:56
Co-authored-by: sandy081 <10746682+sandy081@users.noreply.github.com>
Co-authored-by: sandy081 <10746682+sandy081@users.noreply.github.com>
Co-authored-by: sandy081 <10746682+sandy081@users.noreply.github.com>
Co-authored-by: sandy081 <10746682+sandy081@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feature to unlock smart scroll when scrolling down Smart scroll: Use scroll position instead of cursor position Dec 15, 2025
Copilot AI requested a review from sandy081 December 15, 2025 15:13
Copy link
Member

@sandy081 sandy081 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Retain the old behaviour - which is using cursor position at the end

Co-authored-by: sandy081 <10746682+sandy081@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot Retain the old behaviour - which is using cursor position at the end

Restored the original cursor-based behavior alongside the scroll-based behavior. Both now work together - users can unlock by clicking the last line (original) or by scrolling to the bottom (new). (b5a7478)

Copilot AI changed the title Smart scroll: Use scroll position instead of cursor position Smart scroll: Add scroll position behavior alongside cursor position Dec 15, 2025
Copilot AI requested a review from sandy081 December 15, 2025 16:38
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.

Smart Scroll: Unlock when scrolling down to the last line

2 participants