kakoune
kakoune copied to clipboard
Have C-u scroll cursor up even when window is at top
Here are two gifs that compares the current and proposed behaviour. The proposed behaviour causes C-u
to move the cursor upward when the window position is already on the first line. This behaviour is consistent with vim's C-d/C-u
motions.
My code is terrible, unfortunately. I literally copy-pasted the cursor adjustment shenanigans since I don't see a clean way to integrate this part of the cursor manipulation with the rest of the calculations that take the scrolling of the window position into account. I would appreciate advice on how to make the code better!
New proposed behaviour
https://user-images.githubusercontent.com/1694861/108900644-dbf1b480-763f-11eb-980c-6cf89fe2fb5a.mp4
Current default behaviour
https://user-images.githubusercontent.com/1694861/108900650-de540e80-763f-11eb-8efe-eac0468c2a5e.mp4
I don't think this change makes sense. c-u moves the view half a screen upward. The editor requires the main selection to be always visible, that's the reason why the anchor consequently moves sometimes, but not always — it's a side effect.
The proposed patch makes c-u manage the selection directly, effectively acting like gt in cases where the above side effect would not have applied.
Maybe you could use a mapping that executes gt, vv instead?