psliwka / vim-smoothie

Smooth scrolling for Vim done right🥤
MIT License
988 stars 27 forks source link

Handle slow UIs gracefully #19

Open psliwka opened 4 years ago

psliwka commented 4 years ago

Smooth scrolling, due to its nature, causes enormous amount of screen redraws. This is a problem when the redraw operation is particularly slow, f.ex. when running over a low-bandwidth SSH connection, or low-performance RPC pipelines, such as described in #17.

Minimal solution

As a bare minimum, the plugin should allow users to disable smooth scrolling on demand (f.ex. via dedicated variable or command), so that they can help themselves ad-hoc when the UI feels slow.

Optimal solution

Ideally, the plugin would detect as many slow-UI cases as possible, and automatically disable itself till the end of current editing session (or even better, adjust the animation frame rate dynamically to current conditions).

WhyNotHugo commented 4 years ago

Detecting redraw speed and adjusting animation rate dynamically seems far outside the scope of what one would expect of a Vim plugin.

Probably a command to turn it on-off should suffice. You can always configure a hotkey for that command or use a separate refresh-rate-detection plugin to call that command.

subnut commented 3 years ago

I have tried to implement the minmal solution @psliwka mentioned in his post above

Please test #21 using the following config -

let g:smoothie_disabled = 1

and report bugs, if any

subnut commented 3 years ago

@psliwka We could use the ttyfast option to implement the optimal solution

You agree?


:help ttyfast
                                     *'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
'ttyfast' 'tf'          boolean (default off, on when 'term' is xterm, hpterm,
                                        sun-cmd, screen, rxvt, dtterm or
                                        iris-ansi; also on when running Vim in
                                        a DOS console)
                        global
        Indicates a fast terminal connection.  More characters will be sent to
        the screen for redrawing, instead of using insert/delete line
        commands.  Improves smoothness of redrawing when there are multiple
        windows and the terminal does not support a scrolling region.
        Also enables the extra writing of characters at the end of each screen
        line for lines that wrap.  This helps when using copy/paste with the
        mouse in an xterm and other terminals.
psliwka commented 3 years ago

@psliwka We could use the ttyfast option to implement the optimal solution

Please correct me if I'm wrong, but ttyfast seems to be always on in current terminal world – almost all terminal emulators are xterm descendants or disguise themselves as such. Neovim devs even deprecated this option completely. Therefore, I doubt its value would carry any information useful for us.

subnut commented 3 years ago

Hm.... that's true...

But we could instruct the users to set this option when using a slow connection, because this option was meant for that...

:shrug: