mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Merge pull request #15224 from atom/wl-multiline-is-important
Set multiline flags for out-of-Atom regex replacements
This commit is contained in:
@@ -2394,6 +2394,22 @@ i = /test/; #FIXME\
|
||||
expect(results[0].replacements).toBe(6)
|
||||
})
|
||||
})
|
||||
|
||||
it('does not discard the multiline flag', () => {
|
||||
const filePath = path.join(projectDir, 'sample.js')
|
||||
fs.copyFileSync(path.join(fixturesDir, 'sample.js'), filePath)
|
||||
|
||||
const results = []
|
||||
waitsForPromise(() =>
|
||||
atom.workspace.replace(/;$/gmi, 'items', [filePath], result => results.push(result))
|
||||
)
|
||||
|
||||
runs(() => {
|
||||
expect(results).toHaveLength(1)
|
||||
expect(results[0].filePath).toBe(filePath)
|
||||
expect(results[0].replacements).toBe(8)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('when a buffer is already open', () => {
|
||||
|
||||
@@ -1950,6 +1950,7 @@ module.exports = class Workspace extends Model {
|
||||
|
||||
if (!outOfProcessFinished.length) {
|
||||
let flags = 'g'
|
||||
if (regex.multiline) { flags += 'm' }
|
||||
if (regex.ignoreCase) { flags += 'i' }
|
||||
|
||||
const task = Task.once(
|
||||
|
||||
Reference in New Issue
Block a user