OLD | NEW |
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others | 1 // CodeMirror, copyright (c) by Marijn Haverbeke and others |
2 // Distributed under an MIT license: http://codemirror.net/LICENSE | 2 // Distributed under an MIT license: http://codemirror.net/LICENSE |
3 | 3 |
4 (function(mod) { | 4 (function(mod) { |
5 if (typeof exports == "object" && typeof module == "object") // CommonJS | 5 if (typeof exports == "object" && typeof module == "object") // CommonJS |
6 mod(require("../../lib/codemirror")); | 6 mod(require("../../lib/codemirror")); |
7 else if (typeof define == "function" && define.amd) // AMD | 7 else if (typeof define == "function" && define.amd) // AMD |
8 define(["../../lib/codemirror"], mod); | 8 define(["../../lib/codemirror"], mod); |
9 else // Plain browser env | 9 else // Plain browser env |
10 mod(CodeMirror); | 10 mod(CodeMirror); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-non
matchingbracket"; | 74 var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-non
matchingbracket"; |
75 marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch +
1), {className: style})); | 75 marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch +
1), {className: style})); |
76 if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) | 76 if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen) |
77 marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1),
{className: style})); | 77 marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1),
{className: style})); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 if (marks.length) { | 81 if (marks.length) { |
82 // Kludge to work around the IE bug from issue #1193, where text | 82 // Kludge to work around the IE bug from issue #1193, where text |
83 // input stops going to the textare whever this fires. | 83 // input stops going to the textare whever this fires. |
84 if (ie_lt8 && cm.state.focused) cm.display.input.focus(); | 84 if (ie_lt8 && cm.state.focused) cm.focus(); |
85 | 85 |
86 var clear = function() { | 86 var clear = function() { |
87 cm.operation(function() { | 87 cm.operation(function() { |
88 for (var i = 0; i < marks.length; i++) marks[i].clear(); | 88 for (var i = 0; i < marks.length; i++) marks[i].clear(); |
89 }); | 89 }); |
90 }; | 90 }; |
91 if (autoclear) setTimeout(clear, 800); | 91 if (autoclear) setTimeout(clear, 800); |
92 else return clear; | 92 else return clear; |
93 } | 93 } |
94 } | 94 } |
(...skipping 16 matching lines...) Expand all Loading... |
111 }); | 111 }); |
112 | 112 |
113 CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, tr
ue);}); | 113 CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, tr
ue);}); |
114 CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config
){ | 114 CodeMirror.defineExtension("findMatchingBracket", function(pos, strict, config
){ |
115 return findMatchingBracket(this, pos, strict, config); | 115 return findMatchingBracket(this, pos, strict, config); |
116 }); | 116 }); |
117 CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config)
{ | 117 CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config)
{ |
118 return scanForBracket(this, pos, dir, style, config); | 118 return scanForBracket(this, pos, dir, style, config); |
119 }); | 119 }); |
120 }); | 120 }); |
OLD | NEW |