Skip to content

Conversation

@marcocondrache
Copy link
Contributor

@marcocondrache marcocondrache commented Dec 14, 2025

Closes #4355

This is still a WIP, but it already works well. At 240 fps, it feels smooth like butter.

Ref: https://pavelfatin.com/scrolling-with-pleasure

Release Notes:

  • Editor now supports smooth scrolling

Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 14, 2025
@github-project-automation github-project-automation bot moved this to Community Champion PRs in Quality Week – December 2025 Dec 14, 2025
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
@MrSubidubi MrSubidubi self-assigned this Dec 15, 2025
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
@niekdomi
Copy link
Contributor

Thanks for this PR, feels smooth. Are there any plans to integrate this into vim-mode as well?

(e.g., ctr-y, ctrl-e, ctrl-b, ctrl-f, ctrl-d, ctrl-u, zz, zt, zb)

or is this not part of this PR?

@marcocondrache
Copy link
Contributor Author

@niekdomi yep, I still need to make the changes. I'm currently perfecting the scroll animation

Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
Signed-off-by: Marco Mihai Condrache <[email protected]>
the set_scroll_position of the editor saves to the db the position and
creates event which is wasteful for an animation

Signed-off-by: Marco Mihai Condrache <[email protected]>
update.position, &snapshot, cx,
);

window.request_animation_frame();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree this isn’t the ideal approach for animations, especially in the editor, since it causes the whole entity to re-render. That said, in practice it doesn’t seem to make a noticeable difference right now.

The current scrolling implementation in the editor already calls cx.notify() on every scroll event, so the animation isn’t doing anything fundamentally different in that regard. In fact, it may even be slightly more efficient, since we avoid updating the db and emitting events until the animation has finished, which is the opposite of how the current scroll handling works.

I’m very open to improving this if you think there’s a better direction, but wanted to share the reasoning behind the current approach

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 community champion

Projects

Status: Community Champion PRs

Development

Successfully merging this pull request may close these issues.

Smooth scrolling

3 participants