Open ThomsonTan opened 9 years ago
Hi Thomson, yes it bothers me too, occasionally. But I don't know of any way to detect that the scroll is caused by the mouse or mouse wheel.
If you pull the latest version, I have exposed the minimum thresholds before SexyScroller will act.
You could try increasing them until mouse scrolling is no longer affected. But the value you need may depend on how fast you scroll your mouse, and how slowly your Vim is running!
" When scrolling pushes the cursor onto an empty line,
" the column could change a lot.
" This should eliminate that issue:
:let g:SexyScroller_MinColumns = 999
" OK let's tweak the more interesting value...
:let g:SexyScroller_MinLines = 2 " the old default
:let g:SexyScroller_MinLines = 3 " the new default
:let g:SexyScroller_MinLines = 5 " surely this should help
:let g:SexyScroller_MinLines = 15 " if this doesn't help, you must be scrolling fast!
:let g:SexyScroller_MinLines = 50 " you will only get smooth scroll for large jumps now
I would be interested to hear what value mitigates the issue for you. I will also be experimenting in my Vims. On this machine, 3
seems to help a lot. Cheers!
Testing now on Mac OS X,
:let g:SexyScroller_MinLines = 20
helps a bit, but SS still causes some lag in certain situations (noted below).
:let g:SexyScroller_MinLines = 70
helps a lot more! Setting that means SS will only provide animation for large jumps, but it seems like a worthwhile tradeoff. (70
is a value near to :echo &lines
.)
It seems that the problem specifically occurs when mouse wheel scrolling causes the cursor to hit the top/bottom of the window, which forces the cursor to start moving.
Could we solve it? Here is half of an idea:
It is possible to detect mouse scroll events with:
:nnoremap <ScrollWheelDown> :let g:SexyScrollerTempDisable = reltime()<CR>
but unfortunately that captures the mouse scroll event, so Vim doesn't move at all! If we could replay it, then this might be a way to disable SS during mouse scrolling. But so far I have not had any luck trying :call feedkeys("\<ScrollWheelDown>")<CR>
.
Even if I saw there is no way to fix this currently in the ReadMe, I still try to raise it here to seek any possibility to mitigate this. As using mouse occasionally, the repeated scrolling is very annoy.