diff options
author | Jose Antonio Marquez | 2012-03-09 13:36:41 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-03-09 13:36:41 -0800 |
commit | 9a03f869ff4520431da3ac8c64b748b5fbb60339 (patch) | |
tree | dad948f012cbc7d65e0dccde273667a389ff1c6d /imports/codemirror/lib/util/formatting.js | |
parent | b0b4a1ee6792d98f06cbd8ecf5291e66db8a4eef (diff) | |
parent | b4eb2f6cc1208fe5c18aa1f02a85adda25075d81 (diff) | |
download | ninja-9a03f869ff4520431da3ac8c64b748b5fbb60339.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into Color
Diffstat (limited to 'imports/codemirror/lib/util/formatting.js')
-rw-r--r--[-rwxr-xr-x] | imports/codemirror/lib/util/formatting.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/imports/codemirror/lib/util/formatting.js b/imports/codemirror/lib/util/formatting.js index 986bcb8f..15de0355 100755..100644 --- a/imports/codemirror/lib/util/formatting.js +++ b/imports/codemirror/lib/util/formatting.js | |||
@@ -4,7 +4,10 @@ if (!CodeMirror.modeExtensions) CodeMirror.modeExtensions = {}; | |||
4 | 4 | ||
5 | // Returns the extension of the editor's current mode | 5 | // Returns the extension of the editor's current mode |
6 | CodeMirror.defineExtension("getModeExt", function () { | 6 | CodeMirror.defineExtension("getModeExt", function () { |
7 | return CodeMirror.modeExtensions[this.getOption("mode")]; | 7 | var mname = CodeMirror.resolveMode(this.getOption("mode")).name; |
8 | var ext = CodeMirror.modeExtensions[mname]; | ||
9 | if (!ext) throw new Error("No extensions found for mode " + mname); | ||
10 | return ext; | ||
8 | }); | 11 | }); |
9 | 12 | ||
10 | // If the current mode is 'htmlmixed', returns the extension of a mode located at | 13 | // If the current mode is 'htmlmixed', returns the extension of a mode located at |
@@ -50,7 +53,7 @@ CodeMirror.defineExtension("autoIndentRange", function (from, to) { | |||
50 | var cmInstance = this; | 53 | var cmInstance = this; |
51 | this.operation(function () { | 54 | this.operation(function () { |
52 | for (var i = from.line; i <= to.line; i++) { | 55 | for (var i = from.line; i <= to.line; i++) { |
53 | cmInstance.indentLine(i); | 56 | cmInstance.indentLine(i, "smart"); |
54 | } | 57 | } |
55 | }); | 58 | }); |
56 | }); | 59 | }); |
@@ -70,7 +73,7 @@ CodeMirror.defineExtension("autoFormatRange", function (from, to) { | |||
70 | var startLine = cmInstance.posFromIndex(absStart).line; | 73 | var startLine = cmInstance.posFromIndex(absStart).line; |
71 | var endLine = cmInstance.posFromIndex(absStart + res.length).line; | 74 | var endLine = cmInstance.posFromIndex(absStart + res.length).line; |
72 | for (var i = startLine; i <= endLine; i++) { | 75 | for (var i = startLine; i <= endLine; i++) { |
73 | cmInstance.indentLine(i); | 76 | cmInstance.indentLine(i, "smart"); |
74 | } | 77 | } |
75 | }); | 78 | }); |
76 | }); | 79 | }); |