Skip to content

Commit

Permalink
Update codeMirror
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Apr 23, 2017
1 parent fff6df0 commit 34fdaa5
Show file tree
Hide file tree
Showing 138 changed files with 11,752 additions and 9,077 deletions.
137 changes: 137 additions & 0 deletions assets/vendor/codemirror/AUTHORS
100755 → 100644

Large diffs are not rendered by default.

1,094 changes: 1,094 additions & 0 deletions assets/vendor/codemirror/CHANGELOG.md

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions assets/vendor/codemirror/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# How to contribute

- [Getting help](#getting-help)
- [Submitting bug reports](#submitting-bug-reports)
- [Contributing code](#contributing-code)

## Getting help

Community discussion, questions, and informal bug reporting is done on the
[discuss.CodeMirror forum](http://discuss.codemirror.net).

## Submitting bug reports

The preferred way to report bugs is to use the
[GitHub issue tracker](http://github.com/codemirror/CodeMirror/issues). Before
reporting a bug, read these pointers.

**Note:** The issue tracker is for *bugs*, not requests for help. Questions
should be asked on the
[discuss.CodeMirror forum](http://discuss.codemirror.net) instead.

### Reporting bugs effectively

- CodeMirror is maintained by volunteers. They don't owe you anything, so be
polite. Reports with an indignant or belligerent tone tend to be moved to the
bottom of the pile.

- Include information about **the browser in which the problem occurred**. Even
if you tested several browsers, and the problem occurred in all of them,
mention this fact in the bug report. Also include browser version numbers and
the operating system that you're on.

- Mention which release of CodeMirror you're using. Preferably, try also with
the current development snapshot, to ensure the problem has not already been
fixed.

- Mention very precisely what went wrong. "X is broken" is not a good bug
report. What did you expect to happen? What happened instead? Describe the
exact steps a maintainer has to take to make the problem occur. We can not
fix something that we can not observe.

- If the problem can not be reproduced in any of the demos included in the
CodeMirror distribution, please provide an HTML document that demonstrates
the problem. The best way to do this is to go to
[jsbin.com](http://jsbin.com/ihunin/edit), enter it there, press save, and
include the resulting link in your bug report.

## Contributing code

Note that we are not accepting any new addons or modes into the main
distribution. If you've written such a module, please distribute it as
a separate NPM package.

- Make sure you have a [GitHub Account](https://github.com/signup/free)
- Fork [CodeMirror](https://github.com/codemirror/CodeMirror/)
([how to fork a repo](https://help.github.com/articles/fork-a-repo))
- Make your changes
- If your changes are easy to test or likely to regress, add tests.
Tests for the core go into `test/test.js`, some modes have their own
test suite under `mode/XXX/test.js`. Feel free to add new test
suites to modes that don't have one yet (be sure to link the new
tests into `test/index.html`).
- Follow the general code style of the rest of the project (see
below). Run `bin/lint` to verify that the linter is happy.
- Make sure all tests pass. Visit `test/index.html` in your browser to
run them.
- Submit a pull request
([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
Don't put more than one feature/fix in a single pull request.

By contributing code to CodeMirror you

- agree to license the contributed code under CodeMirror's [MIT
license](http://codemirror.net/LICENSE).

- confirm that you have the right to contribute and license the code
in question. (Either you hold all rights on the code, or the rights
holder has explicitly granted the right to use it like this,
through a compatible open source license or through a direct
agreement with you.)

### Coding standards

- 2 spaces per indentation level, no tabs.

- Note that the linter (`bin/lint`) which is run after each commit
complains about unused variables and functions. Prefix their names
with an underscore to muffle it.

- CodeMirror does *not* follow JSHint or JSLint prescribed style.
Patches that try to 'fix' code to pass one of these linters will be
unceremoniously discarded.
4 changes: 3 additions & 1 deletion assets/vendor/codemirror/LICENSE
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (C) 2016 by Marijn Haverbeke <marijnh@gmail.com> and others
MIT License

Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion assets/vendor/codemirror/README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ conduct.
### Quickstart

To build the project, make sure you have Node.js installed (at least version 6)
and then `npm install && npm run build`. To run, just open `index.html` in your
and then `npm install`. To run, just open `index.html` in your
browser (you don't need to run a webserver). Run the tests with `npm test`.
19 changes: 13 additions & 6 deletions assets/vendor/codemirror/addon/comment/comment.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@

// Rough heuristic to try and detect lines that are part of multi-line string
function probablyInsideString(cm, pos, line) {
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
}

function getMode(cm, pos) {
var mode = cm.getMode()
return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
}

CodeMirror.defineExtension("lineComment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var self = this, mode = getMode(self, from);
var firstLine = self.getLine(from.line);
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;

Expand Down Expand Up @@ -95,7 +100,7 @@

CodeMirror.defineExtension("blockComment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var self = this, mode = getMode(self, from);
var startString = options.blockCommentStart || mode.blockCommentStart;
var endString = options.blockCommentEnd || mode.blockCommentEnd;
if (!startString || !endString) {
Expand Down Expand Up @@ -129,7 +134,7 @@

CodeMirror.defineExtension("uncomment", function(from, to, options) {
if (!options) options = noOptions;
var self = this, mode = self.getModeAt(from);
var self = this, mode = getMode(self, from);
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);

// Try finding line comments
Expand Down Expand Up @@ -171,9 +176,11 @@
endLine = self.getLine(--end);
close = endLine.indexOf(endString);
}
var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
if (close == -1 ||
!/comment/.test(self.getTokenTypeAt(Pos(start, open + 1))) ||
!/comment/.test(self.getTokenTypeAt(Pos(end, close + 1))))
!/comment/.test(self.getTokenTypeAt(insideStart)) ||
!/comment/.test(self.getTokenTypeAt(insideEnd)) ||
self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
return false;

// Avoid killing block comments completely outside the selection.
Expand Down
Empty file modified assets/vendor/codemirror/addon/comment/continuecomment.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/dialog/dialog.css
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/dialog/dialog.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/display/autorefresh.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/display/fullscreen.css
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/display/fullscreen.js
100755 → 100644
Empty file.
13 changes: 12 additions & 1 deletion assets/vendor/codemirror/addon/display/panel.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
var height = (options && options.height) || node.offsetHeight;
this._setSize(null, info.heightLeft -= height);
info.panels++;
if (options.stable && isAtTop(this, node))
this.scrollTo(null, this.getScrollInfo().top + height)

return new Panel(this, node, options, height);
});

Expand All @@ -54,14 +57,16 @@
this.cleared = true;
var info = this.cm.state.panels;
this.cm._setSize(null, info.heightLeft += this.height);
if (this.options.stable && isAtTop(this.cm, this.node))
this.cm.scrollTo(null, this.cm.getScrollInfo().top - this.height)
info.wrapper.removeChild(this.node);
if (--info.panels == 0) removePanels(this.cm);
};

Panel.prototype.changed = function(height) {
var newHeight = height == null ? this.node.offsetHeight : height;
var info = this.cm.state.panels;
this.cm._setSize(null, info.height += (newHeight - this.height));
this.cm._setSize(null, info.heightLeft -= (newHeight - this.height));
this.height = newHeight;
};

Expand Down Expand Up @@ -109,4 +114,10 @@
cm.setSize = cm._setSize;
cm.setSize();
}

function isAtTop(cm, dom) {
for (var sibling = dom.nextSibling; sibling; sibling = sibling.nextSibling)
if (sibling == cm.getWrapperElement()) return true
return false
}
});
Empty file modified assets/vendor/codemirror/addon/display/placeholder.js
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions assets/vendor/codemirror/addon/display/rulers.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@

CodeMirror.defineOption("rulers", false, function(cm, val) {
if (cm.state.rulerDiv) {
cm.display.lineSpace.removeChild(cm.state.rulerDiv)
cm.state.rulerDiv.parentElement.removeChild(cm.state.rulerDiv)
cm.state.rulerDiv = null
cm.off("refresh", drawRulers)
}
if (val && val.length) {
cm.state.rulerDiv = cm.display.lineSpace.insertBefore(document.createElement("div"), cm.display.cursorDiv)
cm.state.rulerDiv = cm.display.lineSpace.parentElement.insertBefore(document.createElement("div"), cm.display.lineSpace)
cm.state.rulerDiv.className = "CodeMirror-rulers"
drawRulers(cm)
cm.on("refresh", drawRulers)
Expand Down
4 changes: 2 additions & 2 deletions assets/vendor/codemirror/addon/edit/closebrackets.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

function getConfig(cm) {
var deflt = cm.state.closeBrackets;
if (!deflt) return null;
if (!deflt || deflt.override) return deflt;
var mode = cm.getModeAt(cm.getCursor());
return mode.closeBrackets || deflt;
}
Expand Down Expand Up @@ -185,7 +185,7 @@
function enteringString(cm, pos, ch) {
var line = cm.getLine(pos.line);
var token = cm.getTokenAt(pos);
if (/\bstring2?\b/.test(token.type)) return false;
if (/\bstring2?\b/.test(token.type) || stringStartsAfter(cm, pos)) return false;
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
stream.pos = stream.start = token.start;
for (;;) {
Expand Down
Empty file modified assets/vendor/codemirror/addon/edit/closetag.js
100755 → 100644
Empty file.
6 changes: 3 additions & 3 deletions assets/vendor/codemirror/addon/edit/continuelist.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
})(function(CodeMirror) {
"use strict";

var listRE = /^(\s*)(>[> ]*|- \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,
emptyListRE = /^(\s*)(>[> ]*|- \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,
var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,
emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,
unorderedListRE = /[*+-]\s/;

CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
Expand All @@ -30,7 +30,7 @@
return;
}
if (emptyListRE.test(line)) {
cm.replaceRange("", {
if (!/>\s*$/.test(line)) cm.replaceRange("", {
line: pos.line, ch: 0
}, {
line: pos.line, ch: pos.ch + 1
Expand Down
Empty file modified assets/vendor/codemirror/addon/edit/matchbrackets.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/edit/matchtags.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/edit/trailingspace.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/fold/brace-fold.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/fold/comment-fold.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/fold/foldcode.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/fold/foldgutter.css
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/fold/foldgutter.js
100755 → 100644
Empty file.
34 changes: 19 additions & 15 deletions assets/vendor/codemirror/addon/fold/indent-fold.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,36 @@
})(function(CodeMirror) {
"use strict";

function lineIndent(cm, lineNo) {
var text = cm.getLine(lineNo)
var spaceTo = text.search(/\S/)
if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1))))
return -1
return CodeMirror.countColumn(text, null, cm.getOption("tabSize"))
}
!
CodeMirror.registerHelper("fold", "indent", function(cm, start) {
var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line);
if (!/\S/.test(firstLine)) return;
var getIndent = function(line) {
return CodeMirror.countColumn(line, null, tabSize);
};
var myIndent = getIndent(firstLine);
var lastLineInFold = null;
var myIndent = lineIndent(cm, start.line)
if (myIndent < 0) return
var lastLineInFold = null

// Go through lines until we find a line that definitely doesn't belong in
// the block we're folding, or to the end.
for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
var curLine = cm.getLine(i);
var curIndent = getIndent(curLine);
if (curIndent > myIndent) {
var indent = lineIndent(cm, i)
if (indent == -1) {
} else if (indent > myIndent) {
// Lines with a greater indent are considered part of the block.
lastLineInFold = i;
} else if (!/\S/.test(curLine)) {
// Empty lines might be breaks within the block we're trying to fold.
} else {
// A non-empty line at an indent equal to or less than ours marks the
// start of another block.
// If this line has non-space, non-comment content, and is
// indented less or equal to the start line, it is the start of
// another block.
break;
}
}
if (lastLineInFold) return {
from: CodeMirror.Pos(start.line, firstLine.length),
from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
};
});
Expand Down
Empty file modified assets/vendor/codemirror/addon/fold/markdown-fold.js
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions assets/vendor/codemirror/addon/fold/xml-fold.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@
}
};

CodeMirror.findEnclosingTag = function(cm, pos, range) {
CodeMirror.findEnclosingTag = function(cm, pos, range, tag) {
var iter = new Iter(cm, pos.line, pos.ch, range);
for (;;) {
var open = findMatchingOpen(iter);
var open = findMatchingOpen(iter, tag);
if (!open) break;
var forward = new Iter(cm, pos.line, pos.ch, range);
var close = findMatchingClose(forward, open.tag);
Expand Down
Empty file modified assets/vendor/codemirror/addon/hint/anyword-hint.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/hint/css-hint.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/hint/html-hint.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/hint/javascript-hint.js
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/hint/show-hint.css
100755 → 100644
Empty file.
Empty file modified assets/vendor/codemirror/addon/hint/show-hint.js
100755 → 100644
Empty file.
Loading

0 comments on commit 34fdaa5

Please sign in to comment.