- Timestamp:
- 06/24/19 13:04:56 (6 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/codemirror/addon/edit/closebrackets.js
r3758 r3979 1 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 // Distributed under an MIT license: http ://codemirror.net/LICENSE2 // Distributed under an MIT license: https://codemirror.net/LICENSE 3 3 4 4 (function(mod) { … … 12 12 var defaults = { 13 13 pairs: "()[]{}''\"\"", 14 closeBefore: ")]}'\":;>", 14 15 triples: "", 15 16 explode: "[]{}" … … 110 111 var pos = pairs.indexOf(ch); 111 112 if (pos == -1) return CodeMirror.Pass; 113 114 var closeBefore = getOption(conf,"closeBefore"); 115 112 116 var triples = getOption(conf, "triples"); 113 117 … … 137 141 if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both"; 138 142 else return CodeMirror.Pass; 139 } else if (opening && (cm.getLine(cur.line).length == cur.ch || 140 isClosingBracket(next, pairs) || 141 /\s/.test(next))) { 143 } else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) { 142 144 curType = "both"; 143 145 } else { … … 176 178 } 177 179 178 function isClosingBracket(ch, pairs) {179 var pos = pairs.lastIndexOf(ch);180 return pos > -1 && pos % 2 == 1;181 }182 183 180 function charsAround(cm, pos) { 184 181 var str = cm.getRange(Pos(pos.line, pos.ch - 1),
Note: See TracChangeset
for help on using the changeset viewer.