aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/lib/util/formatting.js
diff options
context:
space:
mode:
Diffstat (limited to 'imports/codemirror/lib/util/formatting.js')
-rw-r--r--imports/codemirror/lib/util/formatting.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/imports/codemirror/lib/util/formatting.js b/imports/codemirror/lib/util/formatting.js
index e1891191..3a1a9873 100644
--- a/imports/codemirror/lib/util/formatting.js
+++ b/imports/codemirror/lib/util/formatting.js
@@ -84,7 +84,8 @@ CodeMirror.modeExtensions["css"] = {
84 commentStart: "/*", 84 commentStart: "/*",
85 commentEnd: "*/", 85 commentEnd: "*/",
86 wordWrapChars: [";", "\\{", "\\}"], 86 wordWrapChars: [";", "\\{", "\\}"],
87 autoFormatLineBreaks: function (text) { 87 autoFormatLineBreaks: function (text, startPos, endPos) {
88 text = text.substring(startPos, endPos);
88 return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2"); 89 return text.replace(new RegExp("(;|\\{|\\})([^\r\n])", "g"), "$1\n$2");
89 } 90 }
90}; 91};
@@ -125,7 +126,8 @@ CodeMirror.modeExtensions["javascript"] = {
125 return nonBreakableBlocks; 126 return nonBreakableBlocks;
126 }, 127 },
127 128
128 autoFormatLineBreaks: function (text) { 129 autoFormatLineBreaks: function (text, startPos, endPos) {
130 text = text.substring(startPos, endPos);
129 var curPos = 0; 131 var curPos = 0;
130 var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g"); 132 var reLinesSplitter = new RegExp("(;|\\{|\\})([^\r\n])", "g");
131 var nonBreakableBlocks = this.getNonBreakableBlocks(text); 133 var nonBreakableBlocks = this.getNonBreakableBlocks(text);
@@ -158,7 +160,8 @@ CodeMirror.modeExtensions["xml"] = {
158 commentEnd: "-->", 160 commentEnd: "-->",
159 wordWrapChars: [">"], 161 wordWrapChars: [">"],
160 162
161 autoFormatLineBreaks: function (text) { 163 autoFormatLineBreaks: function (text, startPos, endPos) {
164 text = text.substring(startPos, endPos);
162 var lines = text.split("\n"); 165 var lines = text.split("\n");
163 var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)"); 166 var reProcessedPortion = new RegExp("(^\\s*?<|^[^<]*?)(.+)(>\\s*?$|[^>]*?$)");
164 var reOpenBrackets = new RegExp("<", "g"); 167 var reOpenBrackets = new RegExp("<", "g");