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

Use beginning-of-visual-line' in move-to-mode-line-start' #65

Merged
merged 1 commit into from Aug 3, 2020

Conversation

mssola
Copy link
Contributor

@mssola mssola commented Sep 19, 2019

This way, functions such as `crux-move-beginning-of-line' work as expected when in visual-line mode:

  1. If the user runs this function in the middle of a visual line, it will go to the beginning of said visual line.
  2. If the user runs this function again, then it will go to the beginning of the real line.
  3. If the user runs this function again, then it will go to the first non-space character of the line.

Swapping 2 and 3 may also be an expected behavior but then the code became way more complicated than it should.

Signed-off-by: Miquel Sabaté Solà msabate@suse.com

@bbatsov
Copy link
Owner

bbatsov commented Jun 15, 2020

Sorry for the super slow response!

I agree with the spirit of the change, but I think it's going to be pretty confusing to change the current behavior with with 3) happening before 2). We might have to stomach a bit of extra complexity. :-)

@mssola
Copy link
Contributor Author

mssola commented Jun 16, 2020

Ok, no worries 😉 You can close this PR for now and maybe we can figure out something on this regard. Thanks!

@bbatsov
Copy link
Owner

bbatsov commented Jun 16, 2020

@mssola I've been thinking it's probably best to just add a defcustom controlling which variant to use. This way we keep to code simple and cover both cases.

@mssola
Copy link
Contributor Author

mssola commented Jun 16, 2020

Good point. I can work on that whenever I have some spare time.

@bbatsov
Copy link
Owner

bbatsov commented Jun 16, 2020

Thanks!

In some environments users expect crux's functions to respect visual lines. This
can now be configured through the `crux-should-move-visually' configurable
variable. If set to true, then `move-to-mode-line-start' will use take into
account visual lines. Otherwise (the default behavior), it will work as usual by
moving to the logical beginning of the line.

For functions like `crux-move-beginning-of-line', specifically, the user will
face the following situation when setting `crux-should-move-visually; to true:

1. If the user runs this function in the middle of a visual line, it will go to
   the beginning of said visual line.
2. If the user runs this function again, then it will go to the beginning of the
   real line.
3. If the user runs this function again, then it will go to the first non-space
   character of the line.

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
@mssola
Copy link
Contributor Author

mssola commented Aug 3, 2020

@bbatsov done. Sorry for taking so long...

@bbatsov bbatsov merged commit 1fa7162 into bbatsov:master Aug 3, 2020
@bbatsov
Copy link
Owner

bbatsov commented Aug 3, 2020

Thanks!

@mssola mssola deleted the beginning-of-visual-line branch August 4, 2020 10:47
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.

None yet

2 participants