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

Matching a single newline results in unexpected behaviour #77

Open
AlexanderHarrison opened this issue Aug 12, 2021 · 0 comments
Open

Comments

@AlexanderHarrison
Copy link

call textobj#user#plugin('newline', {
\   '-': {  
\     'pattern': '\n',
\     'select': 'n',
\   },
\ })

Instead of matching a single newline like expected, this matches from the previous newline to the following newline. This persists even with the 'cursor' scan type. It seems to work when the cursor is somehow on the newline character (such as on blank lines).

This issue is specific to newlines. Changing the matched character to something else matches the single character like expected.

This arose when I was trying to match whitespace with:

call textobj#user#plugin('space', {
\   '-': {  
\     'pattern': '\S\zs\_s\+',
\     'select': 's',
\   },
\ })

Which works as expected for every case except for single newlines.

@AlexanderHarrison AlexanderHarrison changed the title Matching a single newline results in unexpected behaviour. Matching a single newline results in unexpected behaviour Aug 12, 2021
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

No branches or pull requests

1 participant