You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/WPy64-3720/python-3.7.2.amd64/Lib/site-packages/jupyter_contrib_nbextensions/nbextensions/codefolding/firstline-fold.js

15 lines
496 B

/* allow folding of complete cell, if comment is in first line */
CodeMirror.registerHelper("fold", "firstline", function(cm, start) {
var mode = cm.getMode(), Token = mode.lineComment;
if (start.line == 0) {
var lineText = cm.getLine(start.line);
var found = lineText.lastIndexOf(Token,0);
if (found == 0) {
end = cm.lastLine();
return {from: CodeMirror.Pos(start.line, null),
to: CodeMirror.Pos(end, null)};
}
}
return ;
});