Skip to content

Conversation

@stacyharper
Copy link
Contributor

@stacyharper stacyharper commented Sep 11, 2023

Recently I noticed changes with the behavior of my keybinds:

map global normal <C-e> vj
map global normal <C-y> vk

This is because the cursor movement behavior changed with vj and vk. Scrolling window was previously blocked by the cursor. Now the cursor and selection stays in place.

I think the view keyboard behaviors are consistent, and coherent with the current state. But this isn't exactly what we want from <C-e> and <C-y>.

Example, when you start to scroll with <C-e> (your cursor stay in place), then you press <C-d> (your cursor is moved back to your view).

Example, when you start to scroll with <C-e> (your cursor stay in place), then you press j or k (your view is pushed back to initial position).

To solve this, I think we need news and differents default keybinds <C-e> and <C-y>.

@stacyharper stacyharper force-pushed the scroll branch 3 times, most recently from 89e1c4c to 8c02387 Compare September 11, 2023 10:15
src/context.hh Outdated
class AliasRegistry;

enum Direction { Backward = -1, Forward = 1 };
enum Velocity { FullScreen = 0, HalfScreen = 1, Line = 2 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Velocity" is defined as "the speed of something in a given direction". I think "distance" would be a better name here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I renamed this. Thanks!

@stacyharper
Copy link
Contributor Author

I just rebased this. Could this be reviewed again?

@mawww
Copy link
Owner

mawww commented May 30, 2024

The implementation looks fine, but I am wondering if we need to dedicate yet another binding to this. Would it be okay to rely on passing a line count to another command (say 1<c-b> to move one line instead of a full screen)

@stacyharper
Copy link
Contributor Author

imo 3<c-b> would make more senses as "3 pages back". I'm really not convinced

@mawww
Copy link
Owner

mawww commented Jun 3, 2024

I do agree with it would be more consistent, but we already have a binding for scrolling page by page, then a binding for scrolling half page by half page, and now we want one for scrolling line by line. I think this is too many mappings for this and would like to get some consolidation. Especially as this is on top of a whole set of other mappings in view mode.

Another direction would be to say that this is a view command and we should have a way to decide how the cursor should behave. An idea that comes to mind is to have say <a-v> that enters view mode with an extra flag to move cursors if necessary.

@stacyharper
Copy link
Contributor Author

I do agree with it would be more consistent, but we already have a binding for scrolling page by page, then a binding for scrolling half page by half page, and now we want one for scrolling line by line. I think this is too many mappings for this and would like to get some consolidation. Especially as this is on top of a whole set of other mappings in view mode.

I don't share your opinion on if it is too many mapping or not. To me there is 3 distinct way to scroll the buffer, and they are very common, and present on other softwares. Plus we managed to refactorise the code, to avoid creating too many functions for them.

Do you fear about missing available shortcuts?

Another direction would be to say that this is a view command and we should have a way to decide how the cursor should behave. An idea that comes to mind is to have say that enters view mode with an extra flag to move cursors if necessary.

I'm not sure to fully understand what you propose here. You mean to add a dedicated mode, that offer different ways to scroll? And the users could map a shortcut to this if they want to? (<c-e> in my case <c-v>j).

But anyway, imo we still need an internal command to scroll one line, that respect the behavior I've mentioned in the body here.

Recently I noticed changes with the behavior of my keybinds:

map global normal <C-e> vj
map global normal <C-y> vk

This is because the cursor movement behavior changed with vj and vk. Scrolling
window was previously blocked by the cursor. Now the cursor and selection stays
in place.

I think the view keyboard behaviors are consistent, and coherent with the
current state. But this isn't exactly what we want from <C-e> and <C-y>.

Example, when you start to scroll with <C-e> (your cursor stay in
place), then you press <C-d> (your cursor is moved back to your view).

Example, when you start to scroll with <C-e> (your cursor stay in
place), then you press j or k (your view is pushed back to initial
position).

To solve this, I think we need news and differents default keybinds
<C-e> and <C-y>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants