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 and ma to use newlines #12521

Open
wants to merge 3 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
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.

3 participants