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

{ moves back a paragraph too much if cursor at start of line #1028

Closed
ghost opened this issue Jul 22, 2022 · 6 comments
Closed

{ moves back a paragraph too much if cursor at start of line #1028

ghost opened this issue Jul 22, 2022 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 22, 2022

Given the text:

First paragraph.

Another paragraph.

if cursor is on n of another, using { will bring me to the blank line between the two paragraphs, as expected.
But if the cursor is on A of another, I'm brought to First: I'd expect to be brought at the blank line (this is the behavior in vim, and makes more sense/is more useful).

@ninewise
Copy link
Collaborator

That would indeed make more sense. A patch to fix this would be welcome, or I'll have a look at it myself later.

@ghost
Copy link
Author

ghost commented Jul 23, 2022

thanks. I'd like to give it a try myself, will report back.

@ghost
Copy link
Author

ghost commented Jul 23, 2022

the bug was introduced in f55312ba.
I found that it also appears when using } if you are at EOL.

Reverting the commit fixes the issue completely (with the exception of } when cursor is on the virtual EOL), and doesn't seem to have side-effects.

The rationale for the commit was "ignoring blank lines".
I'm not sure what it means: I tried on a test file with several blank lines in a row and the behavior is the same with the commit applied or reverted.

@casr
Copy link
Contributor

casr commented Aug 1, 2022

I tried on a test file with several blank lines in a row and the behavior is the same with the commit applied or reverted.

What happens when you have a line that only has spaces, tabs or a combination of both between the paragraphs?

@ghost
Copy link
Author

ghost commented Aug 5, 2022

@casr

In a situation like this:

First

  <some whitespace>

Second

with the patch reverted:

if the cursor is on S, { moves at the start of line 4, then the start of line 2. IMHO this is correct (it's also how it works in vim).

@jvvv
Copy link
Contributor

jvvv commented Sep 12, 2022

Rather than reverting the whole commit for f55312ba, I have tested a partial revert in bde0a89. My intent with this change is that I think it maintains the point of the original commit while also trying to address this issue.

Edit:
I have rebased my fork on the 0.8 tag. Had to force push, so the new commit sha is 16acbd.

@jvvv jvvv mentioned this issue Nov 24, 2022
@rnpnr rnpnr closed this as completed in e728898 Jul 16, 2023
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 a pull request may close this issue.

3 participants