visidata icon indicating copy to clipboard operation
visidata copied to clipboard

Lag when scrolling

Open ansoncg opened this issue 1 year ago • 0 comments

Small description

When scrolling there is a lag after releasing the key and the scrolling does not go as fast as it should. I just installed and this happens on the tutorial sheet faa-wildlife-strikes.csv.

Expected result

When I release the key the scrolling stops. When I scroll the amount of movement is equal to the amount of keys sent. This is the behavior when I open the same file on Neovim.

Actual result with screenshot

No error.

Steps to reproduce with sample data and a .vd

Open the file and scroll with j and k. Only happens on a fast key rate.

Commandlog: #!vd -p {"longname": "open-file", "input": "faa-wildlife-strikes.csv", "keystrokes": "o"}

Additional context v2.9.1 Arch Linux, Xorg, Kitty terminal I use a different rate for key repetition then the default on Xorg. I always have xset r rate 300 50 on.

ansoncg avatar Aug 09 '22 06:08 ansoncg

Hi @ansoncg, the issue is that the screen is redrawn between every keypress, and this may take longer than the time between keypresses, depending on the kind of sheet, the computations that have to be done in the columns, and how big your terminal is. As you have the rate set to 50, this means that a keypress is coming in every 20ms. I tried flushing pending keystrokes after drawing, but the side effects were worse.

This commit prevents redrawing more often than every 100ms if keystrokes are pending. So in your case, it will batch your movements if it has to, and you'll see the cursor appear to jump multiple rows. But it should stop sooner and not accumulate actions, at least for simple commands like movements.

saulpw avatar Aug 12 '22 00:08 saulpw