benma / visual-regexp.el

A regexp/replace command for Emacs with interactive visual feedback
392 stars 28 forks source link

Newline '\n' in Replace #28

Closed JP-Ellis closed 9 years ago

JP-Ellis commented 9 years ago

I am not sure whether this issue is specific to this or visual-regexp-steroids, but I'll report the issue here.

When the replacement string contains an \n, it inserts a newline regardless of any escape sequence. I have illustrated below a few examples of what the replacement text produces.

This works as expected:

abc\ndef
---▼---
abc
def

But this does not:

abc\\ndef
---▼---
abc\
def

One would expect the replacement to be abc\ndef without any newlines.

benma commented 9 years ago

Thanks for the report. It was an issue in the steroids package. This commit should fix it:

https://github.com/benma/visual-regexp-steroids.el/commit/2a50710dea5be872b31ea56f74b4cd57d6e61461

Please let me know if the issue is solved for you.

JP-Ellis commented 9 years ago

This has fixed the issue; thanks for that!