Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.48k stars 171 forks source link

Feature request: animated scroll #3205

Closed CrendKing closed 2 years ago

CrendKing commented 3 years ago

https://github.com/Alexey-T/CudaText/issues/1762 tracked the request to implement smooth scroll, which enables per-pixel scroll to the scrollbar. However it is relatively rare to drag the scrollbar when most users have scroll wheel. Many popular editors have the per-pixel scrolling on scroll wheel, such as VSCode, Atom (with tweak), SublimeText, etc. Admittedly, the first two has Chromium to thank to.

To me, the smooth transition between lines with the animated scroll helps a lot to keep track of where I want the destination to land. It feels more natural like scanning lines of book. Whereas when it is line-based jumpy scroll, I have to stop the scroll from time to time to check if I've reached the destination.

If there is concern of resource-heavy for the feature, implement it as a setting and default to disabled satisfies everybody.

Alexey-T commented 3 years ago

Made it (for wheel scroll only, not for pageUp/pgDn). pls try the beta http://uvviewsoft.com/c/

CrendKing commented 3 years ago

Thank you! Guess it's not that hard in the end.

Is there a way to adjust the number of lines each scroll skips? Currently each mousewheel tick scrolls 3 lines. I tried mouse_scroll_speed_vert but seems not effective. Also tried changing the scroll speed in Windows Control Panel and not working. Features like https://github.com/Alexey-T/CudaText/issues/2238 could be nice, but I'm just asking about changing 3 to something like 10.

Also, it'd nice if we could adjust the animation speed. Currently it feels too slow for me.

Alexey-T commented 3 years ago

This opt controls it, checked it, it's working Screenshot from 2021-03-02 14-17-08

value 8 makes 8 lines. Beta update! added option "scroll_animation". Pls try

CrendKing commented 3 years ago

Thanks for the config name. It works.

I see how you implement the animation. Basically you break the scroll into steps, with each step scrolling mouse_wheel_speed_vert / num_steps lines, adding a delay after each step. It certainly is an improvement over not having the animation. But comparing to how VSCode's scroll (and browsers), it's just not "right".

The biggest problem is number of frames. Human eyes can detect very subtle movement. You can easily tell the difference between a 60Hz monitor and 144Hz monitor, because for the same duration there are more than twice as many as frames. So for example, instead of 4, 10, I tried 40, 0. Scroll now is smooth, but takes too long to complete and jumps at the end of each scroll.

Second problem is that the animation is linear. Modern browser's smooth scroll all have accelerated animation. They start moving fast at beginning, and slow down at the end of the animation.

I know these two requests may not be easy to do, but I just don't want you to rush a feature. If you need me to test more feel free to ask.

Alexey-T commented 3 years ago

and jumps at the end of each scroll.

CrendKing commented 3 years ago

Understandable. Thanks.

https://github.com/amit115532/SmoothScrolling/blob/master/Smooth%20Scrolling/SmoothScrollMouseProcessor.cs is the engine file for a Visual Studio smooth scroll extension I had experience on. It's not perfect, but good enough as starter for reference.

JairoMartinezA commented 3 years ago

Alex,

Consider if is possible to add this "scrolling" when you are searching, currently ST shows this same smooth moving when reach to the first match.

JairoMartinezA commented 3 years ago

Even I imagine this kind of moving using the Go to: functionality :bowtie:, of course if it have no impact on CPU performance.

Alexey-T commented 3 years ago

GoTo or Find--much later. first off, I must work on FAST scrolling for m-wheel. it's possible.

Alexey-T commented 3 years ago

making fast scrolling on m-wheel: idea (how to do it) won't work on macOS/Linux-Qt5. it will work on Win/Linux-gtk2. but is it needed on Windows? no, option value "20,0" (20 steps) works fast already. (Intel i3 CPU).

on Linux-gtk2 - only here it's needed. I doubt I want to make work ONLY for Lin-gtk2

CrendKing commented 3 years ago

is it needed on Windows? no, option value "20,0" (20 steps) works fast already. (Intel i3 CPU).

Maybe there's some misunderstanding. Here's some video to show the difference between cudatext (1.127.2.2) and VSCode on Windows 10. Both are set to skip 10 lines per tick. Notice how snappy VSCode reacts to the mousewheel movement, whereas on cudatext I have to wait for like 2 seconds for the animation to finish.

Also, in VSCode if user keeps scrolling, it will start skipping more than 10 lines per tick. Basically an acceleration.

Also I feel the implementation of the released 1.127.2.2 is substantially different to the beta you earlier provided. It is way slower and choppy now.

cudatext: https://streamable.com/dnp7ze VSCode: https://streamable.com/0a9lyd

Alexey-T commented 3 years ago

reverted; removed slow code yet. on next iteration I will add faster code. you will help if you make some blog post about Cud (not short), or youtube video (not short). it will help me to work. on scrolling too.

CrendKing commented 3 years ago

Well, I'm not blogger or youtuber. I don't have a website or channel for content promotion. I'm just a regular engineer, interested in an promising text editor. The animated scrolling is one of the features that I'm missing much from switching, so I hope you could implement it. And I'm sure I'm not the only one expecting the feature. However, if it is too much work, I don't want you to feel like obligated to do this. Please take your time, or close the ticket if that's it. If you are seeking for physical compensation for this work, I'm sorry I can't pay for it, just to be clear.

I'll surely recommend cudatext to others in places like Reddit under right context.

Alexey-T commented 2 years ago

no plan to implement this yet, so closing, sorry.