Prerequisites
- [x ] Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: https://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Followed all applicable steps in the debugging guide: https://flight-manual.atom.io/hacking-atom/sections/debugging/
- Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
- Checked that your issue isn’t already filed: https://github.com/issues?utf8=✓&q=is%%3Aissue+user%%3Aatom
- Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
It appears the the regex find all
and replace all
within a project has a bug. When a file is open the backreference is inserted instead of the captured text. If the file isn’t open, the replace works as it should. This bug doesn’t seem to appear when find all
and replace all
within a single file.
Steps to Reproduce
- create two identical test text files within a folder, with text to search and replace
Expected behavior:
It would be expected that the search & replace would work in both files
Actual behavior:
In the file that was open, the backreference
is inserted, instead of match:
And the file that was closed performed as expected:
Reproduces how often:
Consistently reproduces, in both Linux and MacOS
Versions
Atom : 1.45.0
Electron: 4.2.7
Chrome : 69.0.3497.128
Node : 10.11.0
Additional Information
Thank you, love atom : )
Hey @m4rk3r, thanks for the report.
Reproduced in Atom 1.44.0 stable and 1.47.0-5 Nightly
Search Type: Regex
Regex:
\&(\w+)
Test File Extension: .txt
Simplified Test Content:
&test
Expectations Summary: The file that is closed works as expected, the open inserts the
backreference
instead of the actual value.Closed File Result

Open File Result (The Bug Here)

This seems to have been fixed with this commit to the text-buffer repo. Before that, occurrences plain-text replaced. This didn’t happen to files which are closed because of the different handling of open editors (for which unsaved buffers may exist) and ‘untouched’ files for which the search-and-replace is done by another library. That difference is found here.