OLD | NEW |
| 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others |
| 2 // Distributed under an MIT license: http://codemirror.net/LICENSE |
| 3 |
1 (function(mod) { | 4 (function(mod) { |
2 if (typeof exports == "object" && typeof module == "object") // CommonJS | 5 if (typeof exports == "object" && typeof module == "object") // CommonJS |
3 mod(require("../../lib/codemirror")); | 6 mod(require("../../lib/codemirror")); |
4 else if (typeof define == "function" && define.amd) // AMD | 7 else if (typeof define == "function" && define.amd) // AMD |
5 define(["../../lib/codemirror"], mod); | 8 define(["../../lib/codemirror"], mod); |
6 else // Plain browser env | 9 else // Plain browser env |
7 mod(CodeMirror); | 10 mod(CodeMirror); |
8 })(function(CodeMirror) { | 11 })(function(CodeMirror) { |
9 var DEFAULT_BRACKETS = "()[]{}''\"\""; | 12 var DEFAULT_BRACKETS = "()[]{}''\"\""; |
10 var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; | 13 var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return CodeMirror.Pass; | 65 return CodeMirror.Pass; |
63 var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); | 66 var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); |
64 if (!range.empty()) | 67 if (!range.empty()) |
65 curType = "surround"; | 68 curType = "surround"; |
66 else if (left == right && next == right) { | 69 else if (left == right && next == right) { |
67 if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + lef
t) | 70 if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + lef
t) |
68 curType = "skipThree"; | 71 curType = "skipThree"; |
69 else | 72 else |
70 curType = "skip"; | 73 curType = "skip"; |
71 } else if (left == right && cur.ch > 1 && | 74 } else if (left == right && cur.ch > 1 && |
72 cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left) | 75 cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left
&& |
| 76 (cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(
cur.line, cur.ch - 2)) != left)) |
73 curType = "addFour"; | 77 curType = "addFour"; |
74 else if (left == right && CodeMirror.isWordChar(next)) | 78 else if (left == right && CodeMirror.isWordChar(next)) |
75 return CodeMirror.Pass; | 79 return CodeMirror.Pass; |
76 else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.inde
xOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) | 80 else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.inde
xOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) |
77 curType = "both"; | 81 curType = "both"; |
78 else | 82 else |
79 return CodeMirror.Pass; | 83 return CodeMirror.Pass; |
80 if (!type) type = curType; | 84 if (!type) type = curType; |
81 else if (type != curType) return CodeMirror.Pass; | 85 else if (type != curType) return CodeMirror.Pass; |
82 } | 86 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 ranges = cm.listSelections(); | 134 ranges = cm.listSelections(); |
131 for (var i = 0; i < ranges.length; i++) { | 135 for (var i = 0; i < ranges.length; i++) { |
132 var line = ranges[i].head.line; | 136 var line = ranges[i].head.line; |
133 cm.indentLine(line, null, true); | 137 cm.indentLine(line, null, true); |
134 cm.indentLine(line + 1, null, true); | 138 cm.indentLine(line + 1, null, true); |
135 } | 139 } |
136 }); | 140 }); |
137 }; | 141 }; |
138 } | 142 } |
139 }); | 143 }); |
OLD | NEW |