aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/lib/util/formatting.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-17 11:29:09 -0700
committerValerio Virgillito2012-07-17 11:29:09 -0700
commit58e86247524cc2d545bd6884f1b5c9fdba3b9164 (patch)
tree53305d354fce502ee39378babf47ace6c91ce2fd /imports/codemirror/lib/util/formatting.js
parent0f0cffd4df85e7adf5081fe66c768c70b2ead9b3 (diff)
parent4f737b24c19ddc02d20f9783b8b080fc6ef11142 (diff)
downloadninja-58e86247524cc2d545bd6884f1b5c9fdba3b9164.tar.gz
Merge branch 'refs/heads/master' into v0.7.1
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");