Skip to content

Commit dc3ce25

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 37553bd + 7f70233 commit dc3ce25

Some content is hidden

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

50 files changed

+991
-817
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
patreon: marijn
22
custom: ['https://www.paypal.com/paypalme/marijnhaverbeke', 'https://marijnhaverbeke.nl/fund/']
3+
github: marijnh

AUTHORS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Adrien Bertrand
2121
aeroson
2222
Ahmad Amireh
2323
Ahmad M. Zawawi
24+
AHOHNMYC
2425
ahoward
2526
Ajin Abraham
2627
Akeksandr Motsjonov
@@ -168,6 +169,7 @@ Chris Smith
168169
Christian Gruen
169170
Christian Oyarzun
170171
Christian Petrov
172+
Christian Sonne
171173
christopherblaser
172174
Christopher Brown
173175
Christopher Kramer
@@ -298,6 +300,7 @@ galambalazs
298300
Gary Sheng
299301
Gautam Mehta
300302
Gavin Douglas
303+
Geist-zz
301304
gekkoe
302305
Geordie Hall
303306
George Stephanis
@@ -373,11 +376,14 @@ Jack Douglas
373376
Jacob Lee
374377
Jaimin
375378
Jake Peyser
379+
Jake Zimmerman
376380
Jakob Kummerow
377381
Jakob Miland
382+
Jakub Nowak
378383
Jakub T. Jankiewicz
379384
Jakub Vrana
380385
Jakub Vrána
386+
James Baicoianu
381387
James Campos
382388
James Cockshull
383389
James Howard
@@ -470,9 +476,11 @@ karevn
470476
Karol
471477
Kaushik Kulkarni
472478
Kayur Patel
479+
Kazuhisa Ishizaka
473480
Kazuhito Hokamura
474481
kcwiakala
475482
Kees de Kooter
483+
Keldan Chapman
476484
Kenan Christian Dimas
477485
Ken Newman
478486
ken restivo
@@ -677,6 +685,7 @@ Norman Rzepka
677685
Nouzbe
678686
Oleksandr Yakovenko
679687
Olivia Ytterbrink
688+
Ondřej Mirtes
680689
Opender Singh
681690
opl-
682691
Oreoluwa Onatemowo
@@ -871,6 +880,7 @@ Thomas Schmid
871880
Tim Alby
872881
Tim Baumann
873882
Tim Gates
883+
Tim Nguyen
874884
Timothy Farrell
875885
Timothy Gu
876886
Timothy Hatcher
@@ -917,6 +927,7 @@ Wes Cossick
917927
Wesley Wiser
918928
Weston Ruter
919929
Will Binns-Smith
930+
Will Cassella
920931
Will Dean
921932
Will Hernandez
922933
William Desportes

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,47 @@
1+
## 5.65.2 (2022-02-21)
2+
3+
### Bug fixes
4+
5+
[clike mode](https://codemirror.net/mode/clike/): Recognize triple quoted string in Java.
6+
7+
[cypher mode](https://codemirror.net/mode/cypher/index.html): Fix handling of punctuation.
8+
9+
## 5.65.1 (2022-01-20)
10+
11+
### Bug fixes
12+
13+
Fix miscalculation of vertical positions in lines that have both line widgets and replaced newlines.
14+
15+
## 5.65.0 (2021-12-20)
16+
17+
### Bug fixes
18+
19+
brace-folding addon: Fix broken folding on lines with both braces and square brackets.
20+
21+
### New features
22+
23+
[vim bindings](https://codemirror.net/demo/vim.html): Support g0, g$, g<Arrow>.
24+
25+
## 5.64.0 (2021-11-20)
26+
27+
### Bug fixes
28+
29+
Fix a crash that occurred in some situations with replacing marks across line breaks.
30+
31+
Make sure native scrollbars reset their position when hidden and re-shown.
32+
33+
### New features
34+
35+
[vim bindings](https://codemirror.net/demo/vim.html): Support C-u to delete back a line.
36+
37+
## 5.63.3 (2021-10-11)
38+
39+
### Bug fixes
40+
41+
Prevent external styles from giving the hidden textarea a min-height.
42+
43+
Remove a stray autosave file that was part of the previous release.
44+
145
## 5.63.1 (2021-09-29)
246

347
### Bug fixes

addon/edit/continuelist.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// If we're not in Markdown mode, fall back to normal newlineAndIndent
2525
var eolState = cm.getStateAfter(pos.line);
2626
var inner = CodeMirror.innerMode(cm.getMode(), eolState);
27-
if (inner.mode.name !== "markdown") {
27+
if (inner.mode.name !== "markdown" && inner.mode.helperType !== "markdown") {
2828
cm.execCommand("newlineAndIndent");
2929
return;
3030
} else {

addon/fold/brace-fold.js

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,67 @@
1111
})(function(CodeMirror) {
1212
"use strict";
1313

14-
CodeMirror.registerHelper("fold", "brace", function(cm, start) {
15-
var line = start.line, lineText = cm.getLine(line);
16-
var tokenType;
14+
function bracketFolding(pairs) {
15+
return function(cm, start) {
16+
var line = start.line, lineText = cm.getLine(line);
1717

18-
function findOpening(openCh) {
19-
for (var at = start.ch, pass = 0;;) {
20-
var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1);
21-
if (found == -1) {
22-
if (pass == 1) break;
23-
pass = 1;
24-
at = lineText.length;
25-
continue;
18+
function findOpening(pair) {
19+
var tokenType;
20+
for (var at = start.ch, pass = 0;;) {
21+
var found = at <= 0 ? -1 : lineText.lastIndexOf(pair[0], at - 1);
22+
if (found == -1) {
23+
if (pass == 1) break;
24+
pass = 1;
25+
at = lineText.length;
26+
continue;
27+
}
28+
if (pass == 1 && found < start.ch) break;
29+
tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
30+
if (!/^(comment|string)/.test(tokenType)) return {ch: found + 1, tokenType: tokenType, pair: pair};
31+
at = found - 1;
2632
}
27-
if (pass == 1 && found < start.ch) break;
28-
tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
29-
if (!/^(comment|string)/.test(tokenType)) return found + 1;
30-
at = found - 1;
3133
}
32-
}
33-
34-
var startBrace = findOpening("{"), startBracket = findOpening("[")
35-
var startToken, endToken, startCh
36-
if (startBrace != null && (startBracket == null || startBracket > startBrace)) {
37-
startCh = startBrace; startToken = "{"; endToken = "}"
38-
} else if (startBracket != null) {
39-
startCh = startBracket; startToken = "["; endToken = "]"
40-
} else {
41-
return
42-
}
4334

44-
var count = 1, lastLine = cm.lastLine(), end, endCh;
45-
outer: for (var i = line; i <= lastLine; ++i) {
46-
var text = cm.getLine(i), pos = i == line ? startCh : 0;
47-
for (;;) {
48-
var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
49-
if (nextOpen < 0) nextOpen = text.length;
50-
if (nextClose < 0) nextClose = text.length;
51-
pos = Math.min(nextOpen, nextClose);
52-
if (pos == text.length) break;
53-
if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) {
54-
if (pos == nextOpen) ++count;
55-
else if (!--count) { end = i; endCh = pos; break outer; }
35+
function findRange(found) {
36+
var count = 1, lastLine = cm.lastLine(), end, startCh = found.ch, endCh
37+
outer: for (var i = line; i <= lastLine; ++i) {
38+
var text = cm.getLine(i), pos = i == line ? startCh : 0;
39+
for (;;) {
40+
var nextOpen = text.indexOf(found.pair[0], pos), nextClose = text.indexOf(found.pair[1], pos);
41+
if (nextOpen < 0) nextOpen = text.length;
42+
if (nextClose < 0) nextClose = text.length;
43+
pos = Math.min(nextOpen, nextClose);
44+
if (pos == text.length) break;
45+
if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == found.tokenType) {
46+
if (pos == nextOpen) ++count;
47+
else if (!--count) { end = i; endCh = pos; break outer; }
48+
}
49+
++pos;
50+
}
5651
}
57-
++pos;
52+
53+
if (end == null || line == end) return null
54+
return {from: CodeMirror.Pos(line, startCh),
55+
to: CodeMirror.Pos(end, endCh)};
56+
}
57+
58+
var found = []
59+
for (var i = 0; i < pairs.length; i++) {
60+
var open = findOpening(pairs[i])
61+
if (open) found.push(open)
62+
}
63+
found.sort(function(a, b) { return a.ch - b.ch })
64+
for (var i = 0; i < found.length; i++) {
65+
var range = findRange(found[i])
66+
if (range) return range
5867
}
68+
return null
5969
}
60-
if (end == null || line == end) return;
61-
return {from: CodeMirror.Pos(line, startCh),
62-
to: CodeMirror.Pos(end, endCh)};
63-
});
70+
}
71+
72+
CodeMirror.registerHelper("fold", "brace", bracketFolding([["{", "}"], ["[", "]"]]));
73+
74+
CodeMirror.registerHelper("fold", "brace-paren", bracketFolding([["{", "}"], ["[", "]"], ["(", ")"]]));
6475

6576
CodeMirror.registerHelper("fold", "import", function(cm, start) {
6677
function hasImport(line) {

addon/search/searchcursor.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202

203203
function SearchCursor(doc, query, pos, options) {
204204
this.atOccurrence = false
205+
this.afterEmptyMatch = false
205206
this.doc = doc
206207
pos = pos ? doc.clipPos(pos) : Pos(0, 0)
207208
this.pos = {from: pos, to: pos}
@@ -237,21 +238,29 @@
237238
findPrevious: function() {return this.find(true)},
238239

239240
find: function(reverse) {
240-
var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))
241-
242-
// Implements weird auto-growing behavior on null-matches for
243-
// backwards-compatibility with the vim code (unfortunately)
244-
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {
241+
var head = this.doc.clipPos(reverse ? this.pos.from : this.pos.to);
242+
if (this.afterEmptyMatch && this.atOccurrence) {
243+
// do not return the same 0 width match twice
244+
head = Pos(head.line, head.ch)
245245
if (reverse) {
246-
if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)
247-
else if (result.from.line == this.doc.firstLine()) result = null
248-
else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))
246+
head.ch--;
247+
if (head.ch < 0) {
248+
head.line--;
249+
head.ch = (this.doc.getLine(head.line) || "").length;
250+
}
249251
} else {
250-
if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)
251-
else if (result.to.line == this.doc.lastLine()) result = null
252-
else result = this.matches(reverse, Pos(result.to.line + 1, 0))
252+
head.ch++;
253+
if (head.ch > (this.doc.getLine(head.line) || "").length) {
254+
head.ch = 0;
255+
head.line++;
256+
}
257+
}
258+
if (CodeMirror.cmpPos(head, this.doc.clipPos(head)) != 0) {
259+
return this.atOccurrence = false
253260
}
254261
}
262+
var result = this.matches(reverse, head)
263+
this.afterEmptyMatch = result && CodeMirror.cmpPos(result.from, result.to) == 0
255264

256265
if (result) {
257266
this.pos = result

demo/lint.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<script src="../lib/codemirror.js"></script>
1111
<script src="../mode/javascript/javascript.js"></script>
1212
<script src="../mode/css/css.js"></script>
13-
<script src="https://unpkg.com/jshint@2.9.6/dist/jshint.js"></script>
13+
<script src="https://unpkg.com/jshint@2.13.2/dist/jshint.js"></script>
1414
<script src="https://unpkg.com/[email protected]/web/jsonlint.js"></script>
1515
<script src="https://unpkg.com/[email protected]/dist/csslint.js"></script>
1616
<script src="../addon/lint/lint.js"></script>
@@ -151,7 +151,7 @@ <h2>Linter Demo</h2>
151151
lineNumbers: true,
152152
mode: "javascript",
153153
gutters: ["CodeMirror-lint-markers"],
154-
lint: true
154+
lint: {options: {esversion: 2021}},
155155
});
156156

157157
var editor_json = CodeMirror.fromTextArea(document.getElementById("code-json"), {

doc/docs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
font-family: 'Source Sans Pro';
33
font-style: normal;
44
font-weight: 400;
5-
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(//themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
5+
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(source_sans.woff) format('woff');
66
}
77

88
body, html { margin: 0; padding: 0; height: 100%; }

doc/logos/4me.svg

Lines changed: 1 addition & 0 deletions
Loading

doc/logos/anvil.png

9.29 KB
Loading

0 commit comments

Comments
 (0)