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

Adding selection for ParagraphPrevious and ParagraphNext. #3353

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

hchac
Copy link
Contributor

@hchac hchac commented Jun 15, 2024

Also tweaked the behavior of Paragraph/{Previous/Next} so that it skips all empty lines immediately next to cursor position, until it finds the start/end of the paragraph closest to it. Once it finds the paragraph closest to it, the same behavior as before applies. With the previous behavior if the cursor was surrounded by empty lines, then Paragraph/{Previous/Next} would only jump to the next empty line, instead of jumping to the start/end of a paragraph.

Copy link
Contributor

@Neko-Box-Coder Neko-Box-Coder left a comment

Choose a reason for hiding this comment

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

Please document the new actions in runtime/help/keybindings.md

@hchac
Copy link
Contributor Author

hchac commented Jul 6, 2024

@Neko-Box-Coder done, thanks

Copy link
Contributor

@Neko-Box-Coder Neko-Box-Coder left a comment

Choose a reason for hiding this comment

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

Tested the changes, seems good to me.

}
}
// Find the first empty line
for ; line > 0; line-- {
if len(h.Buf.LineBytes(line)) == 0 && line != h.Cursor.Y {
Copy link
Collaborator

Choose a reason for hiding this comment

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

line != h.Cursor.Y seems not needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, thanks.

if line == h.Buf.LinesNum() {
h.Cursor.Loc = h.Buf.End()
}
}

// ParagraphPrevious moves the cursor to the first empty line that comes before the paragraph closest to the cursor, or beginning of the buffer if there isn't a paragraph
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just noticed: these comment lines are way too long, could you split them?
Besides that, the PR looks good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@hchac
Copy link
Contributor Author

hchac commented Jul 17, 2024

Would you folks prefer I squash into one commit, or the 4 independent are fine?

@dmaluka
Copy link
Collaborator

dmaluka commented Jul 17, 2024

Ideally, squash. It's generally better to keep separate commits for separate logical changes, and squash them otherwise. In other words, organize commits in such a way that the commit history is easier to review, not harder.

Also tweaked the behavior of Paragraph/{Previous/Next} so that it skips
all empty lines immediately next to cursor position, until it finds the
start/end of the paragraph closest to it. Once it finds the paragraph
closest to it, the same behavior as before applies. With the previous
behavior if the cursor was surrounded by empty lines, then
Paragraph/{Previous/Next} would only jump to the next empty line,
instead of jumping to the start/end of a paragraph.
@hchac
Copy link
Contributor Author

hchac commented Jul 17, 2024

@dmaluka done

@JoeKar JoeKar added this to the v2.0.14 milestone Jul 19, 2024
@JoeKar JoeKar merged commit f8e532b into zyedidia:master Jul 20, 2024
3 checks passed
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.

4 participants