Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the scrollbar postiton on scrollToMark #13291

Merged
3 commits merged into from
Jun 16, 2022

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Jun 13, 2022

When I moved this into ControlCore, I forgot that UserScrollViewport is usually triggered by the scrollbar updating, so it doesn't ask the UI to update. Since this logic is in ControlCore, it's sorta in a weird place where it needs to communicate both up and down:

  • update the Terminal's viewport position
  • update the TermControl's scrollbar position

Checklist:

When I moved this into ControlCore, I forgot that UserScrollViewport is usually triggered by the scrollbar updating, so it doesn't ask the UI to update. Since this logic is in ControlCore, it's sorta in a weird place where it needs to communicate both up and down:
* update the `Terminal`'s viewport position
* update the `TermControl`'s scrollbar position

* [x] Closes a bug bash bug
@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Product-Terminal The new Windows Terminal. labels Jun 13, 2022
@zadjii-msft zadjii-msft added this to the Terminal v1.15 milestone Jun 13, 2022
@github-actions

This comment was marked as resolved.

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Jun 16, 2022
Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com>
@ghost ghost requested review from PankajBhojwani, DHowett and lhecker June 16, 2022 20:02
@lhecker
Copy link
Member

lhecker commented Jun 16, 2022

Why doesn't _terminalScrollPositionChanged simply call UserScrollViewport?

@zadjii-msft
Copy link
Member Author

Why doesn't _terminalScrollPositionChanged simply call UserScrollViewport?

That's maybe an artifact of an older day. In the past there were definitely some weird feedback loops you could get into if you triggered a scrollbar update, from a scrollbar update, if that makes sense. So we separated out the scrolling actions - one for viewport updates that were initiated by the terminal itself (e.g. emitting newlines), and another for updates that were initiated by the user scrolling the viewport (e.g. with the scrollbar). These were _terminalScrollPositionChanged and UserScrollViewport, respectively.

This particular one is a weird case. This is basically a user initiated scroll, so typically those happen by updating the scrollbar itself, in TermControl, which eventually triggers a UserScrollViewport to tell the Terminal that the viewport is in a new place. However, the TermControl doesn't have the performant ability to do this lookup (hence, the move of this method from AppActionHandlers to ControlCore). So we go down into control core, but now it's sitting halfway between the scrollbar and the actual buffer, and now both need to be updated.

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jun 16, 2022
@ghost
Copy link

ghost commented Jun 16, 2022

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit f12ee74 into main Jun 16, 2022
@ghost ghost deleted the dev/migrie/b/scrollbar-update-on-scrollToMark branch June 16, 2022 21:55
@ghost
Copy link

ghost commented Jul 6, 2022

🎉Windows Terminal Preview v1.15.186 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants