Skip to content

Commit

Permalink
Upgrade to CodeMirror 5.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
markhillard committed Oct 19, 2017
1 parent 457b250 commit 29abca4
Show file tree
Hide file tree
Showing 38 changed files with 768 additions and 351 deletions.
7 changes: 7 additions & 0 deletions codemirror/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Anthony Grimes
Anton Kovalyov
Apollo Zhu
AQNOUCH Mohammed
Aram Shatakhtsyan
areos
Arnab Bose
Arsène von Wyss
Expand Down Expand Up @@ -155,6 +156,7 @@ Daniel Kesler
Daniel KJ
Daniel Neel
Daniel Parnell
Daniel Thwaites
Danila Malyutin
Danny Yoo
darealshinji
Expand Down Expand Up @@ -213,7 +215,9 @@ ForbesLindesay
Forbes Lindesay
Ford_Lawnmower
Forrest Oliphant
Franco Catena
Frank Wiegand
Fredrik Borg
Gabriel Gheorghian
Gabriel Horner
Gabriel Nahmias
Expand Down Expand Up @@ -255,6 +259,7 @@ hitsthings
Hocdoc
Hugues Malphettes
Ian Beck
Ian Davies
Ian Dickinson
Ian Wehrman
Ian Wetherbee
Expand Down Expand Up @@ -376,6 +381,7 @@ LloydMilligan
LM
lochel
Lorenzo Stoakes
Louis Mauchet
Luca Fabbri
Luciano Longo
Lu Fangjian
Expand Down Expand Up @@ -660,6 +666,7 @@ Weiyan Shao
wenli
Wes Cossick
Wesley Wiser
Weston Ruter
Will Binns-Smith
Will Dean
William Jamieson
Expand Down
26 changes: 25 additions & 1 deletion codemirror/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## 5.30.0 (2017-09-20)

### Bug fixes

Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.

[search addon](http://codemirror.net/demo/search/): Fix crash when restarting search after doing empty search.

[mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug.

[tern addon](http://codemirror.net/demo/tern.html): Fix bad request made when editing at the bottom of a large document.

[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing in a number of corner cases.

[markdown mode](http://codemirror.net/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.

[gfm mode](http://codemirror.net/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.

[soy mode](http://codemirror.net/mode/soy/): Support injected data and `@param` in comments.

### New features

[simple mode addon](http://codemirror.net/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.

## 5.29.0 (2017-08-24)

### Bug fixes
Expand Down Expand Up @@ -54,7 +78,7 @@ Fix crash when using mode lookahead.

### Bug fixes

Fix crash in the [simple mode](http://codemirror.net/demo/simplemode.html) addon.
Fix crash in the [simple mode](http://codemirror.net/demo/simplemode.html)< addon.

## 5.27.0 (2017-06-22)

Expand Down
3 changes: 2 additions & 1 deletion codemirror/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
CodeMirror is a versatile text editor implemented in JavaScript for
the browser. It is specialized for editing code, and comes with over
100 language modes and various addons that implement more advanced
editing functionality.
editing functionality. Every language comes with fully-featured code
and syntax highlighting to help with reading and editing complex code.

A rich programming API and a CSS theming system are available for
customizing CodeMirror to fit your application, and extending it with
Expand Down
11 changes: 8 additions & 3 deletions codemirror/addon/edit/closebrackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
cm.state.closeBrackets = null;
}
if (val) {
ensureBound(getOption(val, "pairs"))
cm.state.closeBrackets = val;
cm.addKeyMap(keyMap);
}
Expand All @@ -34,10 +35,14 @@
return defaults[name];
}

var bind = defaults.pairs + "`";
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
for (var i = 0; i < bind.length; i++)
keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i));
function ensureBound(chars) {
for (var i = 0; i < chars.length; i++) {
var ch = chars.charAt(i), key = "'" + ch + "'"
if (!keyMap[key]) keyMap[key] = handler(ch)
}
}
ensureBound(defaults.pairs + "`")

function handler(ch) {
return function(cm) { return handleChar(cm, ch); };
Expand Down
2 changes: 1 addition & 1 deletion codemirror/addon/hint/show-hint.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
setTimeout(function(){cm.focus();}, 20);
});

CodeMirror.signal(data, "select", completions[0], hints.firstChild);
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions codemirror/addon/lint/css-lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
})(function(CodeMirror) {
"use strict";

CodeMirror.registerHelper("lint", "css", function(text) {
CodeMirror.registerHelper("lint", "css", function(text, options) {
var found = [];
if (!window.CSSLint) {
if (window.console) {
window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run.");
}
return found;
}
var results = CSSLint.verify(text), messages = results.messages, message = null;
var results = CSSLint.verify(text, options), messages = results.messages, message = null;
for ( var i = 0; i < messages.length; i++) {
message = messages[i];
var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
Expand Down
6 changes: 5 additions & 1 deletion codemirror/addon/lint/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@

function startLinting(cm) {
var state = cm.state.lint, options = state.options;
var passOptions = options.options || options; // Support deprecated passing of `options` property in options
/*
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
*/
var passOptions = options.options || options;
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
if (!getAnnotations) return;
if (options.async || getAnnotations.async) {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/addon/mode/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
state.indent.pop();
var token = rule.token
if (token && token.apply) token = token(matches)
if (matches.length > 2) {
if (matches.length > 2 && rule.token && typeof rule.token != "string") {
state.pending = [];
for (var j = 2; j < matches.length; j++)
if (matches[j])
Expand Down
1 change: 1 addition & 0 deletions codemirror/addon/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
var state = getSearchState(cm);
if (state.query) return findNext(cm, rev);
var q = cm.getSelection() || state.lastQuery;
if (q instanceof RegExp && q.source == "x^") q = null
if (persistent && cm.openDialog) {
var hiding = null
var searchNext = function(query, event) {
Expand Down
2 changes: 1 addition & 1 deletion codemirror/addon/selection/mark-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
if (!array.length) return coverRange(cm, from, to);

var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
if (!coverStart || !coverEnd || to.line - from.line < CHUNK_SIZE ||
if (!coverStart || !coverEnd || to.line - from.line <= CHUNK_SIZE ||
cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
return reset(cm);

Expand Down
2 changes: 1 addition & 1 deletion codemirror/addon/tern/tern.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@
return {type: "part",
name: data.name,
offsetLines: from.line,
text: doc.getRange(from, Pos(endLine, 0))};
text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))};
}

// Generic utilities
Expand Down
15 changes: 7 additions & 8 deletions codemirror/demo/simplemode.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ <h2>Simple Mode Demo</h2>
<dd>The regular expression that matches the token. May be a string
or a regex object. When a regex, the <code>ignoreCase</code> flag
will be taken into account when matching the token. This regex
should only capture groups when the <code>token</code> property is
an array.</dd>
<dt><code><strong>token</strong></code>: string | null</dt>
has to capture groups when the <code>token</code> property is
an array. If it captures groups, it must capture <em>all</em> of the string
(since JS provides no way to find out where a group matched).</dd>
<dt><code><strong>token</strong></code>: string | array&lt;string&gt; | null</dt>
<dd>An optional token style. Multiple styles can be specified by
separating them with dots or spaces. When the <code>regex</code> for
this rule captures groups, it must capture <em>all</em> of the
string (since JS provides no way to find out where a group matched),
and this property must hold an array of token styles that has one
style for each matched group.</dd>
separating them with dots or spaces. When this property holds an array of token styles,
the <code>regex</code> for this rule must capture a group for each array item.
</dd>
<dt><code><strong>sol</strong></code>: boolean</dt>
<dd>When true, this token will only match at the start of the line.
(The <code>^</code> regexp marker doesn't work as you'd expect in
Expand Down
5 changes: 4 additions & 1 deletion codemirror/doc/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<section class=first id=overview>
<h2 style="position: relative">
User manual and reference guide
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.29.0</span>
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.30.0</span>
</h2>

<p>CodeMirror is a code-editor component that can be embedded in
Expand Down Expand Up @@ -2229,6 +2229,9 @@ <h3 id="api_static">Static properties</h3>
various <a href="#event_change">event handlers</a>). The
returned position will be the end of the changed
range, <em>after</em> the change is applied.</dd>

<dt id="countColumn"><code><strong>CodeMirror.countColumn</strong>(line: string, index: number, tabSize: number) → number</code></dt>
<dd>Find the column position at a given string index using a given tabsize.</dd>
</dl>
</section>

Expand Down
1 change: 1 addition & 0 deletions codemirror/doc/realworld.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ <h2>CodeMirror real-world uses</h2>
<li><a href="http://drupal.org/project/cpn">Code per Node</a> (Drupal module)</li>
<li><a href="https://codebitt.com/">CodeBitt</a> (Code snippet sharing)</li>
<li><a href="http://www.codebugapp.com/">Codebug</a> (PHP Xdebug front-end)</li>
<li><a href="http://codefights.com/">CodeFights</a> (practice programming)</li>
<li><a href="https://github.com/angelozerr/CodeMirror-Eclipse">CodeMirror Eclipse</a> (embed CM in Eclipse)</li>
<li><a href="http://emmet.io/blog/codemirror-movie/">CodeMirror movie</a> (scripted editing demos)</li>
<li><a href="http://code.google.com/p/codemirror2-gwt/">CodeMirror2-GWT</a> (Google Web Toolkit wrapper)</li>
Expand Down
14 changes: 14 additions & 0 deletions codemirror/doc/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ <h2>Release notes and version history</h2>

<h2>Version 5.x</h2>

<p class="rel">20-09-2017: <a href="http://codemirror.net/codemirror-5.30.0.zip">Version 5.30.0</a>:</p>

<ul class="rel-note">
<li>Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.</li>
<li><a href="http://codemirror.net/demo/search/">search addon</a>: Fix crash when restarting search after doing empty search.</li>
<li><a href="http://cm/doc/manual.html#addon_mark-selection">mark-selection addon</a>: Fix off-by-one bug.</li>
<li><a href="http://codemirror.net/demo/tern.html">tern addon</a>: Fix bad request made when editing at the bottom of a large document.</li>
<li><a href="http://codemirror.net/mode/javascript/">javascript mode</a>: Improve parsing in a number of corner cases.</li>
<li><a href="http://codemirror.net/mode/markdown/">markdown mode</a>: Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.</li>
<li><a href="http://codemirror.net/mode/gfm/">gfm mode</a>: Don't highlight SHA1 'hashes' without numbers to avoid false positives.</li>
<li><a href="http://codemirror.net/mode/soy/">soy mode</a>: Support injected data and <code>@param</code> in comments.</li>
<li><a href="http://codemirror.net/demo/simplemode.html">simple mode addon</a>: Allow groups in regexps when <code>token</code> isn't an array.</li>
</ul>

<p class="rel">24-08-2017: <a href="http://codemirror.net/codemirror-5.29.0.zip">Version 5.29.0</a>:</p>

<ul class="rel-note">
Expand Down
5 changes: 2 additions & 3 deletions codemirror/doc/reporting.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ <h2>Reporting bugs effectively</h2>

<li>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.</li>
instead? Describe the exact steps a maintainer has to take to reproduce
the error. We can not fix something that we can not observe.</li>

<li>If the problem can not be reproduced in any of the demos
included in the CodeMirror distribution, please provide an HTML
Expand Down
2 changes: 1 addition & 1 deletion codemirror/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h2>This is CodeMirror</h2>
</div>
</div>
<div class=actionsleft>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.29.0</a>.<br>
Get the current version: <a href="http://codemirror.net/codemirror.zip">5.30.0</a>.<br>
You can see the <a href="https://github.com/codemirror/codemirror" title="Github repository">code</a>,<br>
read the <a href="doc/releases.html">release notes</a>,<br>
or study the <a href="doc/manual.html">user manual</a>.
Expand Down
Loading

0 comments on commit 29abca4

Please sign in to comment.