-
-
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
Neovim-like exact scrolling #7639
Comments
I think what you mean (and what nvim does) is a to have a separate command/key to move the cursor and view at the same time instead of making the scrolloff drag the cursor along. That could be reasonable. Could you link your implementation? |
If we add this this should be a separate command tough and not a config option (that means we won't be able to change mouse scroll until that is prebindable but I am fine with that) |
Yeh thats a good way to describe it- https://github.com/AlexanderDickie/helix/tree/scroll-cursor-and-page (This is a rough implementation and doesnt give the behaviour I want in a few edge cases, I would redesign it for the pr). The behaviour I want is- the position of the cursor relative to the view is always constant (except when scrolling down from a row with idx 0-scrolloff/ scrolling back up one of these rows) and you can always get back to a previous position, for any consecutive sequence of these cursor+view scrolls. I also like how when you do C-d and land on a new row, the column idx is not at 0, but at the min(row_len, old_visual_position_row)- same behavior as when pressing j for example. Maybe this behaviour could also go in the current scroll fn also? |
@pascalkuthe What do you think about implementing this feature as a component? I think I will need to hold some state in order always be able to get back to achieve 'always able to get back to a previous position for any consecutive sequence of cursor+view scrolls'. Without state I would need to always jump a fixed amount on every C-d/C-u, but this would break if after jumping the cursor lands on a row of virtual text- the cursor cant be on virtual text, so you wouldnt be doing an exact jump anymore and you could not C-.. back to the previous position. Holding state would also making the behaviour nicer on some of the edge cases near the top of the page, for example if the cursor is on line 10, the top of the view is on line 5, what happens if you press C-u? I could either have nothing happen to keep my 2 behaviours, or (using state) I could allow the view and cursor to both move to line 0 and break my 2 behaviours somewhat, but then be able to scroll the cusor+view back to lines 5, 10. |
I don't think holding state is really necessary. Nvim doesn't do that either and the cursors simply moves all the way down/up. While that does break being able to bo back I personally thing that's not too bad. In general I think these commands would be useful. I would be personally inf favour of making these the default mabbing for c-u (but not bageup so that we match (n)vim defaults) but kakune doesn't have this default so changing the default might be controversial. That's just a oneline change so that can be discussed during review. Respecting the horizontal offset during both scrolling and for these new commands makes a lot of sense to me and is also how both kakune and nvim behave so that would be a welcome change IMO. This should be pretty easy to add inside the scrolling function. |
@AlexanderDickie sorry to bother you but I want to ask if you are going to finish it? If not, I'd like to take it 😉 |
@woojiq yeh i'll make the pr this weekend :) |
I find helix's keyboard scrolling (using C-d/C-u for example) quite disorientating mainly because I often want to scroll up a bit, then scroll back down to the cursor's original position, helix's scrolling doesn't always do this depending on initial cursor position. This is the behaviour I want (exact same behaviour as neovim).
nvim5.mov
I dont really like this behaviour for mouse scrolling though.
Would you support this as an option in the config? something like
keyboard-scroll-exact: true | false
,mouse-scroll-exact: true | false
. Or maybe only have the keyboard optionI've implemented this behaviour locally and can make a pr for this
The text was updated successfully, but these errors were encountered: