1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Description: fix an case for which buble generates invalid syntax
Author: Gordon Ball <gordon@chronitis.net>
--- a/src/model/changes.js
+++ b/src/model/changes.js
@@ -266,7 +266,11 @@
export function replaceRange(doc, code, from, to, origin) {
if (!to) to = from
- if (cmp(to, from) < 0) [from, to] = [to, from]
+ if (cmp(to, from) < 0) {
+ let tmp = from;
+ to = from;
+ from = tmp;
+ }
if (typeof code == "string") code = doc.splitLines(code)
makeChange(doc, {from, to, text: code, origin})
}
|