psliwka / vim-smoothie

Smooth scrolling for Vim done rightšŸ„¤
MIT License
988 stars 27 forks source link

Can't scroll up past long wrapped text #18

Closed Meptl closed 3 years ago

Meptl commented 4 years ago

Likely the same cause as #16.

Looks to be caused by wrapped lines longer than a single wrap. ~A single wrap works fine.~ I have seen cases of single wraps not working but am finding them to be difficult to reproduce. Example file of just numbers and a long line at line 50: https://gist.github.com/Meptl/2789e4c9ec7ef3c5b54c549d3b2998a0

Versions:

Steps to reproduce:

  1. set wrap
  2. Resize your window until the long text line wraps atleast twice
  3. Scroll past the wrapped text
  4. Attempt to scroll up using or

I do have an assortment of plugins and have not isolated vim-smoothie.

The fork referenced linked in #16 works, but I'm not a fan of the gg implementation there so would prefer this issue be fixed upstream. I also used the latest of the PR at https://github.com/psliwka/vim-smoothie/pull/13 to no avail.

Love this plugin btw :)

psliwka commented 4 years ago

Sorry, I couldn't reproduce this neither under neovim 0.4.3 nor vim 8.2. Scrolling over severely wrapped line works fine for me: https://streamable.com/5fjq76. Am I missing something?

Also, could you please re-test with up-to-date nvim?

Meptl commented 4 years ago

I believe the issue is caused by one of my vim configurations. I have a set scrolloff=999 which always keeps my cursor in the center of my vim window.

Testing with:

I want to say this occurs when scrolloff is greater than half the number of rows in vim this occurs, but the single vs multiwrap situation is still hard for me to reproduce. Playing around with the numbers. (Same steps to reproduce as before; Matching your video)

11 rows (this includes the lines from wrapped text) + scrolloff=6 12 rows (this includes the lines from wrapped text) + scrolloff=7 14 rows (this includes the lines from wrapped text) + scrolloff=8

27 rows + scrolloff=13 Works but the scrollup final line number is off by one. i.e. Press at line 45 will return you to line 44 27 rows + scrolloff=14 Stops at 1 line above the wrapped lines (line 49)

MasterMedo commented 3 years ago

This has been happening constantly to me recently. I have isolated vim-smoothie in the init.vim:

call plug#begin('~/.vim/plugged')
    Plug 'psliwka/vim-smoothie'
call plug#end()
set scrolloff=9

This bug is extremely hard to reproduce, it depends on the scrolloff value, width of the terminal, height of the terminal, number of wraps in a line, positions of wrapped lines in the file and god knows what more. I can reproduce the bug consistently with the given init.vim, terminal width of 85, terminal height of 22 (gotten with tput cols and tput lines respectively) and the following file tmp:

1
2
3
4
5
6
7
8
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaa
9
10
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaa
10
11
12
13
14
15
16
17
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaa

With this particular setup neither scroll down nor scroll up work correctly with vim-smoothie, but work flawlessly without it. Changing the font size, terminal width, terminal height, scrolloff value or even positions of lines in the file removes the bug completely.

vim version: NVIM v0.5.0-762-g9817d9914 terminal: st 0.8.2 shell: fish, version 3.1.2

I can post a gif if needed. EDIT: might be worth noting I'm scrolling using CTRL-D and CTRL-U. EDIT 2: reproducable with NVIM v0.4.4 completely, partially reproducable with VIM - Vi IMproved 8.2 (only scroll up doesn't work when scrolling from the bottom of the file, scroll down works but is laggy)

subnut commented 3 years ago

I got a GIF -

gifcast_201116180502

subnut commented 3 years ago

@MasterMedo Thank you for the excellent repro steps :+1: I have tried to fix this issue in #21 Please test.

Thank you

MasterMedo commented 3 years ago

Yep, switching to 'subnut/vim-smoothie' fixes the issue.

subnut commented 3 years ago

A gentle warning...

As you may have seen already, I frequently force-push my fork. That happens because I frequently need to go back and make changes to some older commit, so I rebase and force-push the changes.

If you choose to stay on my fork till #21 is merged (I contact Piotr, he said he's gonna merge it in a week), then I suggest you to not git pull frequently, as it will always result in a merge conflict :sweat_smile: and shall need to be resolved by git reset --hard origin/master

MasterMedo commented 3 years ago

Oh no biggie, I pulled with plug anyway. PlugClean, PlugInstall to the rescue. I'll port back to the original repo when things get merged. Thanks for the heads up, though!