This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Replacing multiple characters with newlines in a scanInRange only replaces the first occurence #224
Open
Description
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
- Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
(I didn't really want to factory reset but I'm fairly certain that wouldn't change anything, and this is not a feature request so no package searching)
Description
Replacing multiple characters with newlines (or carriage returns, but not alphanumeric characters or tabs!) in a TextBuffer.scanInRange only replaces the first occurence (but inserts more of the replacement without removing the pattern).
Steps to Reproduce
- Open a new file with the contents
a,b,c
- In the developer console, execute
atom.workspace.getActiveTextEditor().buffer.scanInRange(/,/g, [[0,0],[1,0]], function(args) {console.debug("found");args.replace('\n')})
Expected behavior: "found" should be output twice and the buffer should now contain
a
b
c
Actual behavior: "found" is actually output twice, but the buffer now contains
a
b,c
Reproduces how often: 100% of the time.
Versions
OS: Arch Linux
$ uname -r
4.9.11-1-ARCH
$ atom --version
Atom : 1.15.0
Electron: 1.4.15
Chrome : 53.0.2785.143
Node : 6.5.0
$ apm --version
(node:1202) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
apm 1.17.0
npm 4.4.1
node 7.7.3 x64
python 2.7.13
git 2.12.0
Additional Information
This used to work. I believe it might have been broken in 7ad08bc, but I don't really want to bisect.