codemirror 3.18 with enabled the fullscreen addon
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
CodeMirror.braceRangeFinder = function(cm, start) {
|
||||
CodeMirror.registerHelper("fold", "brace", function(cm, start) {
|
||||
var line = start.line, lineText = cm.getLine(line);
|
||||
var startCh, tokenType;
|
||||
|
||||
function findOpening(openCh) {
|
||||
for (var at = start.ch, pass = 0;;) {
|
||||
var found = lineText.lastIndexOf(openCh, at - 1);
|
||||
var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1);
|
||||
if (found == -1) {
|
||||
if (pass == 1) break;
|
||||
pass = 1;
|
||||
@@ -12,7 +12,7 @@ CodeMirror.braceRangeFinder = function(cm, start) {
|
||||
continue;
|
||||
}
|
||||
if (pass == 1 && found < start.ch) break;
|
||||
tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type;
|
||||
tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
|
||||
if (!/^(comment|string)/.test(tokenType)) return found + 1;
|
||||
at = found - 1;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ CodeMirror.braceRangeFinder = function(cm, start) {
|
||||
if (nextClose < 0) nextClose = text.length;
|
||||
pos = Math.min(nextOpen, nextClose);
|
||||
if (pos == text.length) break;
|
||||
if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) {
|
||||
if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) {
|
||||
if (pos == nextOpen) ++count;
|
||||
else if (!--count) { end = i; endCh = pos; break outer; }
|
||||
}
|
||||
@@ -44,9 +44,10 @@ CodeMirror.braceRangeFinder = function(cm, start) {
|
||||
if (end == null || line == end && endCh == startCh) return;
|
||||
return {from: CodeMirror.Pos(line, startCh),
|
||||
to: CodeMirror.Pos(end, endCh)};
|
||||
};
|
||||
});
|
||||
CodeMirror.braceRangeFinder = CodeMirror.fold.brace; // deprecated
|
||||
|
||||
CodeMirror.importRangeFinder = function(cm, start) {
|
||||
CodeMirror.registerHelper("fold", "import", function(cm, start) {
|
||||
function hasImport(line) {
|
||||
if (line < cm.firstLine() || line > cm.lastLine()) return null;
|
||||
var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
|
||||
@@ -68,9 +69,10 @@ CodeMirror.importRangeFinder = function(cm, start) {
|
||||
end = next.end;
|
||||
}
|
||||
return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end};
|
||||
};
|
||||
});
|
||||
CodeMirror.importRangeFinder = CodeMirror.fold["import"]; // deprecated
|
||||
|
||||
CodeMirror.includeRangeFinder = function(cm, start) {
|
||||
CodeMirror.registerHelper("fold", "include", function(cm, start) {
|
||||
function hasInclude(line) {
|
||||
if (line < cm.firstLine() || line > cm.lastLine()) return null;
|
||||
var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
|
||||
@@ -87,4 +89,5 @@ CodeMirror.includeRangeFinder = function(cm, start) {
|
||||
}
|
||||
return {from: CodeMirror.Pos(start, has + 1),
|
||||
to: cm.clipPos(CodeMirror.Pos(end))};
|
||||
};
|
||||
});
|
||||
CodeMirror.includeRangeFinder = CodeMirror.fold.include; // deprecated
|
||||
|
||||
Reference in New Issue
Block a user