Skip to content

Commit 2c5ef57

Browse files
committed
Merge remote-tracking branch 'codemirror/master'
2 parents 111f18e + 6d68735 commit 2c5ef57

37 files changed

+365
-66
lines changed

AUTHORS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ Calin Barbat
121121
callodacity
122122
Camilo Roca
123123
Casey Klebba
124+
César González Íñiguez
124125
Chad Jolly
125126
Chandra Sekhar Pydi
126127
Charles Skelton
@@ -131,6 +132,7 @@ Chris Granger
131132
Chris Houseknecht
132133
Chris Lohfink
133134
Chris Morgan
135+
Chris Reeves
134136
Chris Smith
135137
Christian Gruen
136138
Christian Oyarzun
@@ -258,6 +260,7 @@ Hans Engel
258260
Hardest
259261
Harshvardhan Gupta
260262
Hasan Karahan
263+
Heanes
261264
Hector Oswaldo Caballero
262265
Hélio
263266
Hendrik Wallbaum
@@ -386,6 +389,7 @@ Lanfei
386389
Lanny
387390
Laszlo Vidacs
388391
leaf corcoran
392+
Lemmon
389393
Leonid Khachaturov
390394
Leon Sorokin
391395
Leonya Khachaturov
@@ -567,8 +571,11 @@ ramwin1
567571
Randall Mason
568572
Randy Burden
569573
Randy Edmunds
574+
Randy Luecke
575+
Raphael Amorim
570576
Rasmus Erik Voel Jensen
571577
Rasmus Schultz
578+
Raymond Hill
572579
ray ratchup
573580
Ray Ratchup
574581
Remi Nyborg
@@ -587,6 +594,7 @@ Rrrandom
587594
Ruslan Osmanov
588595
Ryan Petrello
589596
Ryan Prior
597+
ryu-sato
590598
sabaca
591599
Sam Lee
592600
Sam Rawlins
@@ -679,6 +687,7 @@ Tomas Varaneckas
679687
Tom Erik Støwer
680688
Tom Klancer
681689
Tom MacWright
690+
Tom McLaughlin
682691
Tony Jian
683692
tophf
684693
totalamd

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
## 5.36.0 (2018-03-20)
2+
3+
### Bug fixes
4+
5+
Make sure all document-level event handlers are registered on the document that the editor is part of.
6+
7+
Fix issue that prevented edits whose origin starts with `+` from being combined in history events for an editor-less document.
8+
9+
[multiplex addon](http://codemirror.net/demo/multiplex.html): Improve handling of indentation.
10+
11+
[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Use CSS `:after` element to style the scroll-lock icon.
12+
13+
[javascript-hint addon](http://codemirror.net/doc/manual.html#addon_javascript-hint): Don't provide completions in JSON mode.
14+
15+
[continuelist addon](http://codemirror.net/doc/manual.html#addon_continuelist): Fix numbering error.
16+
17+
[show-hint addon](http://codemirror.net/doc/manual.html#addon_show-hint): Make `fromList` completion strategy act on the current token up to the cursor, rather than the entire token.
18+
19+
[markdown mode](http://codemirror.net/mode/markdown/): Fix a regexp with potentially exponental complexity.
20+
21+
### New features
22+
23+
New theme: [lucario](http://codemirror.net/demo/theme.html#lucario).
24+
125
## 5.35.0 (2018-02-20)
226

327
### Bug fixes

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# CodeMirror
2+
23
[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)
34
[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)
45
[![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror)
@@ -28,6 +29,19 @@ The CodeMirror community aims to be welcoming to everybody. We use the
2829
(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
2930
conduct.
3031

32+
### Installation
33+
34+
Either get the [zip file](https://codemirror.net/codemirror.zip) with
35+
the latest version, or make sure you have [Node](https://nodejs.org/)
36+
installed and run:
37+
38+
npm install codemirror
39+
40+
**NOTE**: This is the source repository for the library, and not the
41+
distribution channel. Cloning it is not the recommended way to install
42+
the library, and will in fact not work unless you also run the build
43+
step.
44+
3145
### Quickstart
3246

3347
To build the project, make sure you have Node.js installed (at least version 6)

addon/edit/continuelist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
var newNumber = (parseInt(startItem[3], 10) + lookAhead - skipCount);
6868
var nextNumber = (parseInt(nextItem[3], 10)), itemNumber = nextNumber;
6969

70-
if (startIndent === nextIndent) {
70+
if (startIndent === nextIndent && !isNaN(nextNumber)) {
7171
if (newNumber === nextNumber) itemNumber = nextNumber + 1;
7272
if (newNumber > nextNumber) itemNumber = newNumber + 1;
7373
cm.replaceRange(

addon/fold/xml-fold.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@
137137
CodeMirror.registerHelper("fold", "xml", function(cm, start) {
138138
var iter = new Iter(cm, start.line, 0);
139139
for (;;) {
140-
var openTag = toNextTag(iter), end;
141-
if (!openTag || !(end = toTagEnd(iter)) || iter.line != start.line) return;
140+
var openTag = toNextTag(iter)
141+
if (!openTag || iter.line != start.line) return
142+
var end = toTagEnd(iter)
143+
if (!end) return
142144
if (!openTag[1] && end != "selfClose") {
143145
var startPos = Pos(iter.line, iter.ch);
144146
var endPos = findMatchingClose(iter, openTag[2]);
145-
return endPos && {from: startPos, to: endPos.from};
147+
return endPos && cmp(endPos.from, startPos) > 0 ? {from: startPos, to: endPos.from} : null
146148
}
147149
}
148150
});

addon/hint/javascript-hint.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
// Find the token at the cursor
3333
var cur = editor.getCursor(), token = getToken(editor, cur);
3434
if (/\b(?:string|comment)\b/.test(token.type)) return;
35-
token.state = CodeMirror.innerMode(editor.getMode(), token.state).state;
35+
var innerMode = CodeMirror.innerMode(editor.getMode(), token.state);
36+
if (innerMode.mode.helperType === "json") return;
37+
token.state = innerMode.state;
3638

3739
// If it's not a 'word-style' token, ignore the token.
3840
if (!/^[\w$_]*$/.test(token.string)) {

addon/hint/show-hint.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,13 @@
397397
});
398398

399399
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
400-
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
401-
var to = CodeMirror.Pos(cur.line, token.end);
402-
if (token.string && /\w/.test(token.string[token.string.length - 1])) {
403-
var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
400+
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
401+
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
402+
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
403+
term = token.string.substr(0, cur.ch - token.start)
404404
} else {
405-
var term = "", from = to;
405+
term = ""
406+
from = cur
406407
}
407408
var found = [];
408409
for (var i = 0; i < options.words.length; i++) {

addon/merge/merge.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
color: #555;
4949
line-height: 1;
5050
}
51+
.CodeMirror-merge-scrolllock:after {
52+
content: "\21db\00a0\00a0\21da";
53+
}
54+
.CodeMirror-merge-scrolllock.CodeMirror-merge-scrolllock-enabled:after {
55+
content: "\21db\21da";
56+
}
5157

5258
.CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right {
5359
position: absolute;

addon/merge/merge.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@
211211
function setScrollLock(dv, val, action) {
212212
dv.lockScroll = val;
213213
if (val && action != false) syncScroll(dv, DIFF_INSERT) && makeConnections(dv);
214-
dv.lockButton.innerHTML = val ? "\u21db\u21da" : "\u21db&nbsp;&nbsp;\u21da";
214+
(val ? CodeMirror.addClass : CodeMirror.rmClass)(dv.lockButton, "CodeMirror-merge-scrolllock-enabled");
215215
}
216216

217217
// Updating the marks for editor content
@@ -664,6 +664,7 @@
664664

665665
function getChunks(diff) {
666666
var chunks = [];
667+
if (!diff.length) return chunks;
667668
var startEdit = 0, startOrig = 0;
668669
var edit = Pos(0, 0), orig = Pos(0, 0);
669670
for (var i = 0; i < diff.length; ++i) {

addon/mode/multiplex.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
5050
if (found == stream.pos) {
5151
if (!other.parseDelimiters) stream.match(other.open);
5252
state.innerActive = other;
53-
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
53+
54+
// Get the outer indent, making sure to handle CodeMirror.Pass
55+
var outerIndent = 0;
56+
if (outer.indent) {
57+
var possibleOuterIndent = outer.indent(state.outer, "");
58+
if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
59+
}
60+
61+
state.inner = CodeMirror.startState(other.mode, outerIndent);
5462
return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
5563
} else if (found != -1 && found < cutOff) {
5664
cutOff = found;

0 commit comments

Comments
 (0)