Use TextEditor.transact

This fixes #57 and atom/atom#703
This commit is contained in:
jazzpi 2015-06-18 18:49:37 +02:00
parent bf0f492740
commit 7c202faefa

View file

@ -203,14 +203,13 @@ class Ex
throw e throw e
buffer = atom.workspace.getActiveTextEditor().buffer buffer = atom.workspace.getActiveTextEditor().buffer
cp = buffer.history.createCheckpoint() atom.workspace.getActiveTextEditor().transact ->
for line in [range[0]..range[1]] for line in [range[0]..range[1]]
buffer.scanInRange(pattern, buffer.scanInRange(pattern,
[[line, 0], [line, buffer.lines[line].length]], [[line, 0], [line, buffer.lines[line].length]],
({match, matchText, range, stop, replace}) -> ({match, matchText, range, stop, replace}) ->
replace(replaceGroups(match[..], spl[1])) replace(replaceGroups(match[..], spl[1]))
) )
buffer.history.groupChangesSinceCheckpoint(cp)
s: (args...) => @substitute(args...) s: (args...) => @substitute(args...)