yuttie / comfortable-motion.vim

Brings physics-based smooth scrolling to the Vim world!
MIT License
634 stars 19 forks source link

Allow interruption of queued scroll commands - ability jerk back #27

Open bugeats opened 6 years ago

bugeats commented 6 years ago

Right now it's possible to repeatedly press the scroll command in a certain direction. As expected, the scroll commands will happily queue up and you'll find yourself several pages elsewhere. What would be really cool is if you could interrupt the queue. During the scrolling if you attempt to scroll in the opposite direction, the motion will immediately stop. This is very much like how we all intuitively use scroll panes on our touch devices. Give it a flick, and then press your thumb down when see the destination arrive.

Right now what happens is that after all the forward commands finish, the back command then plays out subsequently.

yuttie commented 6 years ago

@bugeats

Give it a flick, and then press your thumb down when see the destination arrive.

Ah, yes, it must be nice.

It can be realized by providing a way to directly set the velocity to 0. It would be also nice to have a helper function that works like comfortable_motion#flick() but, if a given direction is opposite to the current scrolling, stops the scroll immediately.

Right now what happens is that after all the forward commands finish, the back command then plays out subsequently.

There is no queue in my implementation. Previously, there was the possibility that two simulation threads run in parallel, and I think what you saw was caused by the problem.

By the merged PR #23, I believe this queue-like behavior is now fixed.