Skip to content

editor: Smooth scroll#31671

Closed
hocman2 wants to merge 16 commits intozed-industries:mainfrom
hocman2:smooth-scroll
Closed

editor: Smooth scroll#31671
hocman2 wants to merge 16 commits intozed-industries:mainfrom
hocman2:smooth-scroll

Conversation

@hocman2
Copy link

@hocman2 hocman2 commented May 29, 2025

Closes #4355

I had initially opened a discussion here: #31518
but upon reflexion a pull request seems more explicit

Release Notes:

  • Added a ScrollAnimationManager object attached to ScrollManager
  • Added two settings, one for enabling smooth scrolling, the other to control the time to scroll
  • Edited OngoingScroll struct to support a try_use_anim flag
  • Edited set_anchored_scroll (remote as well) and set_scroll_position to start an animation if possible instead of scrolling instantaneously

hocman2 added 9 commits May 26, 2025 10:54
Works for mouse wheel scroll and vim's C-u C-d motions. have yet to work
on anchored scroll
The current scroll speed is duration based (with hardcoded constant), it
should be changed to be speed based with a max time in the future
It made more sense and fixed bugs with autoscroll
Since this function was only called at two places I took this liberty to
make it more reliable wether we should use the smooth scrolling or not
(with respect to enabled setting)
This is necessary to disable smooth scrolling with trackpad because the
scrolling is already pixel based in this case
This new implementation directly requires the final ScrollAnchor and
top_row and works from that to compute intermediate values
With this new implementation the update_animation function directly uses
set_anchor(), removing the need of ScrollInstigator altogether

These changes were necessary to implement anchored scroll (ones that use
set_scroll_anchor) in a later commit

There is a bug when clicking on the scrollbar directly that I must fix
@cla-bot
Copy link

cla-bot bot commented May 29, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @hocman2 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@hocman2
Copy link
Author

hocman2 commented May 29, 2025

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented May 29, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @hocman2 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented May 29, 2025

The cla-bot has been summoned, and re-checked this pull request!

@cla-bot
Copy link

cla-bot bot commented May 29, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @hocman2 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@hocman2
Copy link
Author

hocman2 commented May 29, 2025

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 29, 2025
@cla-bot
Copy link

cla-bot bot commented May 29, 2025

The cla-bot has been summoned, and re-checked this pull request!

@ConradIrwin
Copy link
Member

Thanks for this! Having played with the prototype a little bit, I think we should not ship this.

A core goal of Zed is speed; and currently this makes Zed feel much slower.

I do know there are reasons we might want to add some kind of animation to scrolling, but if we do, it needs to be done in a way that doesn't get in the way of feeling snappy.

@ConradIrwin ConradIrwin closed this Jun 3, 2025
@Zvbhrf
Copy link

Zvbhrf commented Jun 6, 2025

Just wanted to enable smooth scrolling and got into this pull request and issue - a bit disappointed, really.

I understand that the goal is speed, but there are people who also would prefer smoothness and better readability. For me it is really harder to focus on specific lines of code during scrolling, my eyes need some time to recognize the text (and it takes about 0.5s for me) - that's how my mind or eyes work, idk? (and I feel some tense in eyes during stuttering scrolling)

A core goal of Zed is speed; and currently this makes Zed feel much slower.

Yes, but the smooth scrolling is disabled by default, which won't make Zed feel "much slower" at first glance. If the user wants it - maybe let him do that?

@hocman2
Copy link
Author

hocman2 commented Jun 6, 2025

Just wanted to enable smooth scrolling and got into this pull request and issue - a bit disappointed, really.

I understand that the goal is speed, but there are people who also would prefer smoothness and better readability. For me it is really harder to focus on specific lines of code during scrolling, my eyes need some time to recognize the text (and it takes about 0.5s for me) - that's how my mind or eyes work, idk? (and I feel some tense in eyes during stuttering scrolling)

A core goal of Zed is speed; and currently this makes Zed feel much slower.
Yes, but the smooth scrolling is disabled by default, which won't make Zed feel "much slower" at first glance. If the user wants it - maybe let him do that?

I agree with you, smooth scrolling helps quite a bit when navigating with keyboard (vim mode) but in this case it makes the scroll wheel navigation quite unresponsive and this might be why it was not merged.
Maybe some tweaks to the interpolation function and a bigger focus on the scroll wheel issue could make this implementation match their vision.

@gg0074x
Copy link

gg0074x commented Oct 11, 2025

I was searching for a setting to enable smooth scrolling and i feel very disappointed to find this PR Closed.
I understand the implementation might need some tweaks but i feel they should reconsider this idea, i currently use Auto-scroll on Clicks which is very annoying to use without smooth scrolling, it makes me lose track of the lines very quickly.

I think implementing this as an option (false by default) is adequate, i wouldn't mind to sacrifice speed to smooth scrolling and id say its preferred that way by many other users who want this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Smooth scrolling

5 participants