]> git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/pretty-json/node_modules/jsonminify/report/assets/scripts/vendor/codemirror/util/continuelist.js
Remove mc config
[rbdr/dotfiles] / atom / packages / pretty-json / node_modules / jsonminify / report / assets / scripts / vendor / codemirror / util / continuelist.js
1 (function() {
2 CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
3 var pos = cm.getCursor(), token = cm.getTokenAt(pos);
4 var space;
5 if (token.className == "string") {
6 var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end});
7 var listStart = /\*|\d+\./, listContinue;
8 if (token.string.search(listStart) == 0) {
9 var reg = /^[\W]*(\d+)\./g;
10 var matches = reg.exec(full);
11 if(matches)
12 listContinue = (parseInt(matches[1]) + 1) + ". ";
13 else
14 listContinue = "* ";
15 space = full.slice(0, token.start);
16 if (!/^\s*$/.test(space)) {
17 space = "";
18 for (var i = 0; i < token.start; ++i) space += " ";
19 }
20 }
21 }
22
23 if (space != null)
24 cm.replaceSelection("\n" + space + listContinue, "end");
25 else
26 cm.execCommand("newlineAndIndent");
27 };
28 })();