Zeile 20 | Zeile 20 |
---|
cm.off("viewportChange", onViewportChange); cm.off("fold", onFold); cm.off("unfold", onFold);
|
cm.off("viewportChange", onViewportChange); cm.off("fold", onFold); cm.off("unfold", onFold);
|
cm.off("swapDoc", updateInViewport);
| cm.off("swapDoc", onChange);
|
} if (val) { cm.state.foldGutter = new State(parseOptions(val));
| } if (val) { cm.state.foldGutter = new State(parseOptions(val));
|
Zeile 30 | Zeile 30 |
---|
cm.on("viewportChange", onViewportChange); cm.on("fold", onFold); cm.on("unfold", onFold);
|
cm.on("viewportChange", onViewportChange); cm.on("fold", onFold); cm.on("unfold", onFold);
|
cm.on("swapDoc", updateInViewport);
| cm.on("swapDoc", onChange);
|
} });
| } });
|
Zeile 50 | Zeile 50 |
---|
}
function isFolded(cm, line) {
|
}
function isFolded(cm, line) {
|
var marks = cm.findMarksAt(Pos(line));
| var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));
|
for (var i = 0; i < marks.length; ++i)
|
for (var i = 0; i < marks.length; ++i)
|
if (marks[i].__isFold && marks[i].find().from.line == line) return true;
| if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];
|
}
function marker(spec) {
| }
function marker(spec) {
|
Zeile 94 | Zeile 94 |
---|
}
function onGutterClick(cm, line, gutter) {
|
}
function onGutterClick(cm, line, gutter) {
|
var opts = cm.state.foldGutter.options;
| var state = cm.state.foldGutter; if (!state) return; var opts = state.options;
|
if (gutter != opts.gutter) return;
|
if (gutter != opts.gutter) return;
|
cm.foldCode(Pos(line, 0), opts.rangeFinder);
| var folded = isFolded(cm, line); if (folded) folded.clear(); else cm.foldCode(Pos(line, 0), opts.rangeFinder);
|
}
function onChange(cm) {
|
}
function onChange(cm) {
|
var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;
| var state = cm.state.foldGutter; if (!state) return; var opts = state.options;
|
state.from = state.to = 0; clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
|
state.from = state.to = 0; clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
|
}
| }
|
function onViewportChange(cm) {
|
function onViewportChange(cm) {
|
var state = cm.state.foldGutter, opts = cm.state.foldGutter.options;
| var state = cm.state.foldGutter; if (!state) return; var opts = state.options;
|
clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { var vp = cm.getViewport();
| clearTimeout(state.changeUpdate); state.changeUpdate = setTimeout(function() { var vp = cm.getViewport();
|
Zeile 129 | Zeile 137 |
---|
}
function onFold(cm, from) {
|
}
function onFold(cm, from) {
|
var state = cm.state.foldGutter, line = from.line;
| var state = cm.state.foldGutter; if (!state) return; var line = from.line;
|
if (line >= state.from && line < state.to) updateFoldInfo(cm, line, line + 1); }
| if (line >= state.from && line < state.to) updateFoldInfo(cm, line, line + 1); }
|