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

Replacing multiple newlines #129

Open
philgyford opened this issue Feb 13, 2016 · 2 comments
Open

Replacing multiple newlines #129

philgyford opened this issue Feb 13, 2016 · 2 comments

Comments

@philgyford
Copy link

If I have a text file like this:

Terry.

Bob.

Thelma.

Then using Atom's find/replace, with regular expressions on, I can search for \n\n and replace with \n\nx and, as expected, I end up with:

Terry.

x Bob.

x Thelma.

But if, using ex-mode I do :%s/\n\n/\n\nx / then nothing happens.

I can match and replace single newlines OK. e.g. %s/\n/\nx / gets me:

Terry.
x 
x Bob.
x 
x Thelma.

Is there something I'm missing about being able to search for multiple newlines, or is this just not supported at the moment?

@awilkins
Copy link
Contributor

I believe this is a limitation of the Atom text buffer scan which operates on a line-by-line basis.

I think it's tied up pretty heavily to the underlying data structure used by it (which seems to be a composite structure composed of lines) - this is linked to the fails being seen in the unit tests which fail to insert multiple newlines correctly (each newline is inserted after the current line.. instead of after the previous newline which was inserted).

@hultberg
Copy link
Collaborator

This is caused by a bug in text-buffer package. See atom/text-buffer#224

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

3 participants