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

feat: Allow mi, ma, mr and md to use newlines #12521

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

nik-rev
Copy link
Contributor

@nik-rev nik-rev commented Jan 13, 2025

No description provided.


if let Some(ch) = event
.char()
.or((event.code == KeyCode::Enter).then_some('\n'))
Copy link
Member

Choose a reason for hiding this comment

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

Searching for \n is not exactly correct unless the document has LF line endings. This needs to search for doc.line_ending.as_str() instead. For a doc with CRLF line endings, selecting around \ns would exclude the opening \rs. The surround code needs to be refactored to accept &strs instead of chars in order to search for line endings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am going with a simpler implementation since we are dealing with line endings, I'm just using line_to_char to get information about the nth surrounding line ending. I hope that's fine

@kirawi kirawi added C-enhancement Category: Improvements S-waiting-on-review Status: Awaiting review from a maintainer. A-command Area: Commands labels Jan 19, 2025
@nik-rev
Copy link
Contributor Author

nik-rev commented Feb 1, 2025

@darshanCommits It looks like you closed your PR which was going to implement replacing / deleting surrounding newlines

Are you still planning on adding it? If not, I can implement it in this PR

@darshanCommits
Copy link
Contributor

@darshanCommits It looks like you closed your PR which was going to implement replacing / deleting surrounding newlines

Are you still planning on adding it? If not, I can implement it in this PR

It was unintentional mistake on my end.
Anyway, I was thinking the same, tackling all text objects related to enter the same time.

I won't be able to attend it prior next week, you may go ahead and implement it here.

@nik-rev nik-rev changed the title feat: Allow mi and ma to use newlines feat: Allow mi, ma, mr and `md to use newlines Feb 1, 2025
@nik-rev nik-rev changed the title feat: Allow mi, ma, mr and `md to use newlines feat: Allow mi, ma, mr and md to use newlines Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-command Area: Commands C-enhancement Category: Improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants