Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zt goes all the way up and zb goes all the way to down #11

Closed
numToStr opened this issue Apr 5, 2021 · 7 comments
Closed

zt goes all the way up and zb goes all the way to down #11

numToStr opened this issue Apr 5, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@numToStr
Copy link
Contributor

numToStr commented Apr 5, 2021

First of all thanks for this lovely plugin ❤️ . This plugin is awesome.

Back to the issue, So, When you press zt, the cursor goes all the way to the top, and zb goes all the way down but zz works great. This is not the expected behavior of the vanilla commands.

neoscroll-2.mp4
@karb94
Copy link
Owner

karb94 commented Apr 5, 2021

Do you have scrolloff set to 999 by any chance?

@numToStr
Copy link
Contributor Author

numToStr commented Apr 5, 2021

No, my scrolloff is 8. In fact, other commands i.e. <C-u>, <C-d> are working just fine.

@karb94
Copy link
Owner

karb94 commented Apr 5, 2021

I can't reproduce. It's weird because there is not much going on in the wrapper functions for zt/zb. The lines to scroll are calculated based on the cursor position in the window (which I assume is fine given that <C-u> and <C-d> work for you) and the local scrolloff value. Can you please double check that if you run

:lua print(vim.wo.scrolloff)

you get a value of 8?

@numToStr
Copy link
Contributor Author

numToStr commented Apr 5, 2021

So, I think there is something wrong. When I run :lua print(vim.o.scrolloff) I get a value of 8 but when I run :lua print(vim.wo.scrolloff) i get this 1.4065270751731e+14. 🤯

@numToStr
Copy link
Contributor Author

numToStr commented Apr 5, 2021

After vim.wo.scrolloff=8 everything works fine.

@karb94 Your plugin is working fine. I think you can close this issue.

@karb94
Copy link
Owner

karb94 commented Apr 5, 2021

I see... local scrolloff looks kind of broken to me. When it is not set it just display a garbage value instead of the global one. I don't know if this is the expected behaviour (I hope not). I'll open an issue about this.

Because of this it is impossible for me to tell if you have set a local scrolloff value different from the global one. I added a temporary fix (930f823) by checking that the local scrolloff value is lower than the window height otherwise I use the global value.

Let me know if this fix doesn't work for you.

@karb94 karb94 closed this as completed Apr 5, 2021
@karb94
Copy link
Owner

karb94 commented Apr 5, 2021

Indeed, this appears to be a bug: neovim/neovim#13964

I'll keep track of it and update the code when it gets resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants