Skip to content

Commit a0a90f5

Browse files
committed
Merge commit 'f936d89e4a2aa68eee964f57d14f875ee1d71ff4'
2 parents 58ca50c + f936d89 commit a0a90f5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+901
-278
lines changed

AUTHORS

+16-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Andreas Reischuck
4848
Andres Taylor
4949
Andre von Houck
5050
Andrew Cheng
51+
Andrew Dassonville
5152
Andrey Fedorov
5253
Andrey Klyuchnikov
5354
Andrey Lushnikov
@@ -68,6 +69,7 @@ Anthony Grimes
6869
Anton Kovalyov
6970
Apollo Zhu
7071
AQNOUCH Mohammed
72+
Aram Shatakhtsyan
7173
areos
7274
Arnab Bose
7375
Arsène von Wyss
@@ -155,6 +157,7 @@ Daniel Kesler
155157
Daniel KJ
156158
Daniel Neel
157159
Daniel Parnell
160+
Daniel Thwaites
158161
Danila Malyutin
159162
Danny Yoo
160163
darealshinji
@@ -213,7 +216,9 @@ ForbesLindesay
213216
Forbes Lindesay
214217
Ford_Lawnmower
215218
Forrest Oliphant
219+
Franco Catena
216220
Frank Wiegand
221+
Fredrik Borg
217222
Gabriel Gheorghian
218223
Gabriel Horner
219224
Gabriel Nahmias
@@ -238,6 +243,7 @@ Grant Skinner
238243
greengiant
239244
Gregory Koberger
240245
Grzegorz Mazur
246+
Guan Gui
241247
Guillaume Massé
242248
Guillaume Massé
243249
guraga
@@ -249,12 +255,14 @@ Harshvardhan Gupta
249255
Hasan Karahan
250256
Hector Oswaldo Caballero
251257
Hendrik Wallbaum
258+
Henrik Haugbølle
252259
Herculano Campos
253260
Hiroyuki Makino
254261
hitsthings
255262
Hocdoc
256263
Hugues Malphettes
257264
Ian Beck
265+
Ian Davies
258266
Ian Dickinson
259267
Ian Wehrman
260268
Ian Wetherbee
@@ -303,6 +311,7 @@ jem (graphite)
303311
Jeremy Parmenter
304312
Jim
305313
Jim Avery
314+
jkaplon
306315
JobJob
307316
jochenberger
308317
Jochen Berger
@@ -336,6 +345,7 @@ ju1ius
336345
Juan Benavides Romero
337346
Jucovschi Constantin
338347
Juho Vuori
348+
Julien CROUZET
339349
Julien Rebetez
340350
Justin Andresen
341351
Justin Hileman
@@ -376,6 +386,7 @@ LloydMilligan
376386
LM
377387
lochel
378388
Lorenzo Stoakes
389+
Louis Mauchet
379390
Luca Fabbri
380391
Luciano Longo
381392
Lu Fangjian
@@ -405,6 +416,7 @@ Mark Lentczner
405416
Marko Bonaci
406417
Mark Peace
407418
Markus Bordihn
419+
Markus Olsson
408420
Martin Balek
409421
Martín Gaitán
410422
Martin Hasoň
@@ -522,8 +534,8 @@ peterkroon
522534
Peter Kroon
523535
Philipp A
524536
Philip Stadermann
537+
Pi Delport
525538
Pierre Gerold
526-
Piët Delport
527539
Pieter Ouwerkerk
528540
Pontus Melke
529541
prasanthj
@@ -627,6 +639,7 @@ thanasis
627639
TheHowl
628640
themrmax
629641
think
642+
Thomas Brouard
630643
Thomas Dvornik
631644
Thomas Kluyver
632645
Thomas Schmid
@@ -656,10 +669,12 @@ vf
656669
Victor Bocharsky
657670
Vincent Woo
658671
Volker Mische
672+
vtripolitakis
659673
Weiyan Shao
660674
wenli
661675
Wes Cossick
662676
Wesley Wiser
677+
Weston Ruter
663678
Will Binns-Smith
664679
Will Dean
665680
William Jamieson

CHANGELOG.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1+
## 5.31.0 (2017-10-20)
2+
3+
### Bug fixes
4+
5+
Further improve selection drawing and cursor motion in right-to-left documents.
6+
7+
[vim bindings](http://codemirror.net/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](http://codemirror.net/doc/manual.html#option_contentEditable).
8+
9+
[continuecomment addon](http://codemirror.net/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.
10+
11+
[markdown mode](http://codemirror.net/mode/markdown/): Fix issue with leaving indented fenced code blocks.
12+
13+
[javascript mode](http://codemirror.net/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.
14+
15+
### New features
16+
17+
Modes added with [`addOverlay`](http://codemirror.net/doc/manual.html#addOverlay) now have access to a [`baseToken`](http://codemirror.net/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.
18+
19+
## 5.30.0 (2017-09-20)
20+
21+
### Bug fixes
22+
23+
Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.
24+
25+
[search addon](http://codemirror.net/demo/search/): Fix crash when restarting search after doing empty search.
26+
27+
[mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug.
28+
29+
[tern addon](http://codemirror.net/demo/tern.html): Fix bad request made when editing at the bottom of a large document.
30+
31+
[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing in a number of corner cases.
32+
33+
[markdown mode](http://codemirror.net/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.
34+
35+
[gfm mode](http://codemirror.net/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.
36+
37+
[soy mode](http://codemirror.net/mode/soy/): Support injected data and `@param` in comments.
38+
39+
### New features
40+
41+
[simple mode addon](http://codemirror.net/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.
42+
143
## 5.29.0 (2017-08-24)
244

345
### Bug fixes
@@ -54,7 +96,7 @@ Fix crash when using mode lookahead.
5496

5597
### Bug fixes
5698

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

59101
## 5.27.0 (2017-06-22)
60102

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
CodeMirror is a versatile text editor implemented in JavaScript for
88
the browser. It is specialized for editing code, and comes with over
99
100 language modes and various addons that implement more advanced
10-
editing functionality.
10+
editing functionality. Every language comes with fully-featured code
11+
and syntax highlighting to help with reading and editing complex code.
1112

1213
A rich programming API and a CSS theming system are available for
1314
customizing CodeMirror to fit your application, and extending it with

addon/comment/continuecomment.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@
99
else // Plain browser env
1010
mod(CodeMirror);
1111
})(function(CodeMirror) {
12-
var modes = ["clike", "css", "javascript"];
13-
14-
for (var i = 0; i < modes.length; ++i)
15-
CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});
16-
1712
function continueComment(cm) {
1813
if (cm.getOption("disableInput")) return CodeMirror.Pass;
1914
var ranges = cm.listSelections(), mode, inserts = [];
@@ -27,10 +22,10 @@
2722
var insert = null;
2823
if (mode.blockCommentStart && mode.blockCommentContinue) {
2924
var line = cm.getLine(pos.line).slice(0, pos.ch)
30-
var end = line.indexOf(mode.blockCommentEnd), found
25+
var end = line.lastIndexOf(mode.blockCommentEnd), found
3126
if (end != -1 && end == pos.ch - mode.blockCommentEnd.length) {
3227
// Comment ended, don't continue it
33-
} else if ((found = line.indexOf(mode.blockCommentStart)) > -1) {
28+
} else if ((found = line.lastIndexOf(mode.blockCommentStart)) > -1 && found > end) {
3429
insert = line.slice(0, found)
3530
if (/\S/.test(insert)) {
3631
insert = ""

addon/edit/closebrackets.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
cm.state.closeBrackets = null;
2424
}
2525
if (val) {
26+
ensureBound(getOption(val, "pairs"))
2627
cm.state.closeBrackets = val;
2728
cm.addKeyMap(keyMap);
2829
}
@@ -34,10 +35,14 @@
3435
return defaults[name];
3536
}
3637

37-
var bind = defaults.pairs + "`";
3838
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
39-
for (var i = 0; i < bind.length; i++)
40-
keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i));
39+
function ensureBound(chars) {
40+
for (var i = 0; i < chars.length; i++) {
41+
var ch = chars.charAt(i), key = "'" + ch + "'"
42+
if (!keyMap[key]) keyMap[key] = handler(ch)
43+
}
44+
}
45+
ensureBound(defaults.pairs + "`")
4146

4247
function handler(ch) {
4348
return function(cm) { return handleChar(cm, ch); };
@@ -79,7 +84,8 @@
7984
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
8085
}
8186
cm.operation(function() {
82-
cm.replaceSelection("\n\n", null);
87+
var linesep = cm.lineSeparator() || "\n";
88+
cm.replaceSelection(linesep + linesep, null);
8389
cm.execCommand("goCharLeft");
8490
ranges = cm.listSelections();
8591
for (var i = 0; i < ranges.length; i++) {

addon/edit/continuelist.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
var inQuote = eolState.quote !== 0;
2626

2727
var line = cm.getLine(pos.line), match = listRE.exec(line);
28-
if (!ranges[i].empty() || (!inList && !inQuote) || !match) {
28+
var cursorBeforeBullet = /^\s*$/.test(line.slice(0, pos.ch));
29+
if (!ranges[i].empty() || (!inList && !inQuote) || !match || cursorBeforeBullet) {
2930
cm.execCommand("newlineAndIndent");
3031
return;
3132
}

addon/hint/show-hint.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
setTimeout(function(){cm.focus();}, 20);
303303
});
304304

305-
CodeMirror.signal(data, "select", completions[0], hints.firstChild);
305+
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
306306
return true;
307307
}
308308

addon/lint/css-lint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
})(function(CodeMirror) {
1616
"use strict";
1717

18-
CodeMirror.registerHelper("lint", "css", function(text) {
18+
CodeMirror.registerHelper("lint", "css", function(text, options) {
1919
var found = [];
2020
if (!window.CSSLint) {
2121
if (window.console) {
2222
window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run.");
2323
}
2424
return found;
2525
}
26-
var results = CSSLint.verify(text), messages = results.messages, message = null;
26+
var results = CSSLint.verify(text, options), messages = results.messages, message = null;
2727
for ( var i = 0; i < messages.length; i++) {
2828
message = messages[i];
2929
var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;

addon/lint/lint.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@
138138

139139
function startLinting(cm) {
140140
var state = cm.state.lint, options = state.options;
141-
var passOptions = options.options || options; // Support deprecated passing of `options` property in options
141+
/*
142+
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
143+
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
144+
*/
145+
var passOptions = options.options || options;
142146
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
143147
if (!getAnnotations) return;
144148
if (options.async || getAnnotations.async) {

addon/mode/simple.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
state.indent.pop();
137137
var token = rule.token
138138
if (token && token.apply) token = token(matches)
139-
if (matches.length > 2) {
139+
if (matches.length > 2 && rule.token && typeof rule.token != "string") {
140140
state.pending = [];
141141
for (var j = 2; j < matches.length; j++)
142142
if (matches[j])

addon/runmode/runmode.node.js

+12
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,18 @@ exports.getMode = function(options, spec) {
163163

164164
return modeObj;
165165
};
166+
167+
exports.innerMode = function(mode, state) {
168+
var info;
169+
while (mode.innerMode) {
170+
info = mode.innerMode(state);
171+
if (!info || info.mode == mode) break;
172+
state = info.state;
173+
mode = info.mode;
174+
}
175+
return info || {mode: mode, state: state};
176+
}
177+
166178
exports.registerHelper = exports.registerGlobalHelper = Math.min;
167179

168180
exports.runMode = function(string, modespec, callback, options) {

addon/search/search.js

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@
117117
var state = getSearchState(cm);
118118
if (state.query) return findNext(cm, rev);
119119
var q = cm.getSelection() || state.lastQuery;
120+
if (q instanceof RegExp && q.source == "x^") q = null
120121
if (persistent && cm.openDialog) {
121122
var hiding = null
122123
var searchNext = function(query, event) {

addon/selection/mark-selection.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
if (!array.length) return coverRange(cm, from, to);
8787

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

addon/tern/tern.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@
571571
return {type: "part",
572572
name: data.name,
573573
offsetLines: from.line,
574-
text: doc.getRange(from, Pos(endLine, 0))};
574+
text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))};
575575
}
576576

577577
// Generic utilities

bin/authors.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Combine existing list of authors with everyone known in git, sort, add header.
22
tail --lines=+3 AUTHORS > AUTHORS.tmp
3-
git log --format='%aN' >> AUTHORS.tmp
3+
git log --format='%aN' | grep -v "Piët Delport" >> AUTHORS.tmp
44
echo -e "List of CodeMirror contributors. Updated before every release.\n" > AUTHORS
55
sort -u AUTHORS.tmp >> AUTHORS
66
rm -f AUTHORS.tmp

demo/simplemode.html

+7-8
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,14 @@ <h2>Simple Mode Demo</h2>
6565
<dd>The regular expression that matches the token. May be a string
6666
or a regex object. When a regex, the <code>ignoreCase</code> flag
6767
will be taken into account when matching the token. This regex
68-
should only capture groups when the <code>token</code> property is
69-
an array.</dd>
70-
<dt><code><strong>token</strong></code>: string | null</dt>
68+
has to capture groups when the <code>token</code> property is
69+
an array. If it captures groups, it must capture <em>all</em> of the string
70+
(since JS provides no way to find out where a group matched).</dd>
71+
<dt><code><strong>token</strong></code>: string | array&lt;string&gt; | null</dt>
7172
<dd>An optional token style. Multiple styles can be specified by
72-
separating them with dots or spaces. When the <code>regex</code> for
73-
this rule captures groups, it must capture <em>all</em> of the
74-
string (since JS provides no way to find out where a group matched),
75-
and this property must hold an array of token styles that has one
76-
style for each matched group.</dd>
73+
separating them with dots or spaces. When this property holds an array of token styles,
74+
the <code>regex</code> for this rule must capture a group for each array item.
75+
</dd>
7776
<dt><code><strong>sol</strong></code>: boolean</dt>
7877
<dd>When true, this token will only match at the start of the line.
7978
(The <code>^</code> regexp marker doesn't work as you'd expect in

demo/vim.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ <h2>Vim bindings demo</h2>
9595
mode: "text/x-csrc",
9696
keyMap: "vim",
9797
matchBrackets: true,
98-
showCursorWhenSelecting: true
98+
showCursorWhenSelecting: true,
99+
inputStyle: "contenteditable"
99100
});
100101
var commandDisplay = document.getElementById('command-display');
101102
var keys = '';

0 commit comments

Comments
 (0)