-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Scroll cursor and page together (neovim-like scrolling) #8015
Scroll cursor and page together (neovim-like scrolling) #8015
Conversation
8c6d543
to
4f2a143
Compare
4f2a143
to
1fe59ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice this is now a very small/clean change that adds something that I find very useful. Thanks for working on this!
looks like formatting still needs to be fixed tough |
(and some clippy lints) |
Does this require the documentation to be updated? |
Can we get the labels changed on this so it gets reviewed? 😄 |
The labels don't really affect what we review too much. It's mostly for other people |
…#8015) * neovim like scroll function * clear line annotations outside of move_vertically/_visual * add nvim scroll function to commands * assign nvim-scroll to C-d and C-u (half page scrolls) * dont remove backspace and space mapping * move non-softwrap logic to seperate function, call this in nvim-scroll fn * Revert "move non-softwrap logic to seperate function, call this in nvim-scroll fn" This reverts commit e490572. * Revert "clear line annotations outside of move_vertically/_visual" This reverts commit 1df3fef. * add TODO for when inline diagnostics gets merged * move nvim-scroll logic into scroll(), dont respect scrolloff * run cargo fmt * run cargo clippy * update documenation for Ctrl-d and Ctrl-u remap
C-u/d config is no longer needed after helix-editor/helix#8015
…#8015) * neovim like scroll function * clear line annotations outside of move_vertically/_visual * add nvim scroll function to commands * assign nvim-scroll to C-d and C-u (half page scrolls) * dont remove backspace and space mapping * move non-softwrap logic to seperate function, call this in nvim-scroll fn * Revert "move non-softwrap logic to seperate function, call this in nvim-scroll fn" This reverts commit e490572. * Revert "clear line annotations outside of move_vertically/_visual" This reverts commit 1df3fef. * add TODO for when inline diagnostics gets merged * move nvim-scroll logic into scroll(), dont respect scrolloff * run cargo fmt * run cargo clippy * update documenation for Ctrl-d and Ctrl-u remap
…#8015) * neovim like scroll function * clear line annotations outside of move_vertically/_visual * add nvim scroll function to commands * assign nvim-scroll to C-d and C-u (half page scrolls) * dont remove backspace and space mapping * move non-softwrap logic to seperate function, call this in nvim-scroll fn * Revert "move non-softwrap logic to seperate function, call this in nvim-scroll fn" This reverts commit e490572. * Revert "clear line annotations outside of move_vertically/_visual" This reverts commit 1df3fef. * add TODO for when inline diagnostics gets merged * move nvim-scroll logic into scroll(), dont respect scrolloff * run cargo fmt * run cargo clippy * update documenation for Ctrl-d and Ctrl-u remap
…#8015) * neovim like scroll function * clear line annotations outside of move_vertically/_visual * add nvim scroll function to commands * assign nvim-scroll to C-d and C-u (half page scrolls) * dont remove backspace and space mapping * move non-softwrap logic to seperate function, call this in nvim-scroll fn * Revert "move non-softwrap logic to seperate function, call this in nvim-scroll fn" This reverts commit e490572. * Revert "clear line annotations outside of move_vertically/_visual" This reverts commit 1df3fef. * add TODO for when inline diagnostics gets merged * move nvim-scroll logic into scroll(), dont respect scrolloff * run cargo fmt * run cargo clippy * update documenation for Ctrl-d and Ctrl-u remap
…#8015) * neovim like scroll function * clear line annotations outside of move_vertically/_visual * add nvim scroll function to commands * assign nvim-scroll to C-d and C-u (half page scrolls) * dont remove backspace and space mapping * move non-softwrap logic to seperate function, call this in nvim-scroll fn * Revert "move non-softwrap logic to seperate function, call this in nvim-scroll fn" This reverts commit e490572. * Revert "clear line annotations outside of move_vertically/_visual" This reverts commit 1df3fef. * add TODO for when inline diagnostics gets merged * move nvim-scroll logic into scroll(), dont respect scrolloff * run cargo fmt * run cargo clippy * update documenation for Ctrl-d and Ctrl-u remap
Solves #7639 - adds a new scroll function so that the cursor and page jump by the same distance vertically. Assigns this to C-u and C-d, similar to neovim.
The consistent distance between cursor and view top would break if the cursor were to land on a whole line of virtual text- the cursor would be placed on the closest non-virtual text above where it landed. Meaning the view and cursor would not have jumped the same vertical distance.
This should be pretty rare though- unless you are using #6417 and have a ton of error messages. I could refactor this nvim-scroll function though- to first calculate how many lines the cursor jumped (eg the cursor tried to jump by half a page but could only jump by half a page -1 line due to virtual text) and then move the view by exactly this number. This would change the behaviour at the bottom of the page a bit also.
This nvim-scroll function respects the cursor's column throughout scrolls which I think is nice, I will make a pr for the
scroll
function to have the same.Closes #7639