From 96d8d5129859b9aafdffd9888ffe39c893a4c1c3 Mon Sep 17 00:00:00 2001
From: Roman Janusz
Date: Fri, 24 Jan 2020 22:04:34 +0100
Subject: [PATCH 001/581] [lint addon] Add theme class name to tooltips
---
addon/lint/lint.js | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/addon/lint/lint.js b/addon/lint/lint.js
index aa75ba0e8a..0eac8d12a1 100644
--- a/addon/lint/lint.js
+++ b/addon/lint/lint.js
@@ -12,9 +12,9 @@
"use strict";
var GUTTER_ID = "CodeMirror-lint-markers";
- function showTooltip(e, content) {
+ function showTooltip(cm, e, content) {
var tt = document.createElement("div");
- tt.className = "CodeMirror-lint-tooltip";
+ tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
tt.appendChild(content.cloneNode(true));
document.body.appendChild(tt);
@@ -38,8 +38,8 @@
setTimeout(function() { rm(tt); }, 600);
}
- function showTooltipFor(e, content, node) {
- var tooltip = showTooltip(e, content);
+ function showTooltipFor(cm, e, content, node) {
+ var tooltip = showTooltip(cm, e, content);
function hide() {
CodeMirror.off(node, "mouseout", hide);
if (tooltip) { hideTooltip(tooltip); tooltip = null; }
@@ -78,7 +78,7 @@
state.marked.length = 0;
}
- function makeMarker(labels, severity, multiple, tooltips) {
+ function makeMarker(cm, labels, severity, multiple, tooltips) {
var marker = document.createElement("div"), inner = marker;
marker.className = "CodeMirror-lint-marker-" + severity;
if (multiple) {
@@ -87,7 +87,7 @@
}
if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
- showTooltipFor(e, labels, inner);
+ showTooltipFor(cm, e, labels, inner);
});
return marker;
@@ -113,9 +113,9 @@
var tip = document.createElement("div");
tip.className = "CodeMirror-lint-message-" + severity;
if (typeof ann.messageHTML != 'undefined') {
- tip.innerHTML = ann.messageHTML;
+ tip.innerHTML = ann.messageHTML;
} else {
- tip.appendChild(document.createTextNode(ann.message));
+ tip.appendChild(document.createTextNode(ann.message));
}
return tip;
}
@@ -186,7 +186,7 @@
}
if (state.hasGutter)
- cm.setGutterMarker(line, GUTTER_ID, makeMarker(tipLabel, maxSeverity, anns.length > 1,
+ cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, anns.length > 1,
state.options.tooltips));
}
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
@@ -199,14 +199,14 @@
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);
}
- function popupTooltips(annotations, e) {
+ function popupTooltips(cm, annotations, e) {
var target = e.target || e.srcElement;
var tooltip = document.createDocumentFragment();
for (var i = 0; i < annotations.length; i++) {
var ann = annotations[i];
tooltip.appendChild(annotationTooltip(ann));
}
- showTooltipFor(e, tooltip, target);
+ showTooltipFor(cm, e, tooltip, target);
}
function onMouseOver(cm, e) {
@@ -220,7 +220,7 @@
var ann = spans[i].__annotation;
if (ann) annotations.push(ann);
}
- if (annotations.length) popupTooltips(annotations, e);
+ if (annotations.length) popupTooltips(cm, annotations, e);
}
CodeMirror.defineOption("lint", false, function(cm, val, old) {
From 89d21ec155cef514904bf3a1ead7abfb4d654b16 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 3 Feb 2020 10:56:30 +0100
Subject: [PATCH 002/581] [stylus mode] Don't match #-rgb colors before a dash
character
Closes #6132
---
mode/stylus/stylus.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/stylus/stylus.js b/mode/stylus/stylus.js
index dbe241d613..653958e83b 100644
--- a/mode/stylus/stylus.js
+++ b/mode/stylus/stylus.js
@@ -76,7 +76,7 @@
if (ch == "#") {
stream.next();
// Hex color
- if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b/i)) {
+ if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b(?!-)/i)) {
return ["atom", "atom"];
}
// ID selector
From ba5452fd668c97da00a3201c98e9cc4ca811c1cd Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 3 Feb 2020 11:07:49 +0100
Subject: [PATCH 003/581] Fix missing clipPos calls in file drop code
Closes #6127
---
src/edit/drop_events.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/edit/drop_events.js b/src/edit/drop_events.js
index c6fbbbc186..8073c50751 100644
--- a/src/edit/drop_events.js
+++ b/src/edit/drop_events.js
@@ -38,7 +38,7 @@ export function onDrop(e) {
text.filter(t => t != null).join(cm.doc.lineSeparator())),
origin: "paste"}
makeChange(cm.doc, change)
- setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)))
+ setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))))
})()
}
}
From 1fed46d79957d9249527d878b7b705c36ba5dfb7 Mon Sep 17 00:00:00 2001
From: Teja
Date: Tue, 4 Feb 2020 21:20:19 +0530
Subject: [PATCH 004/581] [lint addon] Allow appending the tooltip to the
wrapper element
The tooltip in the existing way append to the body.
When applied the codemirror context inside a shadow root (custom
element) this calls append the tooltip out of the root components.
Thus, the user has to monkey patch the appendchild method to override
the behavior.
This change would allow the tooltip to render in its own context with
the `selfContain` option.
---
addon/lint/lint.js | 5 ++++-
doc/manual.html | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/addon/lint/lint.js b/addon/lint/lint.js
index 0eac8d12a1..f36a232978 100644
--- a/addon/lint/lint.js
+++ b/addon/lint/lint.js
@@ -16,7 +16,10 @@
var tt = document.createElement("div");
tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
tt.appendChild(content.cloneNode(true));
- document.body.appendChild(tt);
+ if(cm.options.lint.selfContain)
+ cm.getWrapperElement().appendChild(tt);
+ else
+ document.body.appendChild(tt);
function position(e) {
if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
diff --git a/doc/manual.html b/doc/manual.html
index e943ce63b2..7030b7914d 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -2911,6 +2911,7 @@
Addons
will only be executed when the promise resolves.
By default, the linter will run (debounced) whenever the document is changed.
You can pass a lintOnChange: false option to disable that.
+ You can pass a selfContain: true option to render the tooltip inside the editor instance.
Depends on addon/lint/lint.css. A demo can be
found here.
From 83978294fb8926aa923e77b696bf9ed5a03b5df4 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 4 Feb 2020 23:11:58 +0100
Subject: [PATCH 005/581] Fix previous patch to get option from the parsed
option object
Issue #6135
---
addon/lint/lint.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addon/lint/lint.js b/addon/lint/lint.js
index f36a232978..5bc1af18ae 100644
--- a/addon/lint/lint.js
+++ b/addon/lint/lint.js
@@ -16,7 +16,7 @@
var tt = document.createElement("div");
tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
tt.appendChild(content.cloneNode(true));
- if(cm.options.lint.selfContain)
+ if (cm.state.lint.options.selfContain)
cm.getWrapperElement().appendChild(tt);
else
document.body.appendChild(tt);
From 0f94af71bbcc8ef2d4318b71127f4cf4beaa2179 Mon Sep 17 00:00:00 2001
From: Axel Lewenhaupt
Date: Wed, 5 Feb 2020 21:45:33 +0100
Subject: [PATCH 006/581] [soy mode] Remove templates property from state
---
mode/soy/soy.js | 3 ---
1 file changed, 3 deletions(-)
diff --git a/mode/soy/soy.js b/mode/soy/soy.js
index fc280c77db..f7f85783c3 100644
--- a/mode/soy/soy.js
+++ b/mode/soy/soy.js
@@ -129,7 +129,6 @@
startState: function() {
return {
soyState: [],
- templates: null,
variables: prepend(null, 'ij'),
scopes: null,
indent: 0,
@@ -146,7 +145,6 @@
return {
tag: state.tag, // Last seen Soy tag.
soyState: state.soyState.concat([]),
- templates: state.templates,
variables: state.variables,
context: state.context,
indent: state.indent, // Indentation of the following line.
@@ -202,7 +200,6 @@
switch (last(state.soyState)) {
case "templ-def":
if (match = stream.match(/^\.?([\w]+(?!\.[\w]+)*)/)) {
- state.templates = prepend(state.templates, match[1]);
state.soyState.pop();
return "def";
}
From e1a3c397516947748fb662720305bf314e8d4c4c Mon Sep 17 00:00:00 2001
From: Axel Lewenhaupt
Date: Thu, 6 Feb 2020 07:22:11 +0100
Subject: [PATCH 007/581] Fix driver from only running vim tests.
---
test/driver.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/test/driver.js b/test/driver.js
index 22de01e33a..8789f73be9 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -11,8 +11,6 @@ function indexOf(collection, elt) {
}
function test(name, run, expectedFail) {
- if (!/^vim/.test(name)) return
- console.log(name)
// Force unique names
var originalName = name;
var i = 2; // Second function would be NAME_2
From 5f722737883bbeadb2a629857d3961490e4134ca Mon Sep 17 00:00:00 2001
From: Axel Lewenhaupt
Date: Thu, 6 Feb 2020 07:40:08 +0100
Subject: [PATCH 008/581] Improve time complexity.
---
test/driver.js | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/test/driver.js b/test/driver.js
index 8789f73be9..bc1634eaae 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -1,4 +1,4 @@
-var tests = [], filters = [], allNames = [];
+var tests = [], filters = [], nameCounts = {};
function Failure(why) {this.message = why;}
Failure.prototype.toString = function() { return this.message; };
@@ -12,13 +12,12 @@ function indexOf(collection, elt) {
function test(name, run, expectedFail) {
// Force unique names
- var originalName = name;
- var i = 2; // Second function would be NAME_2
- while (indexOf(allNames, name) !== -1){
- name = originalName + "_" + i;
- i++;
+ if (nameCounts[name] == undefined){
+ nameCounts[name] = 2;
+ } else {
+ // Append number if not first test with this name.
+ name = name + '_' + (nameCounts[name]++);
}
- allNames.push(name);
// Add test
tests.push({name: name, func: run, expectedFail: expectedFail});
return name;
From 72988bf3fc4682165b149f691d3465bf140af750 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Fri, 7 Feb 2020 20:15:25 +0100
Subject: [PATCH 009/581] Clip negative scroll-to coordinates
Closes #6139
---
src/display/scrolling.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/display/scrolling.js b/src/display/scrolling.js
index 26ec993b0f..6d97247d92 100644
--- a/src/display/scrolling.js
+++ b/src/display/scrolling.js
@@ -165,7 +165,7 @@ export function updateScrollTop(cm, val) {
}
export function setScrollTop(cm, val, forceScroll) {
- val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val)
+ val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val))
if (cm.display.scroller.scrollTop == val && !forceScroll) return
cm.doc.scrollTop = val
cm.display.scrollbars.setScrollTop(val)
@@ -175,7 +175,7 @@ export function setScrollTop(cm, val, forceScroll) {
// Sync scroller and scrollbar, ensure the gutter elements are
// aligned.
export function setScrollLeft(cm, val, isScroller, forceScroll) {
- val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)
+ val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth))
if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) return
cm.doc.scrollLeft = val
alignHorizontally(cm)
From dbd0782326ebea9e7d9b9796ff3643b5767becee Mon Sep 17 00:00:00 2001
From: Axel Lewenhaupt
Date: Sun, 9 Feb 2020 21:50:50 +0100
Subject: [PATCH 010/581] [Soy] Improve map, list, record and list
comprehension highlighting
* Add support for map, list and record types.
* Add support for list, record and map literals.
* Add support for list comprehension.
* Better variable matching in list comprehension.
---
mode/soy/soy.js | 167 +++++++++++++++++++++++++++++++++++++++--------
mode/soy/test.js | 42 ++++++++++--
2 files changed, 177 insertions(+), 32 deletions(-)
diff --git a/mode/soy/soy.js b/mode/soy/soy.js
index f7f85783c3..fdd70375c5 100644
--- a/mode/soy/soy.js
+++ b/mode/soy/soy.js
@@ -125,6 +125,44 @@
this.scope = scope;
}
+ function expression(stream, state) {
+ let match;
+ if (stream.match(/[[]/)) {
+ state.soyState.push("list-literal");
+ state.lookupVariables = false;
+ return null;
+ } else if (stream.match(/map\b/)) {
+ state.soyState.push("map-literal");
+ return "keyword";
+ } else if (stream.match(/record\b/)) {
+ state.soyState.push("record-literal");
+ return "keyword";
+ } else if (stream.match(/([\w]+)(?=\()/)) {
+ return "variable callee";
+ } else if (match = stream.match(/^["']/)) {
+ state.soyState.push("string");
+ state.quoteKind = match[0];
+ return "string";
+ } else if (stream.match(/^[(]/)) {
+ state.soyState.push("open-parentheses");
+ return null;
+ } else if (stream.match(/(null|true|false)(?!\w)/) ||
+ stream.match(/0x([0-9a-fA-F]{2,})/) ||
+ stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) {
+ return "atom";
+ } else if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) {
+ // Tokenize filter, binary, null propagator, and equality operators.
+ return "operator";
+ } else if (match = stream.match(/^\$([\w]+)/)) {
+ return ref(state.variables, match[1], !state.lookupVariables);
+ } else if (match = stream.match(/^\w+/)) {
+ return /^(?:as|and|or|not|in|if)$/.test(match[0]) ? "keyword" : null;
+ }
+
+ stream.next();
+ return null;
+ }
+
return {
startState: function() {
return {
@@ -134,6 +172,7 @@
indent: 0,
quoteKind: null,
context: null,
+ lookupVariables: true, // Is unknown variables considered an error
localStates: [{
mode: modes.html,
state: CodeMirror.startState(modes.html)
@@ -149,6 +188,7 @@
context: state.context,
indent: state.indent, // Indentation of the following line.
quoteKind: state.quoteKind,
+ lookupVariables: state.lookupVariables,
localStates: state.localStates.map(function(localState) {
return {
mode: localState.mode,
@@ -245,18 +285,56 @@
stream.next();
return null;
+ case "open-parentheses":
+ if (stream.match(/[)]/)) {
+ state.soyState.pop();
+ return null;
+ }
+ return expression(stream, state);
+
case "param-type":
var peekChar = stream.peek();
- if (peekChar == "}" || peekChar == "=") {
+ if ("}]=>,".indexOf(peekChar) != -1) {
state.soyState.pop();
return null;
- }
- if (stream.eatWhile(/^([\w]+|[?])/)) {
+ } else if (peekChar == "[") {
+ state.soyState.push('param-type-record');
+ return null;
+ } else if (match = stream.match(/^([\w]+|[?])/)) {
+ if (match[0] == "map" || match[0] == "list") {
+ state.soyState.push('param-type-map-list');
+ }
return "type";
}
stream.next();
return null;
+ case "param-type-record":
+ var peekChar = stream.peek();
+ if (peekChar == "]") {
+ state.soyState.pop();
+ return null;
+ }
+ if (stream.match(/^\w+/)) {
+ state.soyState.push('param-type');
+ return "property";
+ }
+ stream.next();
+ return null;
+
+ case "param-type-map-list":
+ var peekChar = stream.peek();
+ if (stream.match(/^[>]/)) {
+ state.soyState.pop();
+ return null;
+ }
+ if (stream.match(/^[<,]/)) {
+ state.soyState.push('param-type');
+ return null;
+ }
+ stream.next();
+ return null;
+
case "var-def":
if (match = stream.match(/^\$([\w]+)/)) {
state.variables = prepend(state.variables, match[1]);
@@ -266,6 +344,65 @@
stream.next();
return null;
+ case "record-literal":
+ if (stream.match(/^[)]/)) {
+ state.soyState.pop();
+ return null;
+ }
+ if (stream.match(/[(,]/)) {
+ state.soyState.push("map-value")
+ state.soyState.push("record-key")
+ return null;
+ }
+ stream.next()
+ return null;
+
+ case "map-literal":
+ if (stream.match(/^[)]/)) {
+ state.soyState.pop();
+ return null;
+ }
+ if (stream.match(/[(,]/)) {
+ state.soyState.push("map-value")
+ state.soyState.push("map-value")
+ return null;
+ }
+ stream.next()
+ return null;
+
+ case "list-literal":
+ if (stream.match(/\]/)) {
+ state.soyState.pop();
+ state.lookupVariables = true;
+ return null;
+ }
+ if (stream.match(/for\b/)) {
+ state.soyState.push("var-def")
+ return "keyword";
+ } else if (stream.match(/in\b/)) {
+ state.lookupVariables = true;
+ return "keyword";
+ }
+ return expression(stream, state);
+
+ case "record-key":
+ if (stream.match(/[\w]+/)) {
+ return "property";
+ }
+ if (stream.match(/^[:]/)) {
+ state.soyState.pop();
+ return null;
+ }
+ stream.next();
+ return null;
+
+ case "map-value":
+ if (stream.peek() == ")" || stream.peek() == "," || stream.match(/^[:)]/)) {
+ state.soyState.pop();
+ return null;
+ }
+ return expression(stream, state);
+
case "tag":
var endTag = state.tag[0] == "/";
var tagName = endTag ? state.tag.substring(1) : state.tag;
@@ -299,30 +436,8 @@
});
}
return "attribute";
- } else if (match = stream.match(/([\w]+)(?=\()/)) {
- return "variable callee";
- } else if (match = stream.match(/^["']/)) {
- state.soyState.push("string");
- state.quoteKind = match;
- return "string";
}
- if (stream.match(/(null|true|false)(?!\w)/) ||
- stream.match(/0x([0-9a-fA-F]{2,})/) ||
- stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) {
- return "atom";
- }
- if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) {
- // Tokenize filter, binary, null propagator, and equality operators.
- return "operator";
- }
- if (match = stream.match(/^\$([\w]+)/)) {
- return ref(state.variables, match[1]);
- }
- if (match = stream.match(/^\w+/)) {
- return /^(?:as|and|or|not|in)$/.test(match[0]) ? "keyword" : null;
- }
- stream.next();
- return null;
+ return expression(stream, state);
case "literal":
if (stream.match(/^(?=\{\/literal})/)) {
diff --git a/mode/soy/test.js b/mode/soy/test.js
index 8234813f03..0326913ffe 100644
--- a/mode/soy/test.js
+++ b/mode/soy/test.js
@@ -63,13 +63,27 @@
'[keyword {] [atom 0x1F] [keyword }]',
'[keyword {] [atom 0x1F00BBEA] [keyword }]');
- MT('param-type-test',
+ MT('param-type-record',
+ '[keyword {@param] [def record]: [[[property foo]: [type bool], [property bar]: [type int] ]][keyword }]',
+ );
+
+ MT('param-type-map',
+ '[keyword {@param] [def unknown]: [type map]<[type string], [type bool]>[keyword }]',
+ );
+
+ MT('param-type-list',
+ '[keyword {@param] [def list]: [type list]<[type ?]>[keyword }]'
+ );
+
+ MT('param-type-any',
+ '[keyword {@param] [def unknown]: [type ?][keyword }]',
+ );
+
+ MT('param-type-nested',
'[keyword {@param] [def a]: ' +
- '[type list]<[[[type a]: [type int], ' +
- '[type b]: [type map]<[type string], ' +
- '[type bool]>]]>][keyword }]',
- '[keyword {@param] [def unknown]: [type ?][keyword }]',
- '[keyword {@param] [def list]: [type list]<[type ?]>[keyword }]');
+ '[type list]<[[[property a]: [type int], ' +
+ '[property b]: [type map]<[type string], ' +
+ '[type bool]>]]>][keyword }]',);
MT('undefined-var',
'[keyword {][variable-2&error $var]');
@@ -218,8 +232,24 @@
'[keyword {lb}]',
'[keyword {rb}]');
+ MT('let-list-literal',
+ '[keyword {let] [def $test]: [[[[[string \'a\'] ], [[[string \'b\'] ] ] [keyword /}]');
+
+ MT('let-record-literal',
+ '[keyword {let] [def $test]: [keyword record]([property test]: [callee&variable bidiGlobalDir](), ' +
+ '[property foo]: [atom 5]) [keyword /}]');
+
+ MT('let-map-literal',
+ '[keyword {let] [def $test]: [keyword map]([string \'outer\']: [keyword map]([atom 5]: [atom false]), ' +
+ '[string \'foo\']: [string \'bar\']) [keyword /}]');
+
MT('wrong-closing-tag',
'[keyword {if] [atom true][keyword }]',
' Optional',
'[keyword&error {/badend][keyword }]');
+
+ MT('list-comprehension',
+ '[keyword {let] [def $myList]: [[[[[string \'a\'] ] ] [keyword /}] ' +
+ '[keyword {let] [def $test]: [[[variable $a] [operator +] [atom 1] [keyword for] ' +
+ '[def $a] [keyword in] [variable-2 $myList] [keyword if] [variable-2 $a] [operator >=] [atom 3] ] [keyword /}]');
})();
From aa05cca0c5ece7a3ee171ed389a46c79d00fdb88 Mon Sep 17 00:00:00 2001
From: "vamshi.revu"
Date: Tue, 11 Feb 2020 18:09:25 +0530
Subject: [PATCH 011/581] [tern addon] Allow appending the tooltip to the
codemirror hint options container if exists
The current implementation of tern.js is appending the tooltip to the body.
When applied the codemirror context inside a shadow root, tooltips are falling out of the root component.
This change would append the tooltip to the container of codemirror hint options if it has else it will default to document.body
---
addon/tern/tern.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/addon/tern/tern.js b/addon/tern/tern.js
index 253309d678..7be368188b 100644
--- a/addon/tern/tern.js
+++ b/addon/tern/tern.js
@@ -231,7 +231,7 @@
var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc;
if (content) {
tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset,
- node.getBoundingClientRect().top + window.pageYOffset, content);
+ node.getBoundingClientRect().top + window.pageYOffset, content, cm);
tooltip.className += " " + cls + "hint-doc";
}
});
@@ -334,7 +334,7 @@
tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")"));
if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype));
var place = cm.cursorCoords(null, "page");
- var tooltip = ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip)
+ var tooltip = ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip, cm)
setTimeout(function() {
tooltip.clear = onEditorActivity(cm, function() {
if (ts.activeArgHints == tooltip) closeArgHints(ts) })
@@ -601,7 +601,7 @@
function tempTooltip(cm, content, ts) {
if (cm.state.ternTooltip) remove(cm.state.ternTooltip);
var where = cm.cursorCoords();
- var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content);
+ var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content, cm);
function maybeClear() {
old = true;
if (!mouseOnTip) clear();
@@ -637,11 +637,12 @@
}
}
- function makeTooltip(x, y, content) {
+ function makeTooltip(x, y, content, cm) {
var node = elt("div", cls + "tooltip", content);
node.style.left = x + "px";
node.style.top = y + "px";
- document.body.appendChild(node);
+ var container = ((cm.options || {}).hintOptions || {}).container || document.body;
+ container.appendChild(node);
return node;
}
From 2f51b60003c17d55af03390b4ce49ee8600ddfc6 Mon Sep 17 00:00:00 2001
From: Jay Contonio
Date: Tue, 11 Feb 2020 08:09:59 -0800
Subject: [PATCH 012/581] Fixing blockquote end check
---
addon/edit/continuelist.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/addon/edit/continuelist.js b/addon/edit/continuelist.js
index fb5f03735d..2e5625adc4 100644
--- a/addon/edit/continuelist.js
+++ b/addon/edit/continuelist.js
@@ -41,7 +41,9 @@
return;
}
if (emptyListRE.test(line)) {
- if (!/>\s*$/.test(line)) cm.replaceRange("", {
+ var endOfQuote = inQuote && />\s*$/.test(line)
+ var endOfList = !/>\s*$/.test(line)
+ if (endOfQuote || endOfList) cm.replaceRange("", {
line: pos.line, ch: 0
}, {
line: pos.line, ch: pos.ch + 1
From 36f13482c58c81dc1669583696c10cebf5c53a2d Mon Sep 17 00:00:00 2001
From: rvalavicius
Date: Tue, 18 Feb 2020 18:01:33 +0200
Subject: [PATCH 013/581] [sTeX mode] Ensured that tag does not clash with
object prototype properties
---
mode/stex/stex.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/stex/stex.js b/mode/stex/stex.js
index 140e5a8af9..20c3bc7a18 100644
--- a/mode/stex/stex.js
+++ b/mode/stex/stex.js
@@ -103,7 +103,7 @@
// Do we look like '\command' ? If so, attempt to apply the plugin 'command'
if (source.match(/^\\[a-zA-Z@]+/)) {
var cmdName = source.current().slice(1);
- plug = plugins[cmdName] || plugins["DEFAULT"];
+ plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
plug = new plug();
pushCommand(state, plug);
setState(state, beginParams);
From 1010810a581b1dd57fde947cc0b62495d7594c48 Mon Sep 17 00:00:00 2001
From: mtaran-google
Date: Tue, 18 Feb 2020 11:39:51 -0800
Subject: [PATCH 014/581] [verilog] Support folding by indentation
---
mode/verilog/verilog.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mode/verilog/verilog.js b/mode/verilog/verilog.js
index 2b6850659b..43990452d3 100644
--- a/mode/verilog/verilog.js
+++ b/mode/verilog/verilog.js
@@ -369,7 +369,8 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
blockCommentStart: "/*",
blockCommentEnd: "*/",
- lineComment: "//"
+ lineComment: "//",
+ fold: "indent"
};
});
From 563061792af93d35b770a8680339126aa00235aa Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 20 Feb 2020 11:12:29 +0100
Subject: [PATCH 015/581] Mark version 5.52.0
---
AUTHORS | 4 ++++
CHANGELOG.md | 14 ++++++++++++++
doc/manual.html | 2 +-
doc/releases.html | 9 +++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 77952afc2b..3fdc7869c7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -196,6 +196,7 @@ David Barnett
David H. Bronke
David Mignot
David Pathakjee
+David Rodrigues
David Santana
David Vázquez
David Whittington
@@ -443,6 +444,7 @@ koops
Kris Ciccarello
ks-ifware
kubelsmieci
+kvncp
KwanEsq
Kyle Kelley
KyleMcNutt
@@ -684,6 +686,7 @@ Robert Martin
Roberto Abdelkader Martínez Pérez
robertop23
Robert Plummer
+Roman Janusz
Rrandom
Rrrandom
Ruslan Osmanov
@@ -765,6 +768,7 @@ Takuya Matsuyama
Tarmil
T. Brandon Ashley
TDaglis
+Teja
tel
Tentone
tfjgeorge
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e8086926f8..33bca5cd27 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,17 @@
+## 5.52.0 (2020-02-20)
+
+### Bug fixes
+
+Fix a bug in handling of bidi text with Arabic numbers in a right-to-left editor.
+
+Fix a crash when combining file drop with a `"beforeChange"` filter.
+
+Prevent issue when passing negative coordinates to `scrollTo`.
+
+### New features
+
+[lint](https://codemirror.net/doc/manual.html#addon_lint) and [tern](https://codemirror.net/demo/tern.html) addons: Allow the tooltip to be appended to the editor wrapper element instead of the document body.
+
## 5.51.0 (2020-01-20)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 7030b7914d..7aab576141 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -69,7 +69,7 @@
User manual and reference guide
- version 5.51.0
+ version 5.52.0
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index dd0f483756..0768d49a9f 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,15 @@
User manual and reference guide
- version 5.52.0
+ version 5.52.2
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 0768d49a9f..cde1015d39 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,16 @@
Defines a CodeMirror.requireMode(modename,
- callback) function that will try to load a given mode and
- call the callback when it succeeded. You'll have to
- set CodeMirror.modeURL to a string that mode paths
- can be constructed from, for
- example "mode/%N/%N.js"—the %N's will
- be replaced with the mode name. Also
+
Defines a CodeMirror.requireMode(modename, callback,
+ options) function that will try to load a given mode and
+ call the callback when it succeeded. options is an
+ optional object that may contain:
+
+
path: fn(modeName: string) → string
+
Defines the way mode names are mapped to paths.
+
loadMode: fn(path: string, cont: fn())
+
Override the way the mode script is loaded. By default,
+ this will use the CommonJS or AMD module loader if one is
+ present, and fall back to creating
+ a <script> tag otherwise.
+
+ Enter your xml here and press the button below to display
+ it as highlighted by the CodeMirror XML mode
+
+
+
+
+
+
+
+
Running a CodeMirror mode outside of the editor.
+ The CodeMirror.runMode function, defined
+ in addon/runmode/runmode.js takes the following arguments:
If this is a function, it will be called for each token with
+ two arguments, the token's text and the token's style class (may
+ be null for unstyled tokens). If it is a DOM node,
+ the tokens will be converted to span elements as in
+ an editor, and inserted into the node
+ (through innerHTML).
+
+
+
diff --git a/package.json b/package.json
index 7956d37b97..f784cea808 100644
--- a/package.json
+++ b/package.json
@@ -21,11 +21,11 @@
"lint": "bin/lint"
},
"devDependencies": {
+ "@rollup/plugin-buble": "^0.21.3",
"blint": "^1.1.0",
"node-static": "0.7.11",
"puppeteer": "^1.20.0",
- "rollup": "^1.26.3",
- "rollup-plugin-buble": "^0.19.8"
+ "rollup": "^1.26.3"
},
"bugs": "http://github.com/codemirror/CodeMirror/issues",
"keywords": [
@@ -42,5 +42,6 @@
"directories": {},
"dependencies": {},
"devDependencies": {}
- }
+ },
+ "dependencies": {}
}
diff --git a/rollup.config.js b/rollup.config.js
index fbb4357175..88c94411f8 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -1,20 +1,42 @@
-import buble from 'rollup-plugin-buble';
+import buble from '@rollup/plugin-buble';
-export default {
- input: "src/codemirror.js",
- output: {
- banner: `// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: https://codemirror.net/LICENSE
+export default [
+ {
+ input: "src/codemirror.js",
+ output: {
+ banner: `// CodeMirror, copyright (c) by Marijn Haverbeke and others
+ // Distributed under an MIT license: https://codemirror.net/LICENSE
-// This is CodeMirror (https://codemirror.net), a code editor
-// implemented in JavaScript on top of the browser's DOM.
-//
-// You can find some technical background for some of the code below
-// at http://marijnhaverbeke.nl/blog/#cm-internals .
-`,
- format: "umd",
- file: "lib/codemirror.js",
- name: "CodeMirror"
+ // This is CodeMirror (https://codemirror.net), a code editor
+ // implemented in JavaScript on top of the browser's DOM.
+ //
+ // You can find some technical background for some of the code below
+ // at http://marijnhaverbeke.nl/blog/#cm-internals .
+ `,
+ format: "umd",
+ file: "lib/codemirror.js",
+ name: "CodeMirror"
+ },
+ plugins: [ buble({namedFunctionExpressions: false}) ]
},
- plugins: [ buble({namedFunctionExpressions: false}) ]
-};
+ {
+ input: ["src/addon/runmode/runmode-standalone.js"],
+ output: {
+ format: "iife",
+ file: "addon/runmode/runmode-standalone.js",
+ name: "CodeMirror",
+ freeze: false, // IE8 doesn't support Object.freeze.
+ },
+ plugins: [ buble({namedFunctionExpressions: false}) ]
+ },
+ {
+ input: ["src/addon/runmode/runmode.node.js"],
+ output: {
+ format: "cjs",
+ file: "addon/runmode/runmode.node.js",
+ name: "CodeMirror",
+ freeze: false, // IE8 doesn't support Object.freeze.
+ },
+ plugins: [ buble({namedFunctionExpressions: false}) ]
+ },
+];
diff --git a/src/addon/runmode/codemirror-standalone.js b/src/addon/runmode/codemirror-standalone.js
new file mode 100644
index 0000000000..bb246c9b9f
--- /dev/null
+++ b/src/addon/runmode/codemirror-standalone.js
@@ -0,0 +1,20 @@
+import StringStream from "../../util/StringStream.js"
+import * as modeMethods from "../../modes.js"
+
+// Create a minimal CodeMirror needed to use runMode, and assign to root.
+var root = typeof globalThis !== 'undefined' ? globalThis : window
+root.CodeMirror = {}
+
+// Copy StringStream and mode methods into CodeMirror object.
+CodeMirror.StringStream = StringStream
+for (var exported in modeMethods) CodeMirror[exported] = modeMethods[exported]
+
+// Minimal default mode.
+CodeMirror.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
+CodeMirror.defineMIME("text/plain", "null")
+
+CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min
+CodeMirror.splitLines = function(string) { return string.split(/\r?\n|\r/); }
+
+CodeMirror.defaults = { indentUnit: 2 }
+export default CodeMirror;
\ No newline at end of file
diff --git a/src/addon/runmode/codemirror.node.js b/src/addon/runmode/codemirror.node.js
new file mode 100644
index 0000000000..11a142eee0
--- /dev/null
+++ b/src/addon/runmode/codemirror.node.js
@@ -0,0 +1,19 @@
+import StringStream from "../../util/StringStream.js"
+import * as modeMethods from "../../modes.js"
+
+// Copy StringStream and mode methods into exports (CodeMirror) object.
+exports.StringStream = StringStream
+for (var exported in modeMethods) exports[exported] = modeMethods[exported]
+
+// Shim library CodeMirror with the minimal CodeMirror defined above.
+require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")]
+require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")]
+
+// Minimal default mode.
+exports.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
+exports.defineMIME("text/plain", "null")
+
+exports.registerHelper = exports.registerGlobalHelper = Math.min
+exports.splitLines = function(string) { return string.split(/\r?\n|\r/); }
+
+exports.defaults = { indentUnit: 2 }
\ No newline at end of file
diff --git a/src/addon/runmode/runmode-standalone.js b/src/addon/runmode/runmode-standalone.js
new file mode 100644
index 0000000000..0d7aa6bb2c
--- /dev/null
+++ b/src/addon/runmode/runmode-standalone.js
@@ -0,0 +1,2 @@
+import "./codemirror-standalone.js"
+import "../../../addon/runmode/runmode.js"
\ No newline at end of file
diff --git a/src/addon/runmode/runmode.node.js b/src/addon/runmode/runmode.node.js
new file mode 100644
index 0000000000..4f2ed817f8
--- /dev/null
+++ b/src/addon/runmode/runmode.node.js
@@ -0,0 +1,2 @@
+import "./codemirror.node.js"
+import "../../../addon/runmode/runmode.js"
\ No newline at end of file
From f87e1181c092bd01dc9acb9e91745fa97c9360e6 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 18 Jun 2020 15:07:36 +0200
Subject: [PATCH 100/581] [runmode.node addon] Export countColumn again
---
src/addon/runmode/codemirror.node.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/addon/runmode/codemirror.node.js b/src/addon/runmode/codemirror.node.js
index 11a142eee0..f3b5fa6e0e 100644
--- a/src/addon/runmode/codemirror.node.js
+++ b/src/addon/runmode/codemirror.node.js
@@ -1,8 +1,10 @@
import StringStream from "../../util/StringStream.js"
import * as modeMethods from "../../modes.js"
+import {countColumn} from "../../util/misc.js"
// Copy StringStream and mode methods into exports (CodeMirror) object.
exports.StringStream = StringStream
+exports.countColumn = countColumn
for (var exported in modeMethods) exports[exported] = modeMethods[exported]
// Shim library CodeMirror with the minimal CodeMirror defined above.
@@ -16,4 +18,4 @@ exports.defineMIME("text/plain", "null")
exports.registerHelper = exports.registerGlobalHelper = Math.min
exports.splitLines = function(string) { return string.split(/\r?\n|\r/); }
-exports.defaults = { indentUnit: 2 }
\ No newline at end of file
+exports.defaults = { indentUnit: 2 }
From 6bb912b3e2b518806c28a00082df0a60c062c1bb Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 18 Jun 2020 15:13:27 +0200
Subject: [PATCH 101/581] [runmode addon] Fix lint issues
---
rollup.config.js | 14 +++++++-------
src/addon/runmode/codemirror-standalone.js | 6 ++++--
src/addon/runmode/codemirror.node.js | 4 ++--
3 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/rollup.config.js b/rollup.config.js
index 88c94411f8..f50f62fae2 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -5,14 +5,14 @@ export default [
input: "src/codemirror.js",
output: {
banner: `// CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
+// Distributed under an MIT license: https://codemirror.net/LICENSE
- // This is CodeMirror (https://codemirror.net), a code editor
- // implemented in JavaScript on top of the browser's DOM.
- //
- // You can find some technical background for some of the code below
- // at http://marijnhaverbeke.nl/blog/#cm-internals .
- `,
+// This is CodeMirror (https://codemirror.net), a code editor
+// implemented in JavaScript on top of the browser's DOM.
+//
+// You can find some technical background for some of the code below
+// at http://marijnhaverbeke.nl/blog/#cm-internals .
+`,
format: "umd",
file: "lib/codemirror.js",
name: "CodeMirror"
diff --git a/src/addon/runmode/codemirror-standalone.js b/src/addon/runmode/codemirror-standalone.js
index bb246c9b9f..b463a5cf59 100644
--- a/src/addon/runmode/codemirror-standalone.js
+++ b/src/addon/runmode/codemirror-standalone.js
@@ -1,6 +1,8 @@
import StringStream from "../../util/StringStream.js"
import * as modeMethods from "../../modes.js"
+// declare global: globalThis, CodeMirror
+
// Create a minimal CodeMirror needed to use runMode, and assign to root.
var root = typeof globalThis !== 'undefined' ? globalThis : window
root.CodeMirror = {}
@@ -14,7 +16,7 @@ CodeMirror.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
CodeMirror.defineMIME("text/plain", "null")
CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min
-CodeMirror.splitLines = function(string) { return string.split(/\r?\n|\r/); }
+CodeMirror.splitLines = function(string) { return string.split(/\r?\n|\r/) }
CodeMirror.defaults = { indentUnit: 2 }
-export default CodeMirror;
\ No newline at end of file
+export default CodeMirror
diff --git a/src/addon/runmode/codemirror.node.js b/src/addon/runmode/codemirror.node.js
index f3b5fa6e0e..58efc5286b 100644
--- a/src/addon/runmode/codemirror.node.js
+++ b/src/addon/runmode/codemirror.node.js
@@ -7,7 +7,7 @@ exports.StringStream = StringStream
exports.countColumn = countColumn
for (var exported in modeMethods) exports[exported] = modeMethods[exported]
-// Shim library CodeMirror with the minimal CodeMirror defined above.
+// Shim library CodeMirror with the minimal CodeMirror defined above.
require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")]
require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")]
@@ -16,6 +16,6 @@ exports.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
exports.defineMIME("text/plain", "null")
exports.registerHelper = exports.registerGlobalHelper = Math.min
-exports.splitLines = function(string) { return string.split(/\r?\n|\r/); }
+exports.splitLines = function(string) { return string.split(/\r?\n|\r/) }
exports.defaults = { indentUnit: 2 }
From ddb3334726d8e265f4dec3d6b59baf8d9c9d0d75 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Sun, 21 Jun 2020 15:17:59 +0200
Subject: [PATCH 102/581] [closetag addon] Make whenClosing/whenOpening
properly default to true
Closes #6322
---
addon/edit/closetag.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addon/edit/closetag.js b/addon/edit/closetag.js
index b8cbf95089..8689765eec 100644
--- a/addon/edit/closetag.js
+++ b/addon/edit/closetag.js
@@ -40,9 +40,9 @@
cm.removeKeyMap("autoCloseTags");
if (!val) return;
var map = {name: "autoCloseTags"};
- if (typeof val != "object" || val.whenClosing)
+ if (typeof val != "object" || val.whenClosing !== false)
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
- if (typeof val != "object" || val.whenOpening)
+ if (typeof val != "object" || val.whenOpening !== false)
map["'>'"] = function(cm) { return autoCloseGT(cm); };
cm.addKeyMap(map);
});
From 41077c866c65c9c905f662306a67d54a7cf56d85 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Sun, 21 Jun 2020 15:40:04 +0200
Subject: [PATCH 103/581] Mark version 5.55.0
---
AUTHORS | 4 ++++
CHANGELOG.md | 20 ++++++++++++++++++++
doc/manual.html | 2 +-
doc/releases.html | 13 +++++++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index f5b5d7a6b6..f041a0572a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -235,6 +235,7 @@ Dror BG
Duncan Lilley
duralog
dwelle
+Ealton
eborden
edoroshenko
edsharp
@@ -347,6 +348,7 @@ Ingo Richter
Irakli Gozalishvili
Ivan Kurnosov
Ivoah
+Jack Douglas
Jacob Lee
Jaimin
Jake Peyser
@@ -756,6 +758,7 @@ Shiv Deepak
Shmuel Englard
Shubham Jain
Siamak Mokhtari
+Siddhartha Gunti
silverwind
Simon Edwards
sinkuu
@@ -870,6 +873,7 @@ Yuvi Panda
Yvonnick Esnault
Zac Anger
Zachary Dremann
+ZeeshanNoor
Zeno Rocha
Zhang Hao
Ziv
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a445dd913a..b87340b524 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,23 @@
+## 5.55.0 (2020-05-20)
+
+### Bug fixes
+
+The editor no longer overrides the rendering of zero-width joiners (allowing combined emoji to be shown).
+
+[vim bindings](https://codemirror.net/demo/vim.html): Fix an issue where the `vim-mode-change` event was fired twice.
+
+[javascript mode](https://codemirror.net/mode/javascript/): Only allow `-->`-style comments at the start of a line.
+
+[julia mode](https://codemirror.net/mode/julia/): Improve indentation.
+
+[pascal mode](https://codemirror.net/mode/pascal/index.html): Recognize curly bracket comments.
+
+[runmode addon](https://codemirror.net/doc/manual.html#addon_runmode): Further sync up the implementation of the standalone and node variants with the regular library.
+
+### New features
+
+[loadmode addon](https://codemirror.net/doc/manual.html#addon_loadmode): Allow overriding the way the addon constructs filenames and loads modules.
+
## 5.54.0 (2020-05-20)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index e85ec25b66..8f42eeff60 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -69,7 +69,7 @@
User manual and reference guide
- version 5.54.0
+ version 5.55.0
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 75384de760..fd02a7fbd9 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,19 @@
VIM mode signals a few events on the editor instance. For an example usage, see demo/vim.html#L101.
+
+
+
"vim-command-done" (reason: undefined)
+
Fired on keypress and mousedown where command has completed or no command found.
+
+
"vim-keypress" (vimKey: string)
+
Fired on keypress, vimKey is in Vim's key notation.
+
+
"vim-mode-change" (modeObj: object)
+
Fired after mode change, modeObj parameter is a {mode: string, ?subMode: string} object. Modes: "insert", "normal", "replace", "visual". Visual sub-modes: "linewise", "blockwise".
+
+
Extending VIM
CodeMirror's VIM mode implements a large subset of VIM's core
From b5ce22f1e350431adaefbad40cbfc54dbfdb1c77 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Wed, 8 Jul 2020 08:35:24 +0200
Subject: [PATCH 112/581] Fix line-wise pasting on Chrome Windows
Closes #6337
---
src/input/input.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/input/input.js b/src/input/input.js
index 8519ecfb7c..32adbf9b2a 100644
--- a/src/input/input.js
+++ b/src/input/input.js
@@ -51,7 +51,7 @@ export function applyTextInput(cm, inserted, deleted, sel, origin) {
from = Pos(from.line, from.ch - deleted)
else if (cm.state.overwrite && !paste) // Handle overwrite
to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length))
- else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == inserted)
+ else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
from = to = Pos(from.line, 0)
}
let changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
@@ -132,4 +132,4 @@ export function hiddenTextarea() {
if (ios) te.style.border = "1px solid black"
disableBrowserMagic(te)
return div
-}
\ No newline at end of file
+}
From 0682bcc8d5d5f03cebfbb9d14c3ffa7dcc3e0e6d Mon Sep 17 00:00:00 2001
From: Kaushik Kulkarni
Date: Thu, 2 Jul 2020 00:54:59 -0500
Subject: [PATCH 113/581] [hardwrap addon] introduce forceBreak
---
addon/wrap/hardwrap.js | 30 ++++++++++++++++++++++--------
doc/manual.html | 5 +++++
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/addon/wrap/hardwrap.js b/addon/wrap/hardwrap.js
index 29cc15f01f..2259e0e11e 100644
--- a/addon/wrap/hardwrap.js
+++ b/addon/wrap/hardwrap.js
@@ -29,11 +29,20 @@
return {from: start, to: end};
}
- function findBreakPoint(text, column, wrapOn, killTrailingSpace) {
+ function findBreakPoint(text, column, wrapOn, killTrailingSpace, forceBreak) {
var at = column
while (at < text.length && text.charAt(at) == " ") at++
for (; at > 0; --at)
if (wrapOn.test(text.slice(at - 1, at + 1))) break;
+
+ if ((at == 0) && (!forceBreak)) {
+ // didn't find a break point before column, in non-forceBreak mode try to
+ // find one after 'column'.
+ for (at = column+1; at < text.length-1; ++at) {
+ if (wrapOn.test(text.slice(at - 1, at + 1))) break;
+ }
+ }
+
for (var first = true;; first = false) {
var endOfText = at;
if (killTrailingSpace)
@@ -47,6 +56,7 @@
from = cm.clipPos(from); to = cm.clipPos(to);
var column = options.column || 80;
var wrapOn = options.wrapOn || /\s\S|-[^\.\d]/;
+ var forceBreak = options.forceBreak !== false;
var killTrailing = options.killTrailingSpace !== false;
var changes = [], curLine = "", curNo = from.line;
var lines = cm.getRange(from, to, false);
@@ -68,7 +78,7 @@
curLine += text;
if (i) {
var firstBreak = curLine.length > column && leadingSpace == spaceTrimmed &&
- findBreakPoint(curLine, column, wrapOn, killTrailing);
+ findBreakPoint(curLine, column, wrapOn, killTrailing, forceBreak);
// If this isn't broken, or is broken at a different point, remove old break
if (!firstBreak || firstBreak.from != oldLen || firstBreak.to != oldLen + spaceInserted) {
changes.push({text: [spaceInserted ? " " : ""],
@@ -80,12 +90,16 @@
}
}
while (curLine.length > column) {
- var bp = findBreakPoint(curLine, column, wrapOn, killTrailing);
- changes.push({text: ["", leadingSpace],
- from: Pos(curNo, bp.from),
- to: Pos(curNo, bp.to)});
- curLine = leadingSpace + curLine.slice(bp.to);
- ++curNo;
+ var bp = findBreakPoint(curLine, column, wrapOn, killTrailing, forceBreak);
+ if ((bp.from != bp.to) || (forceBreak)) {
+ changes.push({text: ["", leadingSpace],
+ from: Pos(curNo, bp.from),
+ to: Pos(curNo, bp.to)});
+ curLine = leadingSpace + curLine.slice(bp.to);
+ ++curNo;
+ } else {
+ break;
+ }
}
}
if (changes.length) cm.operation(function() {
diff --git a/doc/manual.html b/doc/manual.html
index e779008384..8008002a40 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -3135,6 +3135,11 @@
Addons
killTrailingSpace: boolean
Whether trailing space caused by wrapping should be
preserved, or deleted. Defaults to true.
+
forceBreak: boolean
+
If set to true forces a break at column in the case
+ when no wrapOn pattern is found in the range. If set to
+ false allows line to overflow the column limit if no
+ wrapOn pattern found. Defaults to true.
functionality. It does provide a rich API on top of which such
functionality can be straightforwardly implemented. See
the addons included in the distribution,
- and the list
- of externally hosted addons, for reusable
- implementations of extra features.
CodeMirror works with language-specific modes. Modes are
JavaScript programs that help color (and optionally indent) text
diff --git a/index.html b/index.html
index 520fce4ec2..27cf8fc7fe 100644
--- a/index.html
+++ b/index.html
@@ -171,11 +171,6 @@
Community
that explicit, we have
a code of
conduct that applies to communication around the project.
-
-
A list of CodeMirror-related software that is not part of the
- main distribution is maintained
- on our
- wiki. Feel free to add your project.
Like customKeys above, but the bindings will
be added to the set of default bindings, instead of replacing
them.
+
scrollMargin: integer
+
Show this many lines before and after the selected item.
+ Default is 0.
The following events will be fired on the completions object
during completion:
From 772d09e697612889ec5dbed2cc058e754232c29d Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 20 Jul 2020 22:28:58 +0200
Subject: [PATCH 121/581] Mark version 5.56.0
---
AUTHORS | 2 ++
CHANGELOG.md | 20 +++++++++++++++++++-
doc/manual.html | 2 +-
doc/releases.html | 12 ++++++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index f041a0572a..a9e79126b6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -441,6 +441,7 @@ jwallers@gmail.com
kaniga
karevn
Karol
+Kaushik Kulkarni
Kayur Patel
Kazuhito Hokamura
kcwiakala
@@ -657,6 +658,7 @@ Patrick Strawderman
Paul Garvin
Paul Ivanov
Paul Masson
+Paul Schmidt
Pavel
Pavel Feldman
Pavel Petržela
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b87340b524..13039b9701 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,22 @@
-## 5.55.0 (2020-05-20)
+## 5.56.0 (2020-07-20)
+
+### Bug fixes
+
+Line-wise pasting was fixed on Chrome Windows.
+
+[wast mode](https://codemirror.net/mode/wast/): Follow standard changes.
+
+[soy mode](https://codemirror.net/mode/soy/): Support import expressions, template type, and loop indices.
+
+[sql-hint addon](https://codemirror.net/doc/manual.html#addon_sql-hint): Improve handling of double quotes.
+
+### New features
+
+[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): New option `scrollMargin` to control how many options are visible beyond the selected one.
+
+[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): New option `forceBreak` to disable breaking of words that are longer than a line.
+
+## 5.55.0 (2020-06-21)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 1bcd395e63..ba46c099f0 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.55.0
+ version 5.56.0
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index fd02a7fbd9..6ab175a7b3 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,18 @@
- Get the current version: 5.55.0.
+ Get the current version: 5.56.0.
You can see the code,
read the release notes,
or study the user manual.
diff --git a/package.json b/package.json
index dcffa6d998..374bd877d2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codemirror",
- "version": "5.55.0",
+ "version": "5.56.0",
"main": "lib/codemirror.js",
"style": "lib/codemirror.css",
"author": {
diff --git a/src/edit/main.js b/src/edit/main.js
index 04efb81564..3b378e8f33 100644
--- a/src/edit/main.js
+++ b/src/edit/main.js
@@ -66,4 +66,4 @@ import { addLegacyProps } from "./legacy.js"
addLegacyProps(CodeMirror)
-CodeMirror.version = "5.55.0"
+CodeMirror.version = "5.56.0"
From fdbc04a94a3b0064b896effa6da6544f1c2bb39a Mon Sep 17 00:00:00 2001
From: Howard
Date: Thu, 23 Jul 2020 14:45:56 -0400
Subject: [PATCH 122/581] [vim bindings] Support tag text objects in xml /
htmlmixed mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
User can use `t` to operate on tag text objects. For example, given the
following html:
```
hello world!
```
If the user's cursor (denoted by █) is inside "hello world!":
```
hello█world!
```
And they enter `dit` (delete inner tag), then the text inside the
enclosing tag is deleted -- the following is the expected result:
```
```
If they enter `dat` (delete around tag), then the surrounding tags are
deleted as well:
```
```
This logic depends on the following:
- mode/xml/xml.js
- addon/fold/xml-fold.js
- editor is in htmlmixedmode / xml mode
Caveats
This is _NOT_ a 100% accurate implementation of vim tag text objects.
For example, the following cases noop / are inconsistent with vim
behavior:
- Does not work inside comments:
```
```
- Does not work when tags have different cases:
```
broken
```
- Does not work when inside a broken tag:
```
```
This addresses #3828.
---
keymap/vim.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
test/index.html | 1 +
test/vim_test.js | 30 ++++++++++++++++++++++++++++--
3 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/keymap/vim.js b/keymap/vim.js
index bca6d46d72..5a4860c65a 100644
--- a/keymap/vim.js
+++ b/keymap/vim.js
@@ -2069,6 +2069,8 @@
if (operatorArgs) { operatorArgs.linewise = true; }
tmp.end.line--;
}
+ } else if (character === 't') {
+ tmp = expandTagUnderCursor(cm, head, inclusive);
} else {
// No text object defined for this, don't move.
return null;
@@ -3295,6 +3297,49 @@
return { start: Pos(cur.line, start), end: Pos(cur.line, end) };
}
+ /**
+ * Depends on the following:
+ *
+ * - editor mode should be htmlmixedmode / xml
+ * - mode/xml/xml.js should be loaded
+ * - addon/fold/xml-fold.js should be loaded
+ *
+ * If any of the above requirements are not true, this function noops.
+ *
+ * This is _NOT_ a 100% accurate implementation of vim tag text objects.
+ * The following caveats apply (based off cursory testing, I'm sure there
+ * are other discrepancies):
+ *
+ * - Does not work inside comments:
+ * ```
+ *
+ * ```
+ * - Does not work when tags have different cases:
+ * ```
+ *
broken
+ * ```
+ * - Does not work when cursor is inside a broken tag:
+ * ```
+ *
+ * ```
+ */
+ function expandTagUnderCursor(cm, head, inclusive) {
+ var cur = head;
+ if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) {
+ return { start: cur, end: cur };
+ }
+
+ var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head);
+ if (!tags || !tags.open || !tags.close) {
+ return { start: cur, end: cur };
+ }
+
+ if (inclusive) {
+ return { start: tags.open.from, end: tags.close.to };
+ }
+ return { start: tags.open.to, end: tags.close.from };
+ }
+
function recordJumpPosition(cm, oldCur, newCur) {
if (!cursorEqual(oldCur, newCur)) {
vimGlobalState.jumpList.add(cm, oldCur, newCur);
@@ -3836,7 +3881,7 @@
return Pos(curr_index.ln, curr_index.pos);
}
- // TODO: perhaps this finagling of start and end positions belonds
+ // TODO: perhaps this finagling of start and end positions belongs
// in codemirror/replaceRange?
function selectCompanionObject(cm, head, symb, inclusive) {
var cur = head, start, end;
diff --git a/test/index.html b/test/index.html
index b68ce18964..6566fc436e 100644
--- a/test/index.html
+++ b/test/index.html
@@ -156,6 +156,7 @@
Defines an option `"scrollPastEnd"` that, when set to a
+ truthy value, allows the user to scroll one editor height of
+ empty space into view at the bottom of the editor.
Implements an interface for merging changes, using either a
2-way or a 3-way view. The CodeMirror.MergeView
From 50cd959fe7939eba01d4647d9081976f48df9bb7 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 13 Aug 2020 09:10:52 +0200
Subject: [PATCH 132/581] Add issue and pr templates that warn about common
problems
---
.github/ISSUE_TEMPLATE.md | 5 +++++
.github/PULL_REQUEST_TEMPLATE.md | 5 +++++
2 files changed, 10 insertions(+)
create mode 100644 .github/ISSUE_TEMPLATE.md
create mode 100644 .github/PULL_REQUEST_TEMPLATE.md
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000000..49e2dcb09d
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000000..ea7cbc75db
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,5 @@
+
From 83b9f82f411274407755f80f403a48448faf81d0 Mon Sep 17 00:00:00 2001
From: "Jan T. Sott"
Date: Fri, 14 Aug 2020 10:12:06 +0200
Subject: [PATCH 133/581] [nsis mode] Add NSIS 3.06 commands
---
mode/nsis/nsis.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/nsis/nsis.js b/mode/nsis/nsis.js
index 10816608c1..636940f502 100644
--- a/mode/nsis/nsis.js
+++ b/mode/nsis/nsis.js
@@ -31,7 +31,7 @@ CodeMirror.defineSimpleMode("nsis",{
{regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true},
// Runtime Commands
- {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
+ {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"},
{regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true},
{regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true},
From 55d04842e2abeeb305d722859cfb8ba18eadd47a Mon Sep 17 00:00:00 2001
From: tokafew420
Date: Tue, 18 Aug 2020 23:05:37 -0400
Subject: [PATCH 134/581] Annotate scrollbar when matches are folded
---
addon/scroll/annotatescrollbar.js | 12 ++++++-
test/annotatescrollbar.js | 55 +++++++++++++++++++++++++++++++
test/index.html | 2 ++
3 files changed, 68 insertions(+), 1 deletion(-)
create mode 100644 test/annotatescrollbar.js
diff --git a/addon/scroll/annotatescrollbar.js b/addon/scroll/annotatescrollbar.js
index 9fe61ec1ff..0eb9e84fa2 100644
--- a/addon/scroll/annotatescrollbar.js
+++ b/addon/scroll/annotatescrollbar.js
@@ -72,10 +72,20 @@
var wrapping = cm.getOption("lineWrapping");
var singleLineH = wrapping && cm.defaultTextHeight() * 1.5;
var curLine = null, curLineObj = null;
+
+ function getFoldLineHandle(pos) {
+ var marks = cm.findMarksAt(pos);
+ for (var i = 0; i < marks.length; ++i) {
+ if (marks[i].collapsed)
+ return marks[i].lines[0];
+ }
+ }
+
function getY(pos, top) {
if (curLine != pos.line) {
curLine = pos.line;
- curLineObj = cm.getLineHandle(curLine);
+ if(!(curLineObj = getFoldLineHandle(pos)))
+ curLineObj = cm.getLineHandle(curLine);
}
if ((curLineObj.widgets && curLineObj.widgets.length) ||
(wrapping && curLineObj.height > singleLineH))
diff --git a/test/annotatescrollbar.js b/test/annotatescrollbar.js
new file mode 100644
index 0000000000..4a4d05333c
--- /dev/null
+++ b/test/annotatescrollbar.js
@@ -0,0 +1,55 @@
+namespace = "annotatescrollbar_";
+
+(function () {
+ function test(name, run, content, query, expected) {
+ return testCM(name, function (cm) {
+ var annotation = cm.annotateScrollbar({
+ listenForChanges: false,
+ className: "CodeMirror-search-match"
+ });
+ var matches = [];
+ var cursor = cm.getSearchCursor(query, CodeMirror.Pos(0, 0));
+ while (cursor.findNext()) {
+ var match = {
+ from: cursor.from(),
+ to: cursor.to()
+ };
+ matches.push(match)
+ }
+
+ if (run) run(cm);
+
+ cm.display.barWidth = 5;
+ annotation.update(matches);
+
+ var annotations = cm.getWrapperElement().getElementsByClassName(annotation.options.className);
+ eq(annotations.length, expected, "Expected " + expected + " annotations on the scrollbar.")
+ }, {
+ value: content,
+ mode: "javascript",
+ foldOptions: {
+ rangeFinder: CodeMirror.fold.brace
+ }
+ });
+ }
+
+ function doFold(cm) {
+ cm.foldCode(cm.getCursor());
+ }
+ var simpleProg = "function foo() {\n\n return \"foo\";\n\n}\n\nfoo();\n";
+ var consecutiveLineMatches = "function foo() {\n return \"foo\";\n}\nfoo();\n";
+ var singleLineMatches = "function foo() { return \"foo\"; }foo();\n";
+
+ // Base case - expect 3 matches and 3 annotations
+ test("simple", null, simpleProg, "foo", 3);
+ // Consecutive line matches are combines into a single annotation - expect 3 matches and 2 annotations
+ test("combineConsecutiveLine", null, consecutiveLineMatches, "foo", 2);
+ // Matches on a single line get a single annotation - expect 3 matches and 1 annotation
+ test("combineSingleLine", null, singleLineMatches, "foo", 1);
+ // Matches within a fold are annotated on the folded line - expect 3 matches and 2 annotations
+ test("simpleFold", doFold, simpleProg, "foo", 2);
+ // Combination of combineConsecutiveLine and simpleFold cases - expect 3 matches and 1 annotation
+ test("foldedMatch", doFold, consecutiveLineMatches, "foo", 1);
+ // Hidden matches within a fold are annotated on the folded line - expect 1 match and 1 annotation
+ test("hiddenMatch", doFold, simpleProg, "return", 1);
+})();
\ No newline at end of file
diff --git a/test/index.html b/test/index.html
index 6566fc436e..3369beac1f 100644
--- a/test/index.html
+++ b/test/index.html
@@ -157,12 +157,14 @@
Test Suite
+
+
diff --git a/keymap/vim.js b/keymap/vim.js
index aca99cfbbe..789e1e55b3 100644
--- a/keymap/vim.js
+++ b/keymap/vim.js
@@ -141,6 +141,8 @@
{ keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true },
{ keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }},
{ keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }},
+ { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true }},
+ { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false }},
// Operator-Motion dual commands
{ keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }},
{ keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }},
@@ -1576,7 +1578,7 @@
motionArgs.repeat = repeat;
clearInputState(cm);
if (motion) {
- var motionResult = motions[motion](cm, origHead, motionArgs, vim);
+ var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState);
vim.lastMotion = motions[motion];
if (!motionResult) {
return;
@@ -1774,6 +1776,87 @@
highlightSearchMatches(cm, query);
return findNext(cm, prev/** prev */, query, motionArgs.repeat);
},
+ /**
+ * Find and select the next occurrence of the search query. If the cursor is currently
+ * within a match, then find and select the current match. Otherwise, find the next occurrence in the
+ * appropriate direction.
+ *
+ * This differs from `findNext` in the following ways:
+ *
+ * 1. Instead of only returning the "from", this returns a "from", "to" range.
+ * 2. If the cursor is currently inside a search match, this selects the current match
+ * instead of the next match.
+ * 3. If there is no associated operator, this will turn on visual mode.
+ */
+ findAndSelectNextInclusive: function(cm, _head, motionArgs, vim, prevInputState) {
+ var state = getSearchState(cm);
+ var query = state.getQuery();
+
+ if (!query) {
+ return;
+ }
+
+ var prev = !motionArgs.forward;
+ prev = (state.isReversed()) ? !prev : prev;
+
+ // next: [from, to] | null
+ var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim);
+
+ // No matches.
+ if (!next) {
+ return;
+ }
+
+ // If there's an operator that will be executed, return the selection.
+ if (prevInputState.operator) {
+ return next;
+ }
+
+ // At this point, we know that there is no accompanying operator -- let's
+ // deal with visual mode in order to select an appropriate match.
+
+ var from = next[0];
+ // For whatever reason, when we use the "to" as returned by searchcursor.js directly,
+ // the resulting selection is extended by 1 char. Let's shrink it so that only the
+ // match is selected.
+ var to = Pos(next[1].line, next[1].ch - 1);
+
+ if (vim.visualMode) {
+ // If we were in visualLine or visualBlock mode, get out of it.
+ if (vim.visualLine || vim.visualBlock) {
+ vim.visualLine = false;
+ vim.visualBlock = false;
+ CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""});
+ }
+
+ // If we're currently in visual mode, we should extend the selection to include
+ // the search result.
+ var anchor = vim.sel.anchor;
+ if (anchor) {
+ if (state.isReversed()) {
+ if (motionArgs.forward) {
+ return [anchor, from];
+ }
+
+ return [anchor, to];
+ } else {
+ if (motionArgs.forward) {
+ return [anchor, to];
+ }
+
+ return [anchor, from];
+ }
+ }
+ } else {
+ // Let's turn visual mode on.
+ vim.visualMode = true;
+ vim.visualLine = false;
+ vim.visualBlock = false;
+ CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""});
+ }
+
+ return prev ? [to, from] : [from, to];
+ },
goToMark: function(cm, _head, motionArgs, vim) {
var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter);
if (pos) {
@@ -1869,8 +1952,8 @@
// move to previous/next line is triggered.
if (line < first && cur.line == first){
return this.moveToStartOfLine(cm, head, motionArgs, vim);
- }else if (line > last && cur.line == last){
- return this.moveToEol(cm, head, motionArgs, vim, true);
+ } else if (line > last && cur.line == last){
+ return moveToEol(cm, head, motionArgs, vim, true);
}
if (motionArgs.toFirstChar){
endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
@@ -1972,16 +2055,8 @@
vim.lastHSPos = cm.charCoords(head,'div').left;
return moveToColumn(cm, repeat);
},
- moveToEol: function(cm, head, motionArgs, vim, keepHPos) {
- var cur = head;
- var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);
- var end=cm.clipPos(retval);
- end.ch--;
- if (!keepHPos) {
- vim.lastHPos = Infinity;
- vim.lastHSPos = cm.charCoords(end,'div').left;
- }
- return retval;
+ moveToEol: function(cm, head, motionArgs, vim) {
+ return moveToEol(cm, head, motionArgs, vim, false);
},
moveToFirstNonWhiteSpaceCharacter: function(cm, head) {
// Go to the start of the line where the text begins, or the end for
@@ -3609,6 +3684,18 @@
}
}
+ function moveToEol(cm, head, motionArgs, vim, keepHPos) {
+ var cur = head;
+ var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity);
+ var end=cm.clipPos(retval);
+ end.ch--;
+ if (!keepHPos) {
+ vim.lastHPos = Infinity;
+ vim.lastHSPos = cm.charCoords(end,'div').left;
+ }
+ return retval;
+ }
+
function moveToCharacter(cm, repeat, forward, character) {
var cur = cm.getCursor();
var start = cur.ch;
@@ -4350,6 +4437,42 @@
return cursor.from();
});
}
+ /**
+ * Pretty much the same as `findNext`, except for the following differences:
+ *
+ * 1. Before starting the search, move to the previous search. This way if our cursor is
+ * already inside a match, we should return the current match.
+ * 2. Rather than only returning the cursor's from, we return the cursor's from and to as a tuple.
+ */
+ function findNextFromAndToInclusive(cm, prev, query, repeat, vim) {
+ if (repeat === undefined) { repeat = 1; }
+ return cm.operation(function() {
+ var pos = cm.getCursor();
+ var cursor = cm.getSearchCursor(query, pos);
+
+ // Go back one result to ensure that if the cursor is currently a match, we keep it.
+ var found = cursor.find(!prev);
+
+ // If we haven't moved, go back one more (similar to if i==0 logic in findNext).
+ if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) {
+ cursor.find(!prev);
+ }
+
+ for (var i = 0; i < repeat; i++) {
+ found = cursor.find(prev);
+ if (!found) {
+ // SearchCursor may have returned null because it hit EOF, wrap
+ // around and try again.
+ cursor = cm.getSearchCursor(query,
+ (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) );
+ if (!cursor.find(prev)) {
+ return;
+ }
+ }
+ }
+ return [cursor.from(), cursor.to()];
+ });
+ }
function clearSearchHighlight(cm) {
var state = getSearchState(cm);
cm.removeOverlay(getSearchState(cm).getOverlay());
diff --git a/test/vim_test.js b/test/vim_test.js
index 9743041404..c75a1646cf 100644
--- a/test/vim_test.js
+++ b/test/vim_test.js
@@ -2579,6 +2579,91 @@ testVim('/ and n/N', function(cm, vim, helpers) {
helpers.doKeys('2', '/');
helpers.assertCursorAt(1, 6);
}, { value: 'match nope match \n nope Match' });
+testVim('/ and gn selects the appropriate word', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('/');
+ helpers.assertCursorAt(0, 11);
+
+ // gn should highlight the the current word while it is within a match.
+
+ // gn when cursor is in beginning of match
+ helpers.doKeys('gn', '');
+ helpers.assertCursorAt(0, 15);
+
+ // gn when cursor is at end of match
+ helpers.doKeys('gn', '');
+ helpers.doKeys('');
+ helpers.assertCursorAt(0, 15);
+
+ // consecutive gns should extend the selection
+ helpers.doKeys('gn');
+ helpers.assertCursorAt(0, 16);
+ helpers.doKeys('gn');
+ helpers.assertCursorAt(1, 11);
+
+ // we should have selected the second and third "match"
+ helpers.doKeys('d');
+ eq('match nope ', cm.getValue());
+}, { value: 'match nope match \n nope Match' });
+testVim('/ and gN selects the appropriate word', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('/');
+ helpers.assertCursorAt(0, 11);
+
+ // gN when cursor is at beginning of match
+ helpers.doKeys('gN', '');
+ helpers.assertCursorAt(0, 11);
+
+ // gN when cursor is at end of match
+ helpers.doKeys('e', 'gN', '');
+ helpers.assertCursorAt(0, 11);
+
+ // consecutive gNs should extend the selection
+ helpers.doKeys('gN');
+ helpers.assertCursorAt(0, 11);
+ helpers.doKeys('gN');
+ helpers.assertCursorAt(0, 0);
+
+ // we should have selected the first and second "match"
+ helpers.doKeys('d');
+ eq(' \n nope Match', cm.getValue());
+}, { value: 'match nope match \n nope Match' })
+testVim('/ and gn with an associated operator', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('/');
+ helpers.assertCursorAt(0, 11);
+
+ helpers.doKeys('c', 'gn', 'changed', '');
+
+ // change the current match.
+ eq('match nope changed \n nope Match', cm.getValue());
+
+ // change the next match.
+ helpers.doKeys('.');
+ eq('match nope changed \n nope changed', cm.getValue());
+
+ // change the final match.
+ helpers.doKeys('.');
+ eq('changed nope changed \n nope changed', cm.getValue());
+}, { value: 'match nope match \n nope Match' });
+testVim('/ and gN with an associated operator', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('/');
+ helpers.assertCursorAt(0, 11);
+
+ helpers.doKeys('c', 'gN', 'changed', '');
+
+ // change the current match.
+ eq('match nope changed \n nope Match', cm.getValue());
+
+ // change the next match.
+ helpers.doKeys('.');
+ eq('changed nope changed \n nope Match', cm.getValue());
+
+ // change the final match.
+ helpers.doKeys('.');
+ eq('changed nope changed \n nope changed', cm.getValue());
+}, { value: 'match nope match \n nope Match' });
testVim('/_case', function(cm, vim, helpers) {
cm.openDialog = helpers.fakeOpenDialog('Match');
helpers.doKeys('/');
@@ -2679,6 +2764,90 @@ testVim('? and n/N', function(cm, vim, helpers) {
helpers.doKeys('2', '?');
helpers.assertCursorAt(0, 11);
}, { value: 'match nope match \n nope Match' });
+testVim('? and gn selects the appropriate word', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('?', 'n');
+ helpers.assertCursorAt(0, 11);
+
+ // gn should highlight the the current word while it is within a match.
+
+ // gn when cursor is in beginning of match
+ helpers.doKeys('gn', '');
+ helpers.assertCursorAt(0, 11);
+
+ // gn when cursor is at end of match
+ helpers.doKeys('e', 'gn', '');
+ helpers.assertCursorAt(0, 11);
+
+ // consecutive gns should extend the selection
+ helpers.doKeys('gn');
+ helpers.assertCursorAt(0, 11);
+ helpers.doKeys('gn');
+ helpers.assertCursorAt(0, 0);
+
+ // we should have selected the first and second "match"
+ helpers.doKeys('d');
+ eq(' \n nope Match', cm.getValue());
+}, { value: 'match nope match \n nope Match' });
+testVim('? and gN selects the appropriate word', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('?', 'n');
+ helpers.assertCursorAt(0, 11);
+
+ // gN when cursor is at beginning of match
+ helpers.doKeys('gN', '');
+ helpers.assertCursorAt(0, 15);
+
+ // gN when cursor is at end of match
+ helpers.doKeys('gN', '');
+ helpers.assertCursorAt(0, 15);
+
+ // consecutive gNs should extend the selection
+ helpers.doKeys('gN');
+ helpers.assertCursorAt(0, 16);
+ helpers.doKeys('gN');
+ helpers.assertCursorAt(1, 11);
+
+ // we should have selected the second and third "match"
+ helpers.doKeys('d');
+ eq('match nope ', cm.getValue());
+}, { value: 'match nope match \n nope Match' })
+testVim('? and gn with an associated operator', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('?', 'n');
+ helpers.assertCursorAt(0, 11);
+
+ helpers.doKeys('c', 'gn', 'changed', '');
+
+ // change the current match.
+ eq('match nope changed \n nope Match', cm.getValue());
+
+ // change the next match.
+ helpers.doKeys('.');
+ eq('changed nope changed \n nope Match', cm.getValue());
+
+ // change the final match.
+ helpers.doKeys('.');
+ eq('changed nope changed \n nope changed', cm.getValue());
+}, { value: 'match nope match \n nope Match' });
+testVim('? and gN with an associated operator', function(cm, vim, helpers) {
+ cm.openDialog = helpers.fakeOpenDialog('match');
+ helpers.doKeys('?', 'n');
+ helpers.assertCursorAt(0, 11);
+
+ helpers.doKeys('c', 'gN', 'changed', '');
+
+ // change the current match.
+ eq('match nope changed \n nope Match', cm.getValue());
+
+ // change the next match.
+ helpers.doKeys('.');
+ eq('match nope changed \n nope changed', cm.getValue());
+
+ // change the final match.
+ helpers.doKeys('.');
+ eq('changed nope changed \n nope changed', cm.getValue());
+}, { value: 'match nope match \n nope Match' });
testVim('*', function(cm, vim, helpers) {
cm.setCursor(0, 9);
helpers.doKeys('*');
From db719a2e37f802e79d5e0abeed58721ed95fbaa9 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 15 Sep 2020 09:09:24 +0200
Subject: [PATCH 150/581] Fix drawing of marked text with only attributes
Closes #6414
---
src/line/line_data.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/line/line_data.js b/src/line/line_data.js
index 20dd432831..e650b3e306 100644
--- a/src/line/line_data.js
+++ b/src/line/line_data.js
@@ -178,7 +178,7 @@ function buildToken(builder, text, style, startStyle, endStyle, css, attributes)
}
}
builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
- if (style || startStyle || endStyle || mustWrap || css) {
+ if (style || startStyle || endStyle || mustWrap || css || attributes) {
let fullStyle = style || ""
if (startStyle) fullStyle += startStyle
if (endStyle) fullStyle += endStyle
From 18aa69e17cc7703f106fbe03992456b8e59e8cdc Mon Sep 17 00:00:00 2001
From: Adrian Kunz
Date: Thu, 17 Sep 2020 11:32:20 +0200
Subject: [PATCH 151/581] [lint addon] Use separate CSS classes for common lint
styles
This changes lint.css to be less reliant on the predefined severities
(error and warning), in turn making it easier to define custom ones.
Now all that needs to be done in order to define a new severity, e.g.
`note`, is to add the following CSS:
```css
/* underline */
.CodeMirror-lint-mark-note {
background-image: ...;
}
/* icon */
.CodeMirror-lint-marker-note, .CodeMirror-lint-message-note {
background-image: ...;
}
```
Previously, it was necessary to copy many styles that were only
available under the `CodeMirror-lint-*-error` and
`CodeMirror-lint-*-warning` classes.
---
addon/lint/lint.css | 6 +++---
addon/lint/lint.js | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/addon/lint/lint.css b/addon/lint/lint.css
index f097cfe345..fef620a492 100644
--- a/addon/lint/lint.css
+++ b/addon/lint/lint.css
@@ -25,7 +25,7 @@
-ms-transition: opacity .4s;
}
-.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
+.CodeMirror-lint-mark {
background-position: left bottom;
background-repeat: repeat-x;
}
@@ -40,7 +40,7 @@
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
}
-.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
+.CodeMirror-lint-marker {
background-position: center center;
background-repeat: no-repeat;
cursor: pointer;
@@ -51,7 +51,7 @@
position: relative;
}
-.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
+.CodeMirror-lint-message {
padding-left: 18px;
background-position: top left;
background-repeat: no-repeat;
diff --git a/addon/lint/lint.js b/addon/lint/lint.js
index 5bc1af18ae..963f2cf227 100644
--- a/addon/lint/lint.js
+++ b/addon/lint/lint.js
@@ -83,10 +83,10 @@
function makeMarker(cm, labels, severity, multiple, tooltips) {
var marker = document.createElement("div"), inner = marker;
- marker.className = "CodeMirror-lint-marker-" + severity;
+ marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity;
if (multiple) {
inner = marker.appendChild(document.createElement("div"));
- inner.className = "CodeMirror-lint-marker-multiple";
+ inner.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple";
}
if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
@@ -114,7 +114,7 @@
var severity = ann.severity;
if (!severity) severity = "error";
var tip = document.createElement("div");
- tip.className = "CodeMirror-lint-message-" + severity;
+ tip.className = "CodeMirror-lint-message CodeMirror-lint-message-" + severity;
if (typeof ann.messageHTML != 'undefined') {
tip.innerHTML = ann.messageHTML;
} else {
@@ -183,7 +183,7 @@
if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann));
if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, {
- className: "CodeMirror-lint-mark-" + severity,
+ className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + severity,
__annotation: ann
}));
}
From 376c0d9a9e67f42fa2c77e3529b1740097ea68b3 Mon Sep 17 00:00:00 2001
From: Adrian Kunz
Date: Sun, 20 Sep 2020 14:36:24 +0200
Subject: [PATCH 152/581] [lint addon] Put error CSS after warning
By swapping the CSS rules, the error rules take priority in case there
are markers with both severities on the same token. That token is now
underlined red instead of yellow, making it consistent with how errors
take priority in the gutter.
---
addon/lint/lint.css | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/addon/lint/lint.css b/addon/lint/lint.css
index fef620a492..0871865959 100644
--- a/addon/lint/lint.css
+++ b/addon/lint/lint.css
@@ -30,16 +30,14 @@
background-repeat: repeat-x;
}
-.CodeMirror-lint-mark-error {
- background-image:
- url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
- ;
-}
-
.CodeMirror-lint-mark-warning {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
}
+.CodeMirror-lint-mark-error {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==");
+}
+
.CodeMirror-lint-marker {
background-position: center center;
background-repeat: no-repeat;
@@ -57,14 +55,14 @@
background-repeat: no-repeat;
}
-.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
- background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
-}
-
.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
}
+.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
+}
+
.CodeMirror-lint-marker-multiple {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
background-repeat: no-repeat;
From 66a96a567b7b1e3da6319bd933c94b284811f161 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Sun, 20 Sep 2020 19:37:00 +0200
Subject: [PATCH 153/581] Set the readonly attribute on the hidden textarea
when the editor is read-only
This prevents cut/paste from showing up in the context menu on Chrome
(but doesn't help on Firefox).
Closes #6418
---
src/input/TextareaInput.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/input/TextareaInput.js b/src/input/TextareaInput.js
index 8fe14bb413..977eb22723 100644
--- a/src/input/TextareaInput.js
+++ b/src/input/TextareaInput.js
@@ -366,6 +366,7 @@ export default class TextareaInput {
readOnlyChanged(val) {
if (!val) this.reset()
this.textarea.disabled = val == "nocursor"
+ this.textarea.readOnly = !!val
}
setUneditable() {}
From 7b63084691b9c56baf02e5f2c2a9d5aebd435dc1 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 21 Sep 2020 09:46:57 +0200
Subject: [PATCH 154/581] Update placeholder visibility during composition
Closes #6420:
---
addon/display/placeholder.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/addon/display/placeholder.js b/addon/display/placeholder.js
index 4eabe3d901..19e9a3418c 100644
--- a/addon/display/placeholder.js
+++ b/addon/display/placeholder.js
@@ -15,11 +15,13 @@
cm.on("blur", onBlur);
cm.on("change", onChange);
cm.on("swapDoc", onChange);
+ CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = () => onComposition(cm))
onChange(cm);
} else if (!val && prev) {
cm.off("blur", onBlur);
cm.off("change", onChange);
cm.off("swapDoc", onChange);
+ CodeMirror.off(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose)
clearPlaceholder(cm);
var wrapper = cm.getWrapperElement();
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
@@ -46,6 +48,16 @@
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
}
+ function onComposition(cm) {
+ var empty = true, input = cm.getInputField()
+ if (input.nodeName == "TEXTAREA")
+ empty = !input.value
+ else if (cm.lineCount() == 1)
+ empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
+ if (empty) clearPlaceholder(cm)
+ else setPlaceholder(cm)
+ }
+
function onBlur(cm) {
if (isEmpty(cm)) setPlaceholder(cm);
}
From 76590dcb0683c0ef94c19133d64afe8bb43373ba Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 21 Sep 2020 09:52:29 +0200
Subject: [PATCH 155/581] Mark version 5.58.0
---
AUTHORS | 3 +++
CHANGELOG.md | 20 ++++++++++++++++++++
doc/manual.html | 2 +-
doc/releases.html | 12 ++++++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 39 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 3fa6199e41..bb017e9574 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -15,6 +15,7 @@ Adán Lobato
Aditya Toshniwal
Adrian Aichner
Adrian Heine
+Adrian Kunz
Adrien Bertrand
aeroson
Ahmad Amireh
@@ -332,6 +333,7 @@ Hiroyuki Makino
hitsthings
Hocdoc
Howard
+Howard Jing
Hugues Malphettes
Ian Beck
Ian Davies
@@ -348,6 +350,7 @@ ilvalle
Ilya Kharlamov
Ilya Zverev
Ingo Richter
+Intervue
Irakli Gozalishvili
Ivan Kurnosov
Ivoah
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8e651ec7ec..782f493af6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,23 @@
+## 5.58.0 (2020-09-21)
+
+### Bug fixes
+
+Make backspace delete by code point, not glyph.
+
+Suppress flickering focus outline when clicking on scrollbars in Chrome.
+
+Fix a bug that prevented attributes added via `markText` from showing up unless the span also had some other styling.
+
+Suppress cut and paste context menu entries in readonly editors in Chrome.
+
+[placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder): Update placeholder visibility during composition.
+
+### New features
+
+Make it less cumbersome to style new lint message types.
+
+[vim bindings](https://codemirror.net/demo/vim.html): Support black hole register, `gn` and `gN`
+
## 5.57.0 (2020-08-20)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 8635a1e060..e193f9929b 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.57.0
+ version 5.58.0
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 334a0184c6..3e0adcda6e 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,18 @@
- Get the current version: 5.57.0.
+ Get the current version: 5.58.0.
You can see the code,
read the release notes,
or study the user manual.
diff --git a/package.json b/package.json
index faf0ca08b6..4472c6be3d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codemirror",
- "version": "5.57.0",
+ "version": "5.58.0",
"main": "lib/codemirror.js",
"style": "lib/codemirror.css",
"author": {
diff --git a/src/edit/main.js b/src/edit/main.js
index 64e94929dd..00990e1601 100644
--- a/src/edit/main.js
+++ b/src/edit/main.js
@@ -66,4 +66,4 @@ import { addLegacyProps } from "./legacy.js"
addLegacyProps(CodeMirror)
-CodeMirror.version = "5.57.0"
+CodeMirror.version = "5.58.0"
From c74a1cafc01a7e34af1b19dd4c82ff821c2e1442 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 21 Sep 2020 09:55:45 +0200
Subject: [PATCH 156/581] Fix use of ES6 in addon
---
addon/display/placeholder.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addon/display/placeholder.js b/addon/display/placeholder.js
index 19e9a3418c..eb8332ac4b 100644
--- a/addon/display/placeholder.js
+++ b/addon/display/placeholder.js
@@ -15,7 +15,7 @@
cm.on("blur", onBlur);
cm.on("change", onChange);
cm.on("swapDoc", onChange);
- CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = () => onComposition(cm))
+ CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() { onComposition(cm) })
onChange(cm);
} else if (!val && prev) {
cm.off("blur", onBlur);
From ca046d7d2fe737a0f09b90e2ae455093ca60faa5 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 22 Sep 2020 21:19:03 +0200
Subject: [PATCH 157/581] [placeholder addon] Fix composition handling
Issue #6422
---
addon/display/placeholder.js | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/addon/display/placeholder.js b/addon/display/placeholder.js
index eb8332ac4b..89bb93f378 100644
--- a/addon/display/placeholder.js
+++ b/addon/display/placeholder.js
@@ -49,13 +49,15 @@
}
function onComposition(cm) {
- var empty = true, input = cm.getInputField()
- if (input.nodeName == "TEXTAREA")
- empty = !input.value
- else if (cm.lineCount() == 1)
- empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
- if (empty) clearPlaceholder(cm)
- else setPlaceholder(cm)
+ setTimeout(function() {
+ var empty = false, input = cm.getInputField()
+ if (input.nodeName == "TEXTAREA")
+ empty = !input.value
+ else if (cm.lineCount() == 1)
+ empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
+ if (empty) setPlaceholder(cm)
+ else clearPlaceholder(cm)
+ }, 20)
}
function onBlur(cm) {
From 1c60749b6882bd67b2a11a3f2e21cffa5eb4c5d3 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Wed, 23 Sep 2020 10:11:42 +0200
Subject: [PATCH 158/581] Mark version 5.58.1
---
CHANGELOG.md | 6 ++++++
doc/manual.html | 2 +-
doc/releases.html | 8 ++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
6 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 782f493af6..d3e3fe4223 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 5.58.1 (2020-09-23)
+
+### Bug fixes
+
+[placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder): Remove arrow function that ended up in the code.
+
## 5.58.0 (2020-09-21)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index e193f9929b..42ab5491ed 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.58.0
+ version 5.58.1
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 3e0adcda6e..3b4378f3f1 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -32,6 +32,14 @@
From cdb228ac736369c685865b122b736cd0d397836c Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Fri, 9 Oct 2020 10:00:16 +0200
Subject: [PATCH 165/581] Fix horizontal scrolling-into-view with non-fixed
gutters
Closes #6436
---
src/display/scrolling.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/display/scrolling.js b/src/display/scrolling.js
index 6d97247d92..75d6fc7ee4 100644
--- a/src/display/scrolling.js
+++ b/src/display/scrolling.js
@@ -91,14 +91,15 @@ function calculateScrollPos(cm, rect) {
if (newTop != screentop) result.scrollTop = newTop
}
- let screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft
- let screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)
+ let gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth
+ let screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace
+ let screenw = displayWidth(cm) - display.gutters.offsetWidth
let tooWide = rect.right - rect.left > screenw
if (tooWide) rect.right = rect.left + screenw
if (rect.left < 10)
result.scrollLeft = 0
else if (rect.left < screenleft)
- result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10))
+ result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10))
else if (rect.right > screenw + screenleft - 3)
result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw
return result
From 55d0333907117c9231ffdf555ae8824705993bbb Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Fri, 9 Oct 2020 15:38:39 +0200
Subject: [PATCH 166/581] [javascript mode] Fix potentially-exponential regexp
---
mode/javascript/javascript.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js
index 66e5a308d4..3139fd00d2 100644
--- a/mode/javascript/javascript.js
+++ b/mode/javascript/javascript.js
@@ -126,7 +126,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var kw = keywords[word]
return ret(kw.type, kw.style, word)
}
- if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
+ if (word == "async" && stream.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/, false))
return ret("async", "keyword", word)
}
return ret("variable", "variable", word)
From 9caacec1900d71a971561147ba1e8acb2f08609c Mon Sep 17 00:00:00 2001
From: Mark Boyes
Date: Thu, 15 Oct 2020 21:06:38 +0100
Subject: [PATCH 167/581] [sparql mode] Improve parsing of IRI atoms
* Do not treat the opening '<' of an expanded IRI atom as an operator
The existing code would not highlight the IRI atom "" in the following line as an atom.
FILTER( ?x = "42"^^ )
for example everything after the # would be highlighted as a comment. This is because the sequence "^^<" while all "operator characters", are not all SPARQL operators in this case: the "<" introduces the IRI atom. I special-case the "^^".
* Improve PN_LOCAL parsing to SPARQL 1.1
The following legal sequences of characters from SPARQL 1.1 are additionally parsed as being the right-hand-side of a prefixed IRI.
1) Colons
2) PERCENT escaping
3) PN_LOCAL_ESCAPE escaping
---
mode/sparql/sparql.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/mode/sparql/sparql.js b/mode/sparql/sparql.js
index bb79abff7f..73997c667f 100644
--- a/mode/sparql/sparql.js
+++ b/mode/sparql/sparql.js
@@ -60,12 +60,18 @@ CodeMirror.defineMode("sparql", function(config) {
stream.skipToEnd();
return "comment";
}
+ else if (ch === "^") {
+ ch = stream.peek();
+ if (ch === "^") stream.eat("^");
+ else stream.eatWhile(operatorChars);
+ return "operator";
+ }
else if (operatorChars.test(ch)) {
stream.eatWhile(operatorChars);
return "operator";
}
else if (ch == ":") {
- stream.eatWhile(/[\w\d\._\-]/);
+ eatPnLocal(stream);
return "atom";
}
else if (ch == "@") {
@@ -75,7 +81,7 @@ CodeMirror.defineMode("sparql", function(config) {
else {
stream.eatWhile(/[_\w\d]/);
if (stream.eat(":")) {
- stream.eatWhile(/[\w\d_\-]/);
+ eatPnLocal(stream);
return "atom";
}
var word = stream.current();
@@ -88,6 +94,10 @@ CodeMirror.defineMode("sparql", function(config) {
}
}
+ function eatPnLocal(stream) {
+ while (stream.match(/([:\w\d._-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-fA-F0-9][a-fA-F0-9])/));
+ }
+
function tokenLiteral(quote) {
return function(stream, state) {
var escaped = false, ch;
From 9885241fe9dee2415f988d3a3619421f45ce8c6b Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Fri, 16 Oct 2020 09:53:55 +0200
Subject: [PATCH 168/581] [javascript mode] Don't indent in template strings
Closes #6442
---
mode/javascript/javascript.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js
index 3139fd00d2..63eaa241b7 100644
--- a/mode/javascript/javascript.js
+++ b/mode/javascript/javascript.js
@@ -868,7 +868,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
},
indent: function(state, textAfter) {
- if (state.tokenize == tokenComment) return CodeMirror.Pass;
+ if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass;
if (state.tokenize != tokenBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
// Kludge to prevent 'maybelse' from blocking lexical scope pops
From 212bafa8ab7837abebc1d326ed943540a9a47200 Mon Sep 17 00:00:00 2001
From: tophf
Date: Thu, 22 Oct 2020 14:42:10 +0300
Subject: [PATCH 169/581] [stylus mode] Recognize "url-prefix" token properly
---
mode/stylus/stylus.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mode/stylus/stylus.js b/mode/stylus/stylus.js
index 653958e83b..281118efee 100644
--- a/mode/stylus/stylus.js
+++ b/mode/stylus/stylus.js
@@ -731,7 +731,8 @@
var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"];
// github.com/codemirror/CodeMirror/blob/master/mode/css/css.js
- var documentTypes_ = ["domain", "regexp", "url", "url-prefix"];
+ // Note, "url-prefix" should precede "url" in order to match correctly in documentTypesRegexp
+ var documentTypes_ = ["domain", "regexp", "url-prefix", "url"];
var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"];
var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
From 23b7a9924b5f9460a091e97392dd00d3834e8cc6 Mon Sep 17 00:00:00 2001
From: "David R. Myers"
Date: Fri, 23 Oct 2020 15:12:03 -0400
Subject: [PATCH 170/581] Add WebAssembly to meta
---
mode/meta.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mode/meta.js b/mode/meta.js
index d3efdc172f..c7738a514c 100644
--- a/mode/meta.js
+++ b/mode/meta.js
@@ -169,7 +169,8 @@
{name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
{name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
{name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
- {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]}
+ {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]},
+ {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]},
];
// Ensure all modes have a mime property for backwards compatibility
for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
From 264022ee4af4abca1c158944dc299a8faf8696d6 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 26 Oct 2020 09:08:51 +0100
Subject: [PATCH 171/581] Mark version 5.58.2
---
AUTHORS | 3 +++
CHANGELOG.md | 8 ++++++++
doc/manual.html | 2 +-
doc/releases.html | 7 +++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index bb017e9574..b8087133a8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -208,6 +208,7 @@ David Barnett
David H. Bronke
David Mignot
David Pathakjee
+David R. Myers
David Rodrigues
David Santana
David Vázquez
@@ -524,6 +525,7 @@ Marijn Haverbeke
Mário Gonçalves
Mario Pietsch
Mark Anderson
+Mark Boyes
Mark Dalgleish
Mark Hamstra
Mark Lentczner
@@ -634,6 +636,7 @@ Nikolaj Kappler
Nikolay Kostov
nilp0inter
Nils Knappmeier
+Nina Pypchenko
Nisarg Jhaveri
nlwillia
noragrossman
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3e3fe4223..80200fc784 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+## 5.58.2 (2020-10-23)
+
+### Bug fixes
+
+Fix a bug where horizontally scrolling the cursor into view sometimes failed with a non-fixed gutter.
+
+[julia mode](https://codemirror.net/mode/julia/): Fix an infinite recursion bug.
+
## 5.58.1 (2020-09-23)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 42ab5491ed..1da41d3ccb 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.58.1
+ version 5.58.2
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 0b466970fc..bdf24ed2f7 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,13 @@
- Get the current version: 5.58.1.
+ Get the current version: 5.58.2.
You can see the code,
read the release notes,
or study the user manual.
diff --git a/package.json b/package.json
index ba8e7fc79d..2103e1c325 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "codemirror",
- "version": "5.58.1",
+ "version": "5.58.2",
"main": "lib/codemirror.js",
"style": "lib/codemirror.css",
"author": {
diff --git a/src/edit/main.js b/src/edit/main.js
index 4f9152d892..800ee766f2 100644
--- a/src/edit/main.js
+++ b/src/edit/main.js
@@ -66,4 +66,4 @@ import { addLegacyProps } from "./legacy.js"
addLegacyProps(CodeMirror)
-CodeMirror.version = "5.58.1"
+CodeMirror.version = "5.58.2"
From 138d1b75791f8bb0b9a07fd19cbc2bb81e13dd8f Mon Sep 17 00:00:00 2001
From: tophf
Date: Wed, 28 Oct 2020 21:30:38 +0300
Subject: [PATCH 172/581] [stylus mode] allow block comments
---
mode/stylus/stylus.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mode/stylus/stylus.js b/mode/stylus/stylus.js
index 281118efee..eecc554bc0 100644
--- a/mode/stylus/stylus.js
+++ b/mode/stylus/stylus.js
@@ -722,6 +722,9 @@
return indent;
},
electricChars: "}",
+ blockCommentStart: "/*",
+ blockCommentEnd: "*/",
+ blockCommentContinue: " * ",
lineComment: "//",
fold: "indent"
};
From 4fddb355dead97ca7fc3e096ea5eb0ade62b306d Mon Sep 17 00:00:00 2001
From: Phil DeJarnett
Date: Thu, 29 Oct 2020 15:27:22 -0400
Subject: [PATCH 173/581] [xml-hint addon] Replace nested function with
function expression
---
addon/hint/xml-hint.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addon/hint/xml-hint.js b/addon/hint/xml-hint.js
index 543d19b61c..2b3153124e 100644
--- a/addon/hint/xml-hint.js
+++ b/addon/hint/xml-hint.js
@@ -101,12 +101,12 @@
}
replaceToken = true;
}
- function returnHintsFromAtValues(atValues) {
+ var returnHintsFromAtValues = function(atValues) {
if (atValues)
for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle))
result.push(quote + atValues[i] + quote);
return returnHints();
- }
+ };
if (atValues && atValues.then) return atValues.then(returnHintsFromAtValues);
return returnHintsFromAtValues(atValues);
} else { // An attribute name
From 230cc2e3f70d3e4fc55617437fd4f4995e6817a5 Mon Sep 17 00:00:00 2001
From: iteriani
Date: Fri, 30 Oct 2020 00:39:51 -0700
Subject: [PATCH 174/581] [soy mode] Add support for Element Composition
Add support for Soy Element Composition. It has the syntax in the form of
<{foo()}>>
This adds support to pass through allowEmptyTag and to support this mode in closetag.
---
mode/htmlmixed/htmlmixed.js | 3 ++-
mode/soy/soy.js | 4 +++-
mode/soy/test.js | 16 ++++++++++++++++
mode/xml/xml.js | 4 ++--
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/mode/htmlmixed/htmlmixed.js b/mode/htmlmixed/htmlmixed.js
index 8341ac8261..66a158274c 100644
--- a/mode/htmlmixed/htmlmixed.js
+++ b/mode/htmlmixed/htmlmixed.js
@@ -74,7 +74,8 @@
name: "xml",
htmlMode: true,
multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
- multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag
+ multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag,
+ allowMissingTagName: parserConfig.allowMissingTagName,
});
var tags = {};
diff --git a/mode/soy/soy.js b/mode/soy/soy.js
index d31c947eed..bd3d947145 100644
--- a/mode/soy/soy.js
+++ b/mode/soy/soy.js
@@ -16,6 +16,8 @@
"alias": { noEndTag: true },
"delpackage": { noEndTag: true },
"namespace": { noEndTag: true, soyState: "namespace-def" },
+ "@attribute": paramData,
+ "@attribute?": paramData,
"@param": paramData,
"@param?": paramData,
"@inject": paramData,
@@ -53,7 +55,7 @@
CodeMirror.defineMode("soy", function(config) {
var textMode = CodeMirror.getMode(config, "text/plain");
var modes = {
- html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false}),
+ html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false, allowMissingTagName: true}),
attributes: textMode,
text: textMode,
uri: textMode,
diff --git a/mode/soy/test.js b/mode/soy/test.js
index 57cd4be477..78faddb9aa 100644
--- a/mode/soy/test.js
+++ b/mode/soy/test.js
@@ -26,6 +26,10 @@
'[keyword {] [callee&variable index]([variable-2&error $list])[keyword }]' +
'[string "][tag&bracket />]');
+ MT('soy-element-composition-test',
+ '[tag&bracket <][keyword {][callee&variable foo]()[keyword }]',
+ '[tag&bracket >>]');
+
MT('namespace-test',
'[keyword {namespace] [variable namespace][keyword }]')
@@ -176,6 +180,18 @@
'[keyword {/template}]',
'');
+ MT('attribute-type',
+ '[keyword {template] [def .foo][keyword }]',
+ ' [keyword {@attribute] [def bar]: [type string][keyword }]',
+ '[keyword {/template}]',
+ '');
+
+ MT('attribute-type-optional',
+ '[keyword {template] [def .foo][keyword }]',
+ ' [keyword {@attribute] [def bar]: [type string][keyword }]',
+ '[keyword {/template}]',
+ '');
+
MT('state-variable-reference',
'[keyword {template] [def .foo][keyword }]',
' [keyword {@param] [def bar]:= [atom true][keyword }]',
diff --git a/mode/xml/xml.js b/mode/xml/xml.js
index 73c6e0e0dd..46806ac425 100644
--- a/mode/xml/xml.js
+++ b/mode/xml/xml.js
@@ -189,7 +189,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
function Context(state, tagName, startOfLine) {
this.prev = state.context;
- this.tagName = tagName;
+ this.tagName = tagName || "";
this.indent = state.indented;
this.startOfLine = startOfLine;
if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
@@ -399,7 +399,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) {
xmlCurrentContext: function(state) {
var context = []
for (var cx = state.context; cx; cx = cx.prev)
- if (cx.tagName) context.push(cx.tagName)
+ context.push(cx.tagName)
return context.reverse()
}
};
From 8e7f6728bf1d36963fafdf997b12858f25d7711a Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 26 Oct 2020 09:08:36 +0100
Subject: [PATCH 175/581] Delay blur events during dragging and clicking
Issue #6427
---
src/display/focus.js | 9 ++++++---
src/edit/mouse_events.js | 10 ++++++----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/display/focus.js b/src/display/focus.js
index aa731b4353..0337327e12 100644
--- a/src/display/focus.js
+++ b/src/display/focus.js
@@ -4,19 +4,22 @@ import { addClass, rmClass } from "../util/dom.js"
import { signal } from "../util/event.js"
export function ensureFocus(cm) {
- if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
+ if (!cm.hasFocus()) {
+ cm.display.input.focus()
+ if (!cm.state.focused) onFocus(cm)
+ }
}
export function delayBlurEvent(cm) {
cm.state.delayingBlurEvent = true
setTimeout(() => { if (cm.state.delayingBlurEvent) {
cm.state.delayingBlurEvent = false
- onBlur(cm)
+ if (cm.state.focused) onBlur(cm)
} }, 100)
}
export function onFocus(cm, e) {
- if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false
+ if (cm.state.delayingBlurEvent && !cm.state.draggingText) cm.state.delayingBlurEvent = false
if (cm.options.readOnly == "nocursor") return
if (!cm.state.focused) {
diff --git a/src/edit/mouse_events.js b/src/edit/mouse_events.js
index 5fcc437021..1c820fdb6e 100644
--- a/src/edit/mouse_events.js
+++ b/src/edit/mouse_events.js
@@ -1,4 +1,4 @@
-import { delayBlurEvent, ensureFocus } from "../display/focus.js"
+import { delayBlurEvent, ensureFocus, onBlur } from "../display/focus.js"
import { operation } from "../display/operations.js"
import { visibleLines } from "../display/update_lines.js"
import { clipPos, cmp, maxPos, minPos, Pos } from "../line/pos.js"
@@ -149,6 +149,7 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
let dragEnd = operation(cm, e => {
if (webkit) display.scroller.draggable = false
cm.state.draggingText = false
+ if (cm.state.delayingBlurEvent) delayBlurEvent(cm)
off(display.wrapper.ownerDocument, "mouseup", dragEnd)
off(display.wrapper.ownerDocument, "mousemove", mouseMove)
off(display.scroller, "dragstart", dragStart)
@@ -172,15 +173,15 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
if (webkit) display.scroller.draggable = true
cm.state.draggingText = dragEnd
dragEnd.copy = !behavior.moveOnDrag
- // IE's approach to draggable
- if (display.scroller.dragDrop) display.scroller.dragDrop()
on(display.wrapper.ownerDocument, "mouseup", dragEnd)
on(display.wrapper.ownerDocument, "mousemove", mouseMove)
on(display.scroller, "dragstart", dragStart)
on(display.scroller, "drop", dragEnd)
- delayBlurEvent(cm)
+ cm.state.delayingBlurEvent = true
setTimeout(() => display.input.focus(), 20)
+ // IE's approach to draggable
+ if (display.scroller.dragDrop) display.scroller.dragDrop()
}
function rangeForUnit(cm, pos, unit) {
@@ -193,6 +194,7 @@ function rangeForUnit(cm, pos, unit) {
// Normal selection, as opposed to text dragging.
function leftButtonSelect(cm, event, start, behavior) {
+ if (ie) delayBlurEvent(cm)
let display = cm.display, doc = cm.doc
e_preventDefault(event)
From f006f3d867c62813309a6f16f5fc242092a73b7b Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Wed, 4 Nov 2020 16:30:32 +0100
Subject: [PATCH 176/581] Remove unused import
---
src/edit/mouse_events.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/edit/mouse_events.js b/src/edit/mouse_events.js
index 1c820fdb6e..401eadf431 100644
--- a/src/edit/mouse_events.js
+++ b/src/edit/mouse_events.js
@@ -1,4 +1,4 @@
-import { delayBlurEvent, ensureFocus, onBlur } from "../display/focus.js"
+import { delayBlurEvent, ensureFocus } from "../display/focus.js"
import { operation } from "../display/operations.js"
import { visibleLines } from "../display/update_lines.js"
import { clipPos, cmp, maxPos, minPos, Pos } from "../line/pos.js"
From 57ba96eb392401d209b63dd187f2f2c087f1885b Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 5 Nov 2020 09:03:33 +0100
Subject: [PATCH 177/581] Fix handling of insertAt option to addLineWidget
Issue #6460
---
src/model/line_widget.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/model/line_widget.js b/src/model/line_widget.js
index 5444d89df0..f94727e5f8 100644
--- a/src/model/line_widget.js
+++ b/src/model/line_widget.js
@@ -63,7 +63,7 @@ export function addLineWidget(doc, handle, node, options) {
changeLine(doc, handle, "widget", line => {
let widgets = line.widgets || (line.widgets = [])
if (widget.insertAt == null) widgets.push(widget)
- else widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget)
+ else widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget)
widget.line = line
if (cm && !lineIsHidden(doc, line)) {
let aboveVisible = heightAtLine(line) < doc.scrollTop
From 6ba05b288eb2fb948653b597f6f7f11770bb9aef Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 12 Nov 2020 09:28:39 +0100
Subject: [PATCH 178/581] [shell mode] Add support for Bash-style heredoc
quoting
Closes #6468
---
mode/shell/shell.js | 15 +++++++++++++++
mode/shell/test.js | 15 +++++++++++----
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/mode/shell/shell.js b/mode/shell/shell.js
index 5af12413b0..2bc1eaf948 100644
--- a/mode/shell/shell.js
+++ b/mode/shell/shell.js
@@ -70,6 +70,13 @@ CodeMirror.defineMode('shell', function() {
stream.eatWhile(/\w/);
return 'attribute';
}
+ if (ch == "<") {
+ let heredoc = stream.match(/^<-?\s+(.*)/)
+ if (heredoc) {
+ state.tokens.unshift(tokenHeredoc(heredoc[1]))
+ return 'string-2'
+ }
+ }
if (/\d/.test(ch)) {
stream.eatWhile(/\d/);
if(stream.eol() || !/\w/.test(stream.peek())) {
@@ -129,6 +136,14 @@ CodeMirror.defineMode('shell', function() {
return 'def';
};
+ function tokenHeredoc(delim) {
+ return function(stream, state) {
+ if (stream.sol() && stream.string == delim) state.tokens.shift()
+ stream.skipToEnd()
+ return "string-2"
+ }
+ }
+
function tokenize(stream, state) {
return (state.tokens[0] || tokenBase) (stream, state);
};
diff --git a/mode/shell/test.js b/mode/shell/test.js
index 7571d907de..237375d451 100644
--- a/mode/shell/test.js
+++ b/mode/shell/test.js
@@ -65,9 +65,16 @@
MT("strings in parens",
"[def FOO][operator =]([quote $(<][string \"][def $MYDIR][string \"][quote /myfile grep ][string 'hello$'][quote )])")
- MT ("string ending in dollar",
- '[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]')
+ MT("string ending in dollar",
+ '[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]')
- MT ("quote ending in dollar",
- "[quote $(echo a$)]")
+ MT("quote ending in dollar",
+ "[quote $(echo a$)]")
+
+ MT("heredoc",
+ "[builtin cat] [string-2 <<- end]",
+ "[string-2 content one]",
+ "[string-2 content two end]",
+ "[string-2 end]",
+ "[builtin echo]")
})();
From ffc17920ed39779f3a18b3f6333bbf6a2bc3a537 Mon Sep 17 00:00:00 2001
From: Christopher Wallis
Date: Thu, 12 Nov 2020 01:43:36 -0700
Subject: [PATCH 179/581] [soy mode] Add support for {@attribute *}
- forks the state at param-def to detect * as a type
---
mode/soy/soy.js | 5 +++++
mode/soy/test.js | 6 ++++++
2 files changed, 11 insertions(+)
diff --git a/mode/soy/soy.js b/mode/soy/soy.js
index bd3d947145..cac59bb3df 100644
--- a/mode/soy/soy.js
+++ b/mode/soy/soy.js
@@ -276,6 +276,11 @@
return null;
case "param-def":
+ if (match = stream.match(/^\*/)) {
+ state.soyState.pop();
+ state.soyState.push("param-type");
+ return "type";
+ }
if (match = stream.match(/^\w+/)) {
state.variables = prepend(state.variables, match[0]);
state.soyState.pop();
diff --git a/mode/soy/test.js b/mode/soy/test.js
index 78faddb9aa..8c764c7a2b 100644
--- a/mode/soy/test.js
+++ b/mode/soy/test.js
@@ -192,6 +192,12 @@
'[keyword {/template}]',
'');
+ MT('attribute-type-all',
+ '[keyword {template] [def .foo][keyword }]',
+ ' [keyword {@attribute] [type *][keyword }]',
+ '[keyword {/template}]',
+ '');
+
MT('state-variable-reference',
'[keyword {template] [def .foo][keyword }]',
' [keyword {@param] [def bar]:= [atom true][keyword }]',
From eb345ef70e75805bf7d7d02b9d87c30ec1db2937 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Fri, 13 Nov 2020 10:06:33 +0100
Subject: [PATCH 180/581] Fix lint error
---
mode/shell/shell.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/shell/shell.js b/mode/shell/shell.js
index 2bc1eaf948..2b0d8a91bc 100644
--- a/mode/shell/shell.js
+++ b/mode/shell/shell.js
@@ -71,7 +71,7 @@ CodeMirror.defineMode('shell', function() {
return 'attribute';
}
if (ch == "<") {
- let heredoc = stream.match(/^<-?\s+(.*)/)
+ var heredoc = stream.match(/^<-?\s+(.*)/)
if (heredoc) {
state.tokens.unshift(tokenHeredoc(heredoc[1]))
return 'string-2'
From dda3f9d6b8d2450b87b619ed5db761cb20b892b8 Mon Sep 17 00:00:00 2001
From: iteriani
Date: Fri, 13 Nov 2020 01:08:19 -0800
Subject: [PATCH 181/581] [soy mode] Natively support Soy Element Composition
* Add support for Soy Element Composition.
Add support for Soy Element Composition. It has the syntax in the form of
<{foo()}>>
This adds support to pass through allowEmptyTag and to support this mode in closetag.
* Disable allowMissingTagName and handle Soy Element Composition directly.
Disable allowMissingTagName and handle Soy Element Composition directly. This also adds a case in closetag.js to handle autocompletes for soy element composition.
Right now, if you were to do something like
<{foo()}>
it would autocomplet with . This change makes it autocomplete with >
---
addon/edit/closetag.js | 5 +++--
mode/soy/soy.js | 20 ++++++++++++++++++++
mode/soy/test.js | 9 +++++++--
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/addon/edit/closetag.js b/addon/edit/closetag.js
index 8689765eec..7c22a50ecf 100644
--- a/addon/edit/closetag.js
+++ b/addon/edit/closetag.js
@@ -128,9 +128,10 @@
replacement = head + "style";
} else {
var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
- if (!context || (context.length && closingTagExists(cm, context, context[context.length - 1], pos)))
+ var top = context.length ? context[context.length - 1] : ""
+ if (!context || (context.length && closingTagExists(cm, context, top, pos)))
return CodeMirror.Pass;
- replacement = head + context[context.length - 1]
+ replacement = head + top
}
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
replacements[i] = replacement;
diff --git a/mode/soy/soy.js b/mode/soy/soy.js
index cac59bb3df..17bafcd932 100644
--- a/mode/soy/soy.js
+++ b/mode/soy/soy.js
@@ -498,6 +498,17 @@
}
return expression(stream, state);
+ case "template-call-expression":
+ if (stream.match(/^([\w-?]+)(?==)/)) {
+ return "attribute";
+ } else if (stream.eat('>')) {
+ state.soyState.pop();
+ return "keyword";
+ } else if (stream.eat('/>')) {
+ state.soyState.pop();
+ return "keyword";
+ }
+ return expression(stream, state);
case "literal":
if (stream.match(/^(?=\{\/literal})/)) {
state.soyState.pop();
@@ -563,6 +574,15 @@
state.soyState.push("import");
state.indent += 2 * config.indentUnit;
return "keyword";
+ } else if (match = stream.match(/^<\{/)) {
+ state.soyState.push("template-call-expression");
+ state.tag = "print";
+ state.indent += 2 * config.indentUnit;
+ state.soyState.push("tag");
+ return "keyword";
+ } else if (match = stream.match(/^<\/>/)) {
+ state.indent -= 2 * config.indentUnit;
+ return "keyword";
}
return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);
diff --git a/mode/soy/test.js b/mode/soy/test.js
index 8c764c7a2b..ae13158720 100644
--- a/mode/soy/test.js
+++ b/mode/soy/test.js
@@ -27,8 +27,13 @@
'[string "][tag&bracket />]');
MT('soy-element-composition-test',
- '[tag&bracket <][keyword {][callee&variable foo]()[keyword }]',
- '[tag&bracket >>]');
+ '[keyword <{][callee&variable foo]()[keyword }]',
+ '[keyword >>]');
+
+ MT('soy-element-composition-attribute-test',
+ '[keyword <{][callee&variable foo]()[keyword }]',
+ '[attribute class]=[string "Foo"]',
+ '[keyword >>]');
MT('namespace-test',
'[keyword {namespace] [variable namespace][keyword }]')
From 37f7d7b00b674c4ebf380855d77f822829a8b76b Mon Sep 17 00:00:00 2001
From: Hendrik Erz
Date: Sat, 14 Nov 2020 20:23:25 +0100
Subject: [PATCH 182/581] [show-hint addon] Document all options
---
doc/manual.html | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/doc/manual.html b/doc/manual.html
index 1da41d3ccb..2ba7c732f2 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -2700,8 +2700,8 @@
Addons
Defines editor.showHint, which takes an optional
options object, and pops up a widget that allows the user to
select a completion. Finding hints is done with a hinting
- functions (the hint option), which is a function
- that take an editor instance and options object, and return
+ function (the hint option). This function
+ takes an editor instance and an options object, and returns
a {list, from, to} object, where list
is an array of strings or objects (the completions),
and from and to give the start and end
@@ -2771,9 +2771,22 @@
Addons
alignWithWord: boolean
Whether the pop-up should be horizontally aligned with the
start of the word (true, default), or with the cursor (false).
+
closeCharacters: RegExp
+
A regular expression object used to match characters which
+ cause the pop up to be closed (default: /[\s()\[\]{};:>,]/).
+ If the user types one of these characters, the pop up will close, and
+ the endCompletion event is fired on the editor instance.
closeOnUnfocus: boolean
When enabled (which is the default), the pop-up will close
when the editor is unfocused.
+
completeOnSingleClick: boolean
+
Whether a single click on a list item suffices to trigger the
+ completion (which is the default), or if the user has to use a
+ doubleclick.
+
container: Element|null
+
Can be used to define a custom container for the widget. The default
+ is null, in which case the body-element will
+ be used.
customKeys: keymap
Allows you to provide a custom key map of keys to be active
when the pop-up is active. The handlers will be called with an
@@ -2809,6 +2822,14 @@
Addons
"close" ()
Fired when the completion is finished.
+ The following events will be fired on the editor instance during
+ completion:
+
+
"endCompletion" ()
+
Fired when the pop-up is being closed programmatically, e.g., when
+ the user types a character which matches the
+ closeCharacters option.
+
This addon depends on styles
from addon/hint/show-hint.css. Check
out the demo for an
From 097d7c957c7d4988a942d11c0ac681f004ba0e8a Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 16 Nov 2020 21:58:04 +0100
Subject: [PATCH 183/581] [html-hint addon] Add dialog tag
Closes #6474
---
addon/hint/html-hint.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/addon/hint/html-hint.js b/addon/hint/html-hint.js
index d0cca4f6a2..9878eca6ef 100644
--- a/addon/hint/html-hint.js
+++ b/addon/hint/html-hint.js
@@ -98,6 +98,7 @@
dfn: s,
dir: s,
div: s,
+ dialog: { attrs: { open: null } },
dl: s,
dt: s,
em: s,
From 12512d3ed0014696a64fe5d6bee2e0e5259a4861 Mon Sep 17 00:00:00 2001
From: erosman
Date: Tue, 17 Nov 2020 14:23:54 +0330
Subject: [PATCH 184/581] [javascript-lint addon] Add comment noting dependency
Added note on dependency on jshint.js
---
addon/lint/javascript-lint.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/addon/lint/javascript-lint.js b/addon/lint/javascript-lint.js
index cc132d7f82..e5bc752308 100644
--- a/addon/lint/javascript-lint.js
+++ b/addon/lint/javascript-lint.js
@@ -1,6 +1,8 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
+// Depends on jshint.js from https://github.com/jshint/jshint
+
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
From 0e6548686356d58504638c2bea95d403a9e53cde Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Wed, 18 Nov 2020 07:55:38 +0100
Subject: [PATCH 185/581] Fix focus state confusion in drag handler
Issue #6480
---
mode/clike/clike.js | 8 ++++----
src/edit/mouse_events.js | 5 ++++-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/mode/clike/clike.js b/mode/clike/clike.js
index 37da2ec964..2154f1d2df 100644
--- a/mode/clike/clike.js
+++ b/mode/clike/clike.js
@@ -82,15 +82,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
- if (isPunctuationChar.test(ch)) {
- curPunc = ch;
- return null;
- }
if (numberStart.test(ch)) {
stream.backUp(1)
if (stream.match(number)) return "number"
stream.next()
}
+ if (isPunctuationChar.test(ch)) {
+ curPunc = ch;
+ return null;
+ }
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize = tokenComment;
diff --git a/src/edit/mouse_events.js b/src/edit/mouse_events.js
index 401eadf431..b5d0b5a64e 100644
--- a/src/edit/mouse_events.js
+++ b/src/edit/mouse_events.js
@@ -149,7 +149,10 @@ function leftButtonStartDrag(cm, event, pos, behavior) {
let dragEnd = operation(cm, e => {
if (webkit) display.scroller.draggable = false
cm.state.draggingText = false
- if (cm.state.delayingBlurEvent) delayBlurEvent(cm)
+ if (cm.state.delayingBlurEvent) {
+ if (cm.hasFocus()) cm.state.delayingBlurEvent = false
+ else delayBlurEvent(cm)
+ }
off(display.wrapper.ownerDocument, "mouseup", dragEnd)
off(display.wrapper.ownerDocument, "mousemove", mouseMove)
off(display.scroller, "dragstart", dragStart)
From 5d2feacfc89aab7e9b973ec59627b9def1f63d77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20Esp=C3=ADn?=
Date: Wed, 18 Nov 2020 13:27:20 +0100
Subject: [PATCH 186/581] [real-world uses] Add Graviton Editor
---
doc/realworld.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/doc/realworld.html b/doc/realworld.html
index da6182515e..5da12e2c48 100644
--- a/doc/realworld.html
+++ b/doc/realworld.html
@@ -96,6 +96,7 @@
From 0630b63d94ba1b1f79ae89577ec1985f5e277025 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 19 Nov 2020 09:29:46 +0100
Subject: [PATCH 187/581] [placeholder addon] Further fix composition handling
Closes #6479
---
addon/display/placeholder.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/addon/display/placeholder.js b/addon/display/placeholder.js
index 89bb93f378..cfb8341db2 100644
--- a/addon/display/placeholder.js
+++ b/addon/display/placeholder.js
@@ -50,11 +50,12 @@
function onComposition(cm) {
setTimeout(function() {
- var empty = false, input = cm.getInputField()
- if (input.nodeName == "TEXTAREA")
- empty = !input.value
- else if (cm.lineCount() == 1)
- empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
+ var empty = false
+ if (cm.lineCount() == 1) {
+ var input = cm.getInputField()
+ empty = input.nodeName == "TEXTAREA" ? !cm.getLine(0).length
+ : !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
+ }
if (empty) setPlaceholder(cm)
else clearPlaceholder(cm)
}, 20)
From a53e86069bc06410ff477a8a5849a5abd26f983a Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 19 Nov 2020 09:38:15 +0100
Subject: [PATCH 188/581] Mark version 5.58.3
---
AUTHORS | 5 +++++
CHANGELOG.md | 12 ++++++++++++
doc/manual.html | 2 +-
doc/releases.html | 9 +++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index b8087133a8..33d819ed24 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -251,6 +251,7 @@ Eric Allam
Eric Bogard
Erik Demaine
Erik Welander
+erosman
eustas
Evan Minsk
Fabien Dubosson
@@ -326,6 +327,7 @@ Heanes
Hector Oswaldo Caballero
Hein Htat
Hélio
+Hendrik Erz
Hendrik Wallbaum
Henrik Haugbølle
Herculano Campos
@@ -353,6 +355,7 @@ Ilya Zverev
Ingo Richter
Intervue
Irakli Gozalishvili
+iteriani
Ivan Kurnosov
Ivoah
Jack Douglas
@@ -517,6 +520,7 @@ Manuel Rego Casasnovas
Marat Dreizin
Marcel Gerber
Marcelo Camargo
+Marc Espín
Marco Aurélio
Marco Munizaga
Marcus Bointon
@@ -681,6 +685,7 @@ Peter Flynn
peterkroon
Peter Kroon
Peter László
+Phil DeJarnett
Philipp A
Philipp Markovics
Philip Stadermann
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 80200fc784..2b00dbd80e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,15 @@
+## 5.58.3 (2020-11-19)
+
+### Bug fixes
+
+Suppress quick-firing of blur-focus events when dragging and clicking on Internet Explorer.
+
+Fix the `insertAt` option to `addLineWidget` to actually allow the widget to be placed after all widgets for the line.
+
+[soy mode](https://codemirror.net/mode/soy/): Support `@Attribute` and element composition.
+
+[shell mode](https://codemirror.net/mode/shell/): Support heredoc quoting.
+
## 5.58.2 (2020-10-23)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 2ba7c732f2..89a6328e6d 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.58.2
+ version 5.58.3
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index bdf24ed2f7..1b4f9a7976 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,15 @@
From f4fd159353930680dbe617d440e5a4867d8b13a9 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Wed, 2 Dec 2020 17:20:39 +0100
Subject: [PATCH 198/581] [hardwrap addon] Improve start-of-line condition for
overlong words
Issue #6494
---
addon/wrap/hardwrap.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addon/wrap/hardwrap.js b/addon/wrap/hardwrap.js
index f194946c5d..bccdc8d14c 100644
--- a/addon/wrap/hardwrap.js
+++ b/addon/wrap/hardwrap.js
@@ -35,7 +35,7 @@
for (; at > 0; --at)
if (wrapOn.test(text.slice(at - 1, at + 1))) break;
- if (at == 0 && !forceBreak) {
+ if (!forceBreak && at <= text.match(/^[ \t]*/)[0].length) {
// didn't find a break point before column, in non-forceBreak mode try to
// find one after 'column'.
for (at = column + 1; at < text.length - 1; ++at) {
From c04867c786c5625f5f221c4162cb54d798dc9a8e Mon Sep 17 00:00:00 2001
From: "Jakub T. Jankiewicz"
Date: Thu, 3 Dec 2020 19:15:50 +0100
Subject: [PATCH 199/581] [scheme mode] Add more special indentation words and
keywords
---
mode/scheme/scheme.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mode/scheme/scheme.js b/mode/scheme/scheme.js
index 56e4e332e9..0bbb8c8a41 100644
--- a/mode/scheme/scheme.js
+++ b/mode/scheme/scheme.js
@@ -26,8 +26,8 @@ CodeMirror.defineMode("scheme", function () {
return obj;
}
- var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
- var indentKeys = makeKeywords("define let letrec let* lambda");
+ var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
+ var indentKeys = makeKeywords("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax define-syntax syntax-rules");
function stateStack(indent, type, prev) { // represents a state stack object
this.indent = indent;
From e410e5c17866308e1aba41f56383a6a2d31f02a9 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 3 Dec 2020 19:30:28 +0100
Subject: [PATCH 200/581] Add a funding.yml file
---
.github/FUNDING.yml | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 .github/FUNDING.yml
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000000..d87b38eee6
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,2 @@
+patreon: marijn
+custom: ['https://www.paypal.com/paypalme/marijnhaverbeke', 'https://marijnhaverbeke.nl/fund/']
From a966b5d115af09983d37f7c9aa034b78ac954ca4 Mon Sep 17 00:00:00 2001
From: Piyush
Date: Fri, 4 Dec 2020 09:50:24 +0530
Subject: [PATCH 201/581] fix memory leak with matchbrackets
---
addon/edit/matchbrackets.js | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/addon/edit/matchbrackets.js b/addon/edit/matchbrackets.js
index 2c47e07033..0377408802 100644
--- a/addon/edit/matchbrackets.js
+++ b/addon/edit/matchbrackets.js
@@ -117,25 +117,25 @@
});
}
- CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
- function clear(cm) {
- if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
- cm.state.matchBrackets.currentlyHighlighted();
- cm.state.matchBrackets.currentlyHighlighted = null;
- }
+ function clearHighlighted(cm) {
+ if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
+ cm.state.matchBrackets.currentlyHighlighted();
+ cm.state.matchBrackets.currentlyHighlighted = null;
}
+ }
+ CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
cm.off("cursorActivity", doMatchBrackets);
cm.off("focus", doMatchBrackets)
- cm.off("blur", clear)
- clear(cm);
+ cm.off("blur", clearHighlighted)
+ clearHighlighted(cm);
}
if (val) {
cm.state.matchBrackets = typeof val == "object" ? val : {};
cm.on("cursorActivity", doMatchBrackets);
cm.on("focus", doMatchBrackets)
- cm.on("blur", clear)
+ cm.on("blur", clearHighlighted)
}
});
From e3fc417882517edaffda6f445c62f8697a0cd495 Mon Sep 17 00:00:00 2001
From: Simon Huber
Date: Mon, 7 Dec 2020 10:16:23 +0100
Subject: [PATCH 202/581] [solaized theme] Fix typos
---
theme/solarized.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/theme/solarized.css b/theme/solarized.css
index fcd1d70de6..9c6b1265c1 100644
--- a/theme/solarized.css
+++ b/theme/solarized.css
@@ -99,7 +99,7 @@ http://ethanschoonover.com/solarized/img/solarized-palette.png
.cm-s-solarized.cm-s-light div.CodeMirror-selected { background: #eee8d5; }
.cm-s-solarized.cm-s-light .CodeMirror-line::selection, .cm-s-light .CodeMirror-line > span::selection, .cm-s-light .CodeMirror-line > span > span::selection { background: #eee8d5; }
-.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection, .cm-s-ligh .CodeMirror-line > span::-moz-selection, .cm-s-ligh .CodeMirror-line > span > span::-moz-selection { background: #eee8d5; }
+.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection, .cm-s-light .CodeMirror-line > span::-moz-selection, .cm-s-light .CodeMirror-line > span > span::-moz-selection { background: #eee8d5; }
/* Editor styling */
From 622fcb9b8740ceade71c1f579eaa76c8b82a0c0b Mon Sep 17 00:00:00 2001
From: "Jakub T. Jankiewicz"
Date: Mon, 7 Dec 2020 10:19:14 +0100
Subject: [PATCH 203/581] [scheme mode] More indent fixes
---
mode/scheme/scheme.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mode/scheme/scheme.js b/mode/scheme/scheme.js
index 0bbb8c8a41..efac89078b 100644
--- a/mode/scheme/scheme.js
+++ b/mode/scheme/scheme.js
@@ -26,8 +26,8 @@ CodeMirror.defineMode("scheme", function () {
return obj;
}
- var keywords = makeKeywords("λ case-lambda call/cc class define-class exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
- var indentKeys = makeKeywords("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax define-syntax syntax-rules");
+ var keywords = makeKeywords("λ case-lambda call/cc class cond-expand define-class define-values exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
+ var indentKeys = makeKeywords("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax let-values let*-values define-syntax syntax-rules define-values when unless");
function stateStack(indent, type, prev) { // represents a state stack object
this.indent = indent;
From ae4e671eb2d931ce88cf91d6d1f39cdaf7f0654e Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Mon, 7 Dec 2020 21:45:51 +0100
Subject: [PATCH 204/581] [shell mode] Treat <<< as here string operator
Issue #6512
---
mode/shell/shell.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/mode/shell/shell.js b/mode/shell/shell.js
index 2219e62e19..8271485f5f 100644
--- a/mode/shell/shell.js
+++ b/mode/shell/shell.js
@@ -71,6 +71,7 @@ CodeMirror.defineMode('shell', function() {
return 'attribute';
}
if (ch == "<") {
+ if (stream.match("<<")) return "operator"
var heredoc = stream.match(/^<-?\s*['"]?([^'"]*)['"]?/)
if (heredoc) {
state.tokens.unshift(tokenHeredoc(heredoc[1]))
From fb4ec129858dc916de86e8dd802e9668ae0049a0 Mon Sep 17 00:00:00 2001
From: mlsad3
Date: Tue, 8 Dec 2020 01:35:04 -0700
Subject: [PATCH 205/581] [verilog mode] Improve
* Handle `uvm_*_begin/end macros as well as macros in case/switch.
* Prevent extern functions and typedef classes from indenting.
* Indent lines after assignments, handle corner-case inside parenthesis.
* Handle 'disable fork' and 'wait fork'.
* Add '<' and '>' to operators.
* Add tests for mode/verilog changes.
* Verilog mode handles compiler directives and differentiates assignment vs comparison.
* Cleanup lint errors.
* Add verilog mode support for '@'.
Co-authored-by: Matt Diehl
---
mode/verilog/test.js | 170 ++++++++++++++++++++++++++++++++++++++++
mode/verilog/verilog.js | 138 ++++++++++++++++++++++++++++----
2 files changed, 292 insertions(+), 16 deletions(-)
diff --git a/mode/verilog/test.js b/mode/verilog/test.js
index bafe726db3..38c1cbe457 100644
--- a/mode/verilog/test.js
+++ b/mode/verilog/test.js
@@ -139,6 +139,32 @@
""
);
+ MT("align_assignments",
+ /**
+ * always @(posedge clk) begin
+ * if (rst)
+ * data_out <= 8'b0 +
+ * 8'b1;
+ * else
+ * data_out = 8'b0 +
+ * 8'b1;
+ * data_out =
+ * 8'b0 + 8'b1;
+ * end
+ */
+ "[keyword always] [def @][bracket (][keyword posedge] [variable clk][bracket )] [keyword begin]",
+ " [keyword if] [bracket (][variable rst][bracket )]",
+ " [variable data_out] [meta <=] [number 8'b0] [meta +]",
+ " [number 8'b1];",
+ " [keyword else]",
+ " [variable data_out] [meta =] [number 8'b0] [meta +]",
+ " [number 8'b1];",
+ " [variable data_out] [meta =] [number 8'b0] [meta +]",
+ " [number 8'b1];",
+ "[keyword end]",
+ ""
+ );
+
// Indentation tests
MT("indent_single_statement_if",
"[keyword if] [bracket (][variable foo][bracket )]",
@@ -270,4 +296,148 @@
""
);
+ MT("indent_uvm_macros",
+ /**
+ * `uvm_object_utils_begin(foo)
+ * `uvm_field_event(foo, UVM_ALL_ON)
+ * `uvm_object_utils_end
+ */
+ "[def `uvm_object_utils_begin][bracket (][variable foo][bracket )]",
+ " [def `uvm_field_event][bracket (][variable foo], [variable UVM_ALL_ON][bracket )]",
+ "[def `uvm_object_utils_end]",
+ ""
+ );
+
+ MT("indent_uvm_macros2",
+ /**
+ * `uvm_do_with(mem_read,{
+ * bar_nb == 0;
+ * })
+ */
+ "[def `uvm_do_with][bracket (][variable mem_read],[bracket {]",
+ " [variable bar_nb] [meta ==] [number 0];",
+ "[bracket })]",
+ ""
+ );
+
+ MT("indent_wait_disable_fork",
+ /**
+ * virtual task body();
+ * repeat (20) begin
+ * fork
+ * `uvm_create_on(t,p_seq)
+ * join_none
+ * end
+ * wait fork;
+ * disable fork;
+ * endtask : body
+ */
+ "[keyword virtual] [keyword task] [variable body][bracket ()];",
+ " [keyword repeat] [bracket (][number 20][bracket )] [keyword begin]",
+ " [keyword fork]",
+ " [def `uvm_create_on][bracket (][variable t],[variable p_seq][bracket )]",
+ " [keyword join_none]",
+ " [keyword end]",
+ " [keyword wait] [keyword fork];",
+ " [keyword disable] [keyword fork];",
+ "[keyword endtask] : [variable body]",
+ ""
+ );
+
+ MT("indent_typedef_class",
+ /**
+ * typedef class asdf;
+ * typedef p p_t[];
+ * typedef enum {
+ * ASDF
+ * } t;
+ */
+ "[keyword typedef] [keyword class] [variable asdf];",
+ "[keyword typedef] [variable p] [variable p_t][bracket [[]]];",
+ "[keyword typedef] [keyword enum] [bracket {]",
+ " [variable ASDF]",
+ "[bracket }] [variable t];",
+ ""
+ );
+
+ MT("indent_case_with_macro",
+ /**
+ * // It should be assumed that Macros can have ';' inside, or 'begin'/'end' blocks.
+ * // As such, 'case' statement should indent correctly with macros inside.
+ * case(foo)
+ * ASDF : this.foo = seqNum;
+ * ABCD : `update(f)
+ * EFGH : `update(g)
+ * endcase
+ */
+ "[keyword case][bracket (][variable foo][bracket )]",
+ " [variable ASDF] : [keyword this].[variable foo] [meta =] [variable seqNum];",
+ " [variable ABCD] : [def `update][bracket (][variable f][bracket )]",
+ " [variable EFGH] : [def `update][bracket (][variable g][bracket )]",
+ "[keyword endcase]",
+ ""
+ );
+
+ MT("indent_extern_function",
+ /**
+ * extern virtual function void do(ref packet trans);
+ * extern virtual function void do2(ref packet trans);
+ */
+ "[keyword extern] [keyword virtual] [keyword function] [keyword void] [variable do1][bracket (][keyword ref] [variable packet] [variable trans][bracket )];",
+ "[keyword extern] [keyword virtual] [keyword function] [keyword void] [variable do2][bracket (][keyword ref] [variable packet] [variable trans][bracket )];",
+ ""
+ );
+
+ MT("indent_assignment",
+ /**
+ * for (int i=1;i < fun;i++) begin
+ * foo = 2 << asdf || 11'h35 >> abcd
+ * && 8'h6 | 1'b1;
+ * end
+ */
+ "[keyword for] [bracket (][keyword int] [variable i][meta =][number 1];[variable i] [meta <] [variable fun];[variable i][meta ++][bracket )] [keyword begin]",
+ " [variable foo] [meta =] [number 2] [meta <<] [variable asdf] [meta ||] [number 11'h35] [meta >>] [variable abcd]",
+ " [meta &&] [number 8'h6] [meta |] [number 1'b1];",
+ "[keyword end]",
+ ""
+ );
+
+ MT("indent_foreach_constraint",
+ /**
+ * `uvm_rand_send_with(wrTlp, {
+ * length ==1;
+ * foreach (Data[i]) {
+ * payload[i] == Data[i];
+ * }
+ * })
+ */
+ "[def `uvm_rand_send_with][bracket (][variable wrTlp], [bracket {]",
+ " [variable length] [meta ==][number 1];",
+ " [keyword foreach] [bracket (][variable Data][bracket [[][variable i][bracket ]])] [bracket {]",
+ " [variable payload][bracket [[][variable i][bracket ]]] [meta ==] [variable Data][bracket [[][variable i][bracket ]]];",
+ " [bracket }]",
+ "[bracket })]",
+ ""
+ );
+
+ MT("indent_compiler_directives",
+ /**
+ * `ifdef DUT
+ * `else
+ * `ifndef FOO
+ * `define FOO
+ * `endif
+ * `endif
+ * `timescale 1ns/1ns
+ */
+ "[def `ifdef] [variable DUT]",
+ "[def `else]",
+ " [def `ifndef] [variable FOO]",
+ " [def `define] [variable FOO]",
+ " [def `endif]",
+ "[def `endif]",
+ "[def `timescale] [number 1][variable ns][meta /][number 1][variable ns]",
+ ""
+ );
+
})();
diff --git a/mode/verilog/verilog.js b/mode/verilog/verilog.js
index 43990452d3..544045b867 100644
--- a/mode/verilog/verilog.js
+++ b/mode/verilog/verilog.js
@@ -16,6 +16,12 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
var indentUnit = config.indentUnit,
statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
dontAlignCalls = parserConfig.dontAlignCalls,
+ // compilerDirectivesUseRegularIndentation - If set, Compiler directive
+ // indentation follows the same rules as everything else. Otherwise if
+ // false, compiler directives will track their own indentation.
+ // For example, `ifdef nested inside another `ifndef will be indented,
+ // but a `ifdef inside a function block may not be indented.
+ compilerDirectivesUseRegularIndentation = parserConfig.compilerDirectivesUseRegularIndentation,
noIndentKeywords = parserConfig.noIndentKeywords || [],
multiLineStrings = parserConfig.multiLineStrings,
hooks = parserConfig.hooks || {};
@@ -62,7 +68,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
binary_module_path_operator ::=
== | != | && | || | & | | | ^ | ^~ | ~^
*/
- var isOperatorChar = /[\+\-\*\/!~&|^%=?:]/;
+ var isOperatorChar = /[\+\-\*\/!~&|^%=?:<>]/;
var isBracketChar = /[\[\]{}()]/;
var unsignedNumber = /\d[0-9_]*/;
@@ -72,8 +78,13 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i;
var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i;
- var closingBracketOrWord = /^((\w+)|[)}\]])/;
+ var closingBracketOrWord = /^((`?\w+)|[)}\]])/;
var closingBracket = /[)}\]]/;
+ var compilerDirectiveRegex = new RegExp(
+ "^(`(?:ifdef|ifndef|elsif|else|endif|undef|undefineall|define|include|begin_keywords|celldefine|default|" +
+ "nettype|end_keywords|endcelldefine|line|nounconnected_drive|pragma|resetall|timescale|unconnected_drive))\\b");
+ var compilerDirectiveBeginRegex = /^(`(?:ifdef|ifndef|elsif|else))\b/;
+ var compilerDirectiveEndRegex = /^(`(?:elsif|else|endif))\b/;
var curPunc;
var curKeyword;
@@ -96,6 +107,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
openClose["do" ] = "while";
openClose["fork" ] = "join;join_any;join_none";
openClose["covergroup"] = "endgroup";
+ openClose["macro_begin"] = "macro_end";
for (var i in noIndentKeywords) {
var keyword = noIndentKeywords[i];
@@ -105,7 +117,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
}
// Keywords which open statements that are ended with a semi-colon
- var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while");
+ var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while extern typedef");
function tokenBase(stream, state) {
var ch = stream.peek(), style;
@@ -125,6 +137,24 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
if (ch == '`') {
stream.next();
if (stream.eatWhile(/[\w\$_]/)) {
+ var cur = stream.current();
+ curKeyword = cur;
+ // Macros that end in _begin, are start of block and end with _end
+ if (cur.startsWith("`uvm_") && cur.endsWith("_begin")) {
+ var keywordClose = curKeyword.substr(0,curKeyword.length - 5) + "end";
+ openClose[cur] = keywordClose;
+ curPunc = "newblock";
+ } else if (cur.startsWith("`uvm_") && cur.endsWith("_end")) {
+ } else {
+ stream.eatSpace();
+ if (stream.peek() == '(') {
+ // Check if this is a block
+ curPunc = "newmacro";
+ }
+ var withSpace = stream.current();
+ // Move the stream back before the spaces
+ stream.backUp(withSpace.length - cur.length);
+ }
return "def";
} else {
return null;
@@ -145,6 +175,12 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
stream.eatWhile(/[\d_.]/);
return "def";
}
+ // Event
+ if (ch == '@') {
+ stream.next();
+ stream.eatWhile(/[@]/);
+ return "def";
+ }
// Strings
if (ch == '"') {
stream.next();
@@ -178,6 +214,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
// Operators
if (stream.eatWhile(isOperatorChar)) {
+ curPunc = stream.current();
return "meta";
}
@@ -187,6 +224,15 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
if (keywords[cur]) {
if (openClose[cur]) {
curPunc = "newblock";
+ if (cur === "fork") {
+ // Fork can be a statement instead of block in cases of:
+ // "disable fork;" and "wait fork;" (trailing semicolon)
+ stream.eatSpace()
+ if (stream.peek() == ';') {
+ curPunc = "newstatement";
+ }
+ stream.backUp(stream.current().length - cur.length);
+ }
}
if (statementKeywords[cur]) {
curPunc = "newstatement";
@@ -226,16 +272,17 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
return "comment";
}
- function Context(indented, column, type, align, prev) {
+ function Context(indented, column, type, scopekind, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
+ this.scopekind = scopekind;
this.align = align;
this.prev = prev;
}
- function pushContext(state, col, type) {
+ function pushContext(state, col, type, scopekind) {
var indent = state.indented;
- var c = new Context(indent, col, type, null, state.context);
+ var c = new Context(indent, col, type, scopekind ? scopekind : "", null, state.context);
return state.context = c;
}
function popContext(state) {
@@ -261,6 +308,16 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
}
}
+ function isInsideScopeKind(ctx, scopekind) {
+ if (ctx == null) {
+ return false;
+ }
+ if (ctx.scopekind === scopekind) {
+ return true;
+ }
+ return isInsideScopeKind(ctx.prev, scopekind);
+ }
+
function buildElectricInputRegEx() {
// Reindentation should occur on any bracket char: {}()[]
// or on a match of any of the block closing keywords, at
@@ -287,8 +344,9 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
startState: function(basecolumn) {
var state = {
tokenize: null,
- context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+ context: new Context((basecolumn || 0) - indentUnit, 0, "top", "top", false),
indented: 0,
+ compilerDirectiveIndented: 0,
startOfLine: true
};
if (hooks.startState) hooks.startState(state);
@@ -313,15 +371,42 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
curPunc = null;
curKeyword = null;
var style = (state.tokenize || tokenBase)(stream, state);
- if (style == "comment" || style == "meta" || style == "variable") return style;
+ if (style == "comment" || style == "meta" || style == "variable") {
+ if (((curPunc === "=") || (curPunc === "<=")) && !isInsideScopeKind(ctx, "assignment")) {
+ // '<=' could be nonblocking assignment or lessthan-equals (which shouldn't cause indent)
+ // Search through the context to see if we are already in an assignment.
+ // '=' could be inside port declaration with comma or ')' afterward, or inside for(;;) block.
+ pushContext(state, stream.column() + curPunc.length, "assignment", "assignment");
+ if (ctx.align == null) ctx.align = true;
+ }
+ return style;
+ }
if (ctx.align == null) ctx.align = true;
- if (curPunc == ctx.type) {
- popContext(state);
- } else if ((curPunc == ";" && ctx.type == "statement") ||
+ var isClosingAssignment = ctx.type == "assignment" &&
+ closingBracket.test(curPunc) && ctx.prev && ctx.prev.type === curPunc;
+ if (curPunc == ctx.type || isClosingAssignment) {
+ if (isClosingAssignment) {
+ ctx = popContext(state);
+ }
+ ctx = popContext(state);
+ if (curPunc == ")") {
+ // Handle closing macros, assuming they could have a semicolon or begin/end block inside.
+ if (ctx && (ctx.type === "macro")) {
+ ctx = popContext(state);
+ while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state);
+ }
+ } else if (curPunc == "}") {
+ // Handle closing statements like constraint block: "foreach () {}" which
+ // do not have semicolon at end.
+ if (ctx && (ctx.type === "statement")) {
+ while (ctx && (ctx.type == "statement")) ctx = popContext(state);
+ }
+ }
+ } else if (((curPunc == ";" || curPunc == ",") && (ctx.type == "statement" || ctx.type == "assignment")) ||
(ctx.type && isClosing(curKeyword, ctx.type))) {
ctx = popContext(state);
- while (ctx && ctx.type == "statement") ctx = popContext(state);
+ while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state);
} else if (curPunc == "{") {
pushContext(state, stream.column(), "}");
} else if (curPunc == "[") {
@@ -329,9 +414,9 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
} else if (curPunc == "(") {
pushContext(state, stream.column(), ")");
} else if (ctx && ctx.type == "endcase" && curPunc == ":") {
- pushContext(state, stream.column(), "statement");
+ pushContext(state, stream.column(), "statement", "case");
} else if (curPunc == "newstatement") {
- pushContext(state, stream.column(), "statement");
+ pushContext(state, stream.column(), "statement", curKeyword);
} else if (curPunc == "newblock") {
if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) {
// The 'function' keyword can appear in some other contexts where it actually does not
@@ -339,9 +424,23 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
// Do nothing in this case
} else if (curKeyword == "task" && ctx && ctx.type == "statement") {
// Same thing for task
+ } else if (curKeyword == "class" && ctx && ctx.type == "statement") {
+ // Same thing for class (e.g. typedef)
} else {
var close = openClose[curKeyword];
- pushContext(state, stream.column(), close);
+ pushContext(state, stream.column(), close, curKeyword);
+ }
+ } else if (curPunc == "newmacro" || (curKeyword && curKeyword.match(compilerDirectiveRegex))) {
+ if (curPunc == "newmacro") {
+ // Macros (especially if they have parenthesis) potentially have a semicolon
+ // or complete statement/block inside, and should be treated as such.
+ pushContext(state, stream.column(), "macro", "macro");
+ }
+ if (curKeyword.match(compilerDirectiveEndRegex)) {
+ state.compilerDirectiveIndented -= statementIndentUnit;
+ }
+ if (curKeyword.match(compilerDirectiveBeginRegex)) {
+ state.compilerDirectiveIndented += statementIndentUnit;
}
}
@@ -361,8 +460,15 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
var possibleClosing = textAfter.match(closingBracketOrWord);
if (possibleClosing)
closing = isClosing(possibleClosing[0], ctx.type);
+ if (!compilerDirectivesUseRegularIndentation && textAfter.match(compilerDirectiveRegex)) {
+ if (textAfter.match(compilerDirectiveEndRegex)) {
+ return state.compilerDirectiveIndented - statementIndentUnit;
+ }
+ return state.compilerDirectiveIndented;
+ }
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
- else if (closingBracket.test(ctx.type) && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
+ else if ((closingBracket.test(ctx.type) || ctx.type == "assignment")
+ && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
else return ctx.indented + (closing ? 0 : indentUnit);
},
From 348ab5603405d1e396f32a9acfdf81055c91a16f Mon Sep 17 00:00:00 2001
From: iteriani
Date: Tue, 8 Dec 2020 00:41:03 -0800
Subject: [PATCH 206/581] [soy mode] Update indentation rules for Element
Composition
* Add support for Soy Element Composition.
Add support for Soy Element Composition. It has the syntax in the form of
<{foo()}>>
This adds support to pass through allowEmptyTag and to support this mode in closetag.
* Disable allowMissingTagName and handle Soy Element Composition directly.
Disable allowMissingTagName and handle Soy Element Composition directly. This also adds a case in closetag.js to handle autocompletes for soy element composition.
Right now, if you were to do something like
<{foo()}>
it would autocomplet with . This change makes it autocomplete with >
* Update indentation rules for Soy Element Composition
Update indentation rules for Soy Element Composition
* Update soy.js
* Update soy.js
---
mode/soy/soy.js | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/mode/soy/soy.js b/mode/soy/soy.js
index 17bafcd932..e3427ebe3c 100644
--- a/mode/soy/soy.js
+++ b/mode/soy/soy.js
@@ -463,8 +463,15 @@
return null;
case "tag":
- var endTag = state.tag[0] == "/";
- var tagName = endTag ? state.tag.substring(1) : state.tag;
+ var endTag;
+ var tagName;
+ if (state.tag === undefined) {
+ endTag = true;
+ tagName = '';
+ } else {
+ endTag = state.tag[0] == "/";
+ tagName = endTag ? state.tag.substring(1) : state.tag;
+ }
var tag = tags[tagName];
if (stream.match(/^\/?}/)) {
var selfClosed = stream.current() == "/}";
@@ -576,12 +583,11 @@
return "keyword";
} else if (match = stream.match(/^<\{/)) {
state.soyState.push("template-call-expression");
- state.tag = "print";
state.indent += 2 * config.indentUnit;
state.soyState.push("tag");
return "keyword";
} else if (match = stream.match(/^<\/>/)) {
- state.indent -= 2 * config.indentUnit;
+ state.indent -= 1 * config.indentUnit;
return "keyword";
}
From e20f9118534ebbb1249a2316639de5ce675523a8 Mon Sep 17 00:00:00 2001
From: Matt Diehl
Date: Tue, 8 Dec 2020 09:50:20 -0700
Subject: [PATCH 207/581] Remove unnecessary line.
---
mode/verilog/verilog.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/mode/verilog/verilog.js b/mode/verilog/verilog.js
index 544045b867..89fe9c1ac8 100644
--- a/mode/verilog/verilog.js
+++ b/mode/verilog/verilog.js
@@ -144,7 +144,6 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
var keywordClose = curKeyword.substr(0,curKeyword.length - 5) + "end";
openClose[cur] = keywordClose;
curPunc = "newblock";
- } else if (cur.startsWith("`uvm_") && cur.endsWith("_end")) {
} else {
stream.eatSpace();
if (stream.peek() == '(') {
From d096a604db350e678c53bce0b2081e0817b84056 Mon Sep 17 00:00:00 2001
From: Elmar Peise
Date: Thu, 10 Dec 2020 13:44:26 +0100
Subject: [PATCH 208/581] [hardwrap addon] Break an inifite loop
This breaks an infinite loop triggered by wrapping a text containing a word longer than the targed width (e.g., a long URL).
---
addon/wrap/hardwrap.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addon/wrap/hardwrap.js b/addon/wrap/hardwrap.js
index bccdc8d14c..516368c80d 100644
--- a/addon/wrap/hardwrap.js
+++ b/addon/wrap/hardwrap.js
@@ -91,7 +91,8 @@
}
while (curLine.length > column) {
var bp = findBreakPoint(curLine, column, wrapOn, killTrailing, forceBreak);
- if (bp.from != bp.to || forceBreak) {
+ if (bp.from != bp.to ||
+ forceBreak && leadingSpace !== curLine.slice(0, bp.to)) {
changes.push({text: ["", leadingSpace],
from: Pos(curNo, bp.from),
to: Pos(curNo, bp.to)});
From 7f3c36619f964d20e20c0ff5bec9cee99dae1549 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Fri, 11 Dec 2020 07:48:40 +0100
Subject: [PATCH 209/581] Fix platform detection for iPadOS Safari
See https://github.com/ProseMirror/prosemirror/issues/1111
---
src/util/browser.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/browser.js b/src/util/browser.js
index 9fc4602c68..6e3022e765 100644
--- a/src/util/browser.js
+++ b/src/util/browser.js
@@ -17,7 +17,7 @@ export let safari = /Apple Computer/.test(navigator.vendor)
export let mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
export let phantom = /PhantomJS/.test(userAgent)
-export let ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
+export let ios = !edge && /AppleWebKit/.test(userAgent) && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2)
export let android = /Android/.test(userAgent)
// This is woefully incomplete. Suggestions for alternative methods welcome.
export let mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
From e4784f6e9c34f4642791ecf622640c81b91f37fa Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 15 Dec 2020 08:28:52 +0100
Subject: [PATCH 210/581] [javascript mode] Allow separator-less object types
Issue #6520
---
mode/javascript/javascript.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js
index 63eaa241b7..188dbf217c 100644
--- a/mode/javascript/javascript.js
+++ b/mode/javascript/javascript.js
@@ -616,13 +616,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "|" || value == "&") return cont(typeexpr)
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
- if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
+ if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType)
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)
if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
}
function maybeReturnType(type) {
if (type == "=>") return cont(typeexpr)
}
+ function typeprops(type) {
+ if (type == "}") return cont()
+ if (type == "," || type == ";") return cont(typeprops)
+ return pass(typeprop, typeprops)
+ }
function typeprop(type, value) {
if (type == "variable" || cx.style == "keyword") {
cx.marked = "property"
From 7faab336a4b644eb4d8ff34d2eb1d96d912f7fa7 Mon Sep 17 00:00:00 2001
From: Kim-Anh Tran
Date: Fri, 18 Dec 2020 05:27:35 +0100
Subject: [PATCH 211/581] [wast mode] Update to reflect latest reference-types
spec
---
mode/wast/test.js | 25 ++++++++++++++++++++++---
mode/wast/wast.js | 4 ++--
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/mode/wast/test.js b/mode/wast/test.js
index 9998cfd965..3e5137c072 100644
--- a/mode/wast/test.js
+++ b/mode/wast/test.js
@@ -21,7 +21,8 @@
'[string "foo #\\"# bar"]');
MT('atom-test',
- '[atom anyfunc]',
+ '[atom funcref]',
+ '[atom externref]',
'[atom i32]',
'[atom i64]',
'[atom f32]',
@@ -42,9 +43,11 @@
'[keyword br_table] [variable-2 $label0] [variable-2 $label1] [variable-2 $label3]',
'[keyword return]',
'[keyword call] [variable-2 $func0]',
- '[keyword call_indirect] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])',
+ '[keyword call_indirect] [variable-2 $table] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])',
'[keyword return_call] [variable-2 $func0]',
- '[keyword return_call_indirect] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])');
+ '[keyword return_call_indirect] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])',
+ '[keyword select] ([keyword local.get] [number 1]) ([keyword local.get] [number 2]) ([keyword local.get] [number 3])');
+
MT('memory-instructions',
'[keyword i32.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
@@ -318,4 +321,20 @@
'[keyword i32x4.trunc_sat_f32x4_u]',
'[keyword f32x4.convert_i32x4_s]',
'[keyword f32x4.convert_i32x4_u]');
+
+ MT('reference-type-instructions',
+ '[keyword ref.null] [keyword extern]',
+ '[keyword ref.null] [keyword func]',
+ '[keyword ref.is_null] ([keyword ref.func] [variable-2 $f])',
+ '[keyword ref.func] [variable-2 $f]');
+
+ MT('table-instructions',
+ '[keyword table.get] [variable-2 $t] ([keyword i32.const] [number 5])',
+ '[keyword table.set] [variable-2 $t] ([keyword i32.const] [number 5]) ([keyword ref.func] [variable-2 $f])',
+ '[keyword table.size] [variable-2 $t]',
+ '[keyword table.grow] [variable-2 $t] ([keyword ref.null] [keyword extern]) ([keyword i32.const] [number 5])',
+ '[keyword table.fill] [variable-2 $t] ([keyword i32.const] [number 5]) ([keyword param] [variable-2 $r] [atom externref]) ([keyword i32.const] [number 5])',
+ '[keyword table.init] [variable-2 $t] [number 1] ([keyword i32.const] [number 5]) ([keyword i32.const] [number 10]) ([keyword i32.const] [number 15])',
+ '[keyword table.copy] [variable-2 $t] [variable-2 $t2] ([keyword i32.const] [number 5]) ([keyword i32.const] [number 10]) ([keyword i32.const] [number 15])'
+ );
})();
diff --git a/mode/wast/wast.js b/mode/wast/wast.js
index 9348ad3e0a..a730d39efc 100644
--- a/mode/wast/wast.js
+++ b/mode/wast/wast.js
@@ -14,8 +14,8 @@
CodeMirror.defineSimpleMode('wast', {
start: [
{regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"},
- {regex: /mut|nop|block|if|then|else|loop|br_if|br_table|br|call(_indirect)?|drop|end|return(_call(_indirect)?)?|local\.(get|set|tee)|global\.(get|set)|i(32|64)\.(store(8|16)|(load(8|16)_[su]))|i64\.(load32_[su]|store32)|[fi](32|64)\.(const|load|store)|f(32|64)\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)|i(32|64)\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)|i64\.extend_[su]_i32|i32\.wrap_i64|i(32|64)\.trunc_f(32|64)_[su]|f(32|64)\.convert_i(32|64)_[su]|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|current_memory|memory(\.((atomic\.(notify|wait(32|64)))|grow|size))?|type|func|param|result|local|global|module|table|start|elem|data|align|offset|import|export|i64\.atomic\.(load32_u|store32|rmw32\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)|i(32|64)\.atomic\.(load((8|16)_u)?|store(8|16)?|rmw(\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))|v128\.(load|store|const|not|andnot|and|or|xor|bitselect)|i(8x16|16x8|32x4|64x2)\.(shl|shr_[su])|i(8x16|16x8)\.(extract_lane_[su]|((add|sub)_saturate_[su])|avgr_u)|(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane|neg|add|sub)|i(8x16|16x8|32x4)\.(eq|ne|([lg][te]_[su])|abs|any_true|all_true|bitmask|((min|max)_[su]))|f(32x4|64x2)\.(eq|ne|[lg][te]|abs|sqrt|mul|div|min|max)|[fi](32x4|64x2)\.extract_lane|v8x16\.(shuffle|swizzle)|i16x8\.(load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su]|mul)|i32x4\.(load16x4_[su]|widen_(low|high)_i16x8_[su]|mul|trunc_sat_f32x4_[su])|i64x2\.(load32x2_[su]|mul)|(v(8x16|16x8|32x4|64x2)\.load_splat)|i8x16\.narrow_i16x8_[su]|f32x4\.convert_i32x4_[su]/, token: "keyword"},
- {regex: /\b(anyfunc|[fi](32|64))\b/, token: "atom"},
+ {regex: /mut|nop|block|if|then|else|loop|br_if|br_table|br|call(_indirect)?|drop|end|return(_call(_indirect)?)?|local\.(get|set|tee)|global\.(get|set)|i(32|64)\.(store(8|16)|(load(8|16)_[su]))|i64\.(load32_[su]|store32)|[fi](32|64)\.(const|load|store)|f(32|64)\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)|i(32|64)\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)|i64\.extend_[su]_i32|i32\.wrap_i64|i(32|64)\.trunc_f(32|64)_[su]|f(32|64)\.convert_i(32|64)_[su]|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|current_memory|memory(\.((atomic\.(notify|wait(32|64)))|grow|size))?|type|\bfunc\b|param|result|local|global|module|start|elem|data|align|offset|import|export|i64\.atomic\.(load32_u|store32|rmw32\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)|i(32|64)\.atomic\.(load((8|16)_u)?|store(8|16)?|rmw(\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))|v128\.(load|store|const|not|andnot|and|or|xor|bitselect)|i(8x16|16x8|32x4|64x2)\.(shl|shr_[su])|i(8x16|16x8)\.(extract_lane_[su]|((add|sub)_saturate_[su])|avgr_u)|(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane|neg|add|sub)|i(8x16|16x8|32x4)\.(eq|ne|([lg][te]_[su])|abs|any_true|all_true|bitmask|((min|max)_[su]))|f(32x4|64x2)\.(eq|ne|[lg][te]|abs|sqrt|mul|div|min|max)|[fi](32x4|64x2)\.extract_lane|v8x16\.(shuffle|swizzle)|i16x8\.(load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su]|mul)|i32x4\.(load16x4_[su]|widen_(low|high)_i16x8_[su]|mul|trunc_sat_f32x4_[su])|i64x2\.(load32x2_[su]|mul)|(v(8x16|16x8|32x4|64x2)\.load_splat)|i8x16\.narrow_i16x8_[su]|f32x4\.convert_i32x4_[su]|ref\.(func|(is_)?null)|\bextern\b|table(\.(size|get|set|size|grow|fill|init|copy))?/, token: "keyword"},
+ {regex: /\b(funcref|externref|[fi](32|64))\b/, token: "atom"},
{regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"},
{regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"},
{regex: /\(;.*?/, token: "comment", next: "comment"},
From abc65fe746384652c36c027ff73b95f17d262378 Mon Sep 17 00:00:00 2001
From: nathanlesage
Date: Thu, 17 Dec 2020 09:15:10 +0100
Subject: [PATCH 212/581] Document singleCursorHeightPerLine option
---
doc/manual.html | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/doc/manual.html b/doc/manual.html
index 89a6328e6d..ad5c275d50 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -512,6 +512,15 @@
Configuration
which causes the cursor to not reach all the way to the bottom
of the line, looks better
+
singleCursorHeightPerLine: boolean
+
Determines if CodeMirror can expect all lines to be of the
+ same height (true, the default) and the cursor-size
+ can therefore be lazily evaluated. In case your editor contains
+ multiple line-sizes, for instance, if addLineClass
+ sets classes which contain line-height-rules, you
+ should consider setting this to false to prevent
+ visual artefacts.
+
resetSelectionOnContextMenu: boolean
Controls whether, when the context menu is opened with a
click outside of the current selection, the cursor is moved to
From ee414661b9099e9c122f40b8408b841801f37ed9 Mon Sep 17 00:00:00 2001
From: Hendrik Erz
Date: Sat, 19 Dec 2020 21:05:56 +0100
Subject: [PATCH 213/581] Update description of singleCursorHeightPerLine
---
doc/manual.html | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/doc/manual.html b/doc/manual.html
index ad5c275d50..06ee3dbf18 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -513,13 +513,13 @@
Configuration
of the line, looks better
singleCursorHeightPerLine: boolean
-
Determines if CodeMirror can expect all lines to be of the
- same height (true, the default) and the cursor-size
- can therefore be lazily evaluated. In case your editor contains
- multiple line-sizes, for instance, if addLineClass
- sets classes which contain line-height-rules, you
- should consider setting this to false to prevent
- visual artefacts.
+
If set to true (the default), CodeMirror will
+ calculate the cursor height from the adjacent characters or
+ text markers. If set to false, the cursor height
+ will be calculated based off the height of all bounding boxes
+ on the current (wrapped) line, keeping the height consistent.
+ This is visible especially if you use text markers that are
+ bigger than the font-size of the characters on the line.
resetSelectionOnContextMenu: boolean
Controls whether, when the context menu is opened with a
From a90d0f8e992b6fa9232c8982a970305096a28164 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Sun, 20 Dec 2020 11:17:22 +0100
Subject: [PATCH 214/581] [manual] Correct documentation for
singleCursorHeightPerLine
Issue #6524
---
doc/manual.html | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/doc/manual.html b/doc/manual.html
index 06ee3dbf18..1086507a91 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -513,13 +513,10 @@
Configuration
of the line, looks better
singleCursorHeightPerLine: boolean
-
If set to true (the default), CodeMirror will
- calculate the cursor height from the adjacent characters or
- text markers. If set to false, the cursor height
- will be calculated based off the height of all bounding boxes
- on the current (wrapped) line, keeping the height consistent.
- This is visible especially if you use text markers that are
- bigger than the font-size of the characters on the line.
+
If set to true (the default), will keep the
+ cursor height constant for an entire line (or wrapped part of a
+ line). When false, the cursor's height is based on
+ the height of the adjacent reference character.
resetSelectionOnContextMenu: boolean
Controls whether, when the context menu is opened with a
From e49f2950e9ca59f437db26a2b43e3cc478fc4761 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Sun, 20 Dec 2020 11:48:25 +0100
Subject: [PATCH 215/581] Mark release 5.59.0
---
AUTHORS | 10 ++++++++++
CHANGELOG.md | 18 ++++++++++++++++++
doc/manual.html | 2 +-
doc/releases.html | 11 +++++++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 33d819ed24..95134fa2d5 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -244,6 +244,7 @@ edoroshenko
edsharp
ekhaled
Elisée
+Elmar Peise
elpnt
Emmanuel Schanzer
Enam Mijbah Noor
@@ -363,6 +364,7 @@ Jacob Lee
Jaimin
Jake Peyser
Jakob Miland
+Jakub T. Jankiewicz
Jakub Vrana
Jakub Vrána
James Campos
@@ -466,6 +468,7 @@ Kevin Muret
Kevin Sawicki
Kevin Ushey
Kier Darby
+Kim-Anh Tran
Klaus Silveira
Koh Zi Han, Cliff
komakino
@@ -547,6 +550,7 @@ Mason Malone
Mateusz Paprocki
Mathias Bynens
mats cronqvist
+Matt Diehl
Matt Gaide
Matthew Bauer
Matthew Beale
@@ -604,6 +608,7 @@ Miraculix87
misfo
mkaminsky11
mloginov
+mlsad3
Moritz Schubotz (physikerwelt)
Moritz Schwörer
Moshe Wajnberg
@@ -614,6 +619,7 @@ Mu-An ✌️ Chiou
Mu-An Chiou
mzabuawala
Narciso Jaramillo
+nathanlesage
Nathan Williams
ndr
Neil Anderson
@@ -692,6 +698,7 @@ Philip Stadermann
Pi Delport
Pierre Gerold
Pieter Ouwerkerk
+Piyush
Pontus Melke
prasanthj
Prasanth J
@@ -699,6 +706,7 @@ Prayag Verma
prendota
Prendota
Qiang Li
+quiddity-wp
Radek Piórkowski
Rahul
Rahul Anand
@@ -759,6 +767,7 @@ Scott Aikin
Scott Feeney
Scott Goodhew
Seb35
+Sebastian Ślepowroński
Sebastian Wilzbach
Sebastian Zaha
Seren D
@@ -779,6 +788,7 @@ Siamak Mokhtari
Siddhartha Gunti
silverwind
Simon Edwards
+Simon Huber
sinkuu
snasa
soliton4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b00dbd80e..9276146f78 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,21 @@
+## 5.59.0 (2020-12-20)
+
+### Bug fixes
+
+Fix platform detection on recent iPadOS.
+
+[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Don't show duplicate messages for a given line.
+
+[clojure mode](https://codemirror.net/mode/clojure/index.html): Fix regexp that matched in exponential time for some inputs.
+
+[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): Improve handling of words that are longer than the line length.
+
+[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Fix leaked event handler on disabling the addon.
+
+### New features
+
+[search addon](https://codemirror.net/demo/search/): Make it possible to configure the search addon to show the dialog at the bottom of the editor.
+
## 5.58.3 (2020-11-19)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 1086507a91..b7ca9a6972 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.58.3
+ version 5.59.0
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 1b4f9a7976..18987f5ea2 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,17 @@
From d2728850abe64849ddd2730dc22536ef1361a90a Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 29 Dec 2020 09:04:32 +0100
Subject: [PATCH 227/581] [javascript mode] Fix infinite loop on some invalid
syntax
Closes #6542
---
mode/javascript/javascript.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js
index cfcd6cb6ed..8191c4d925 100644
--- a/mode/javascript/javascript.js
+++ b/mode/javascript/javascript.js
@@ -640,6 +640,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
} else if (type == "(") {
return pass(functiondecl, typeprop)
+ } else {
+ return cont()
}
}
function typearg(type, value) {
From 4d5da83c1493cf5dec219ecb637adc69e468ea5d Mon Sep 17 00:00:00 2001
From: Yash-Singh1
Date: Mon, 28 Dec 2020 11:28:36 -0800
Subject: [PATCH 228/581] Prefer dot syntax in test
---
test/test.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/test.js b/test/test.js
index 2a5101f4e1..07fa67858f 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1807,8 +1807,8 @@ testCM("atomicMarker", function(cm) {
inclusiveRight: ri
};
- if (ls === true || ls === false) options["selectLeft"] = ls;
- if (rs === true || rs === false) options["selectRight"] = rs;
+ if (ls === true || ls === false) options.selectLeft = ls;
+ if (rs === true || rs === false) options.selectRight = rs;
return cm.markText(Pos(ll, cl), Pos(lr, cr), options);
}
From 863c18904febf364876494ee650ced49c3b08bd9 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 29 Dec 2020 09:27:13 +0100
Subject: [PATCH 229/581] [javascript mode] Make sure type props don't consume
closing braces
---
mode/javascript/javascript.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mode/javascript/javascript.js b/mode/javascript/javascript.js
index 8191c4d925..966ffef063 100644
--- a/mode/javascript/javascript.js
+++ b/mode/javascript/javascript.js
@@ -640,7 +640,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
} else if (type == "(") {
return pass(functiondecl, typeprop)
- } else {
+ } else if (!type.match(/[;\}\)\],]/)) {
return cont()
}
}
From 37d7b2efceb192c94811a13b2b7b3eec4b786608 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Tue, 29 Dec 2020 18:10:02 +0100
Subject: [PATCH 230/581] Fix moving backwards across astral chars
Closes #6544
---
src/edit/methods.js | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/edit/methods.js b/src/edit/methods.js
index a5e2afc39f..eb8f8d28dc 100644
--- a/src/edit/methods.js
+++ b/src/edit/methods.js
@@ -480,9 +480,12 @@ function findPosH(doc, pos, dir, unit, visually) {
let next
if (unit == "codepoint") {
let ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1))
- if (isNaN(ch)) next = null
- else next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),
- -dir)
+ if (isNaN(ch)) {
+ next = null
+ } else {
+ let astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF
+ next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir)
+ }
} else if (visually) {
next = moveVisually(doc.cm, lineObj, pos, dir)
} else {
From 5e25c3ce3026d7be3e98b8653f1aa171333d43ca Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Wed, 30 Dec 2020 09:21:06 +0100
Subject: [PATCH 231/581] [sponsors] Add Execute Program logo
---
index.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/index.html b/index.html
index 849447a578..9631b88366 100644
--- a/index.html
+++ b/index.html
@@ -203,6 +203,7 @@
Sponsors
+
From 1698f003a5cfabfbabad106c69cd214ec4ed996a Mon Sep 17 00:00:00 2001
From: Yash Singh
Date: Thu, 31 Dec 2020 02:09:33 -0800
Subject: [PATCH 232/581] [manual] Add link to demo for jump-to-line
Closes #6539
---
doc/manual.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/manual.html b/doc/manual.html
index b7ca9a6972..00472c5236 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -2405,7 +2405,7 @@
Addons
Accepts linenumber, +/-linenumber, line:char,
scroll% and :linenumber formats.
This will make use of openDialog
- when available to make prompting for line number neater.
+ when available to make prompting for line number neater. Demo avaliable here.
Adds a showMatchesOnScrollbar method to editor
From bd37a96d362b8d92895d3960d569168ec39e4165 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke
Date: Thu, 31 Dec 2020 13:02:29 +0100
Subject: [PATCH 233/581] Mark version 5.59.1
---
AUTHORS | 4 ++++
CHANGELOG.md | 6 ++++++
doc/manual.html | 2 +-
doc/releases.html | 6 ++++++
index.html | 2 +-
package.json | 2 +-
src/edit/main.js | 2 +-
7 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 95134fa2d5..4ea87576d3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -432,6 +432,7 @@ Jon Malmaud
Jon Sangster
Joo
Joost-Wim Boekesteijn
+José dBruxelles
Joseph Pecoraro
Josh Barnes
Josh Cohen
@@ -546,6 +547,7 @@ Martin Hasoň
Martin Hunt
Martin Laine
Martin Zagora
+Masahiro MATAYOSHI
Mason Malone
Mateusz Paprocki
Mathias Bynens
@@ -894,6 +896,8 @@ wonderboyjon
Wu Cheng-Han
Xavier Mendez
Yang Guo
+Yash Singh
+Yash-Singh1
Yassin N. Hassan
YNH Webdev
yoongu
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1ffa87816..5a9baf4df1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 5.59.1 (2020-12-31)
+
+### Bug fixes
+
+Fix an issue where some Chrome browsers were detected as iOS.
+
## 5.59.0 (2020-12-20)
### Bug fixes
diff --git a/doc/manual.html b/doc/manual.html
index 00472c5236..285d420d9a 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -70,7 +70,7 @@
User manual and reference guide
- version 5.59.0
+ version 5.59.1
CodeMirror is a code-editor component that can be embedded in
diff --git a/doc/releases.html b/doc/releases.html
index 18987f5ea2..f6628b6548 100644
--- a/doc/releases.html
+++ b/doc/releases.html
@@ -30,6 +30,12 @@
*/
CodeMirror.defineSimpleMode("simplemode", {
- // The start state contains the rules that are intially used
+ // The start state contains the rules that are initially used
start: [
// The regex matches the token, the token property contains the type
{regex: /"(?:[^\\]|\\.)*?(?:"|$)/, token: "string"},
diff --git a/doc/internals.html b/doc/internals.html
index 2137c937f2..893604e936 100644
--- a/doc/internals.html
+++ b/doc/internals.html
@@ -293,7 +293,7 @@
Intelligent Updating
Parsers can be Simple
When I wrote CodeMirror 1, I
-thought interruptable
+thought interruptible
parsers were a hugely scary and complicated thing, and I used a
bunch of heavyweight abstractions to keep this supposed complexity
under control: parsers
diff --git a/doc/manual.html b/doc/manual.html
index 285d420d9a..7aade3df15 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -2405,7 +2405,7 @@
Addons
Accepts linenumber, +/-linenumber, line:char,
scroll% and :linenumber formats.
This will make use of openDialog
- when available to make prompting for line number neater. Demo avaliable here.
+ when available to make prompting for line number neater. Demo available here.
Adds a showMatchesOnScrollbar method to editor
@@ -2721,7 +2721,7 @@
Addons
the "hint" type to find applicable hinting
functions, and tries them one by one. If that fails, it looks
for a "hintWords" helper to fetch a list of
- completable words for the mode, and
+ completeable words for the mode, and
uses CodeMirror.hint.fromList to complete from
those.
When completions aren't simple strings, they should be
@@ -3683,13 +3683,13 @@
Extending VIM
getRegisterController()
Returns the RegisterController that manages the state of registers
used by vim mode. For the RegisterController api see its
- defintion here.
+ definition here.
buildKeyMap()
Not currently implemented. If you would like to contribute this please open
- a pull request on Github.
+ a pull request on GitHub.
and indent it less when shift is held ("indentLess").
There are also "indentAuto" (smart indent)
and "insertTab" commands provided for alternate
-behaviors. Or you can write your own handler function to do something
+behavior. Or you can write your own handler function to do something
different altogether.
END_FUZZIFY
DEFUZZIFY ProbabilityAccess
- TERM hight := 1;
+ TERM height := 1;
TERM medium := 0.5;
TERM low := 0;
ACCU: MAX;
@@ -70,7 +70,7 @@
FCL mode
END_DEFUZZIFY
DEFUZZIFY ProbabilityDistribution
- TERM hight := 1;
+ TERM height := 1;
TERM medium := 0.5;
TERM low := 0;
ACCU: MAX;
@@ -80,14 +80,14 @@
FCL mode
RULEBLOCK No1
AND : MIN;
- RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS hight;
- RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS hight;
+ RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS height;
+ RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS height;
RULE 3 : IF TimeDay IS inside AND ApplicateHost IS few THEN ProbabilityAccess IS low;
END_RULEBLOCK
RULEBLOCK No2
AND : MIN;
- RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS hight;
+ RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS height;
END_RULEBLOCK
END_FUNCTION_BLOCK
diff --git a/mode/forth/index.html b/mode/forth/index.html
index c6f0b5c5c8..6b6477cae7 100644
--- a/mode/forth/index.html
+++ b/mode/forth/index.html
@@ -68,7 +68,7 @@
diff --git a/mode/idl/idl.js b/mode/idl/idl.js
index 168761cd88..37302bb90f 100644
--- a/mode/idl/idl.js
+++ b/mode/idl/idl.js
@@ -62,7 +62,7 @@
'empty', 'enable_sysrtn', 'eof', 'eos', 'erase',
'erf', 'erfc', 'erfcx', 'erode', 'errorplot',
'errplot', 'estimator_filter', 'execute', 'exit', 'exp',
- 'expand', 'expand_path', 'expint', 'extrac', 'extract_slice',
+ 'expand', 'expand_path', 'expint', 'extract', 'extract_slice',
'f_cvf', 'f_pdf', 'factorial', 'fft', 'file_basename',
'file_chmod', 'file_copy', 'file_delete', 'file_dirname',
'file_expand_path', 'file_gunzip', 'file_gzip', 'file_info',
diff --git a/mode/javascript/test.js b/mode/javascript/test.js
index ffff05f513..26a81ffc8d 100644
--- a/mode/javascript/test.js
+++ b/mode/javascript/test.js
@@ -252,7 +252,7 @@
MT("async_object",
"[keyword let] [def obj] [operator =] { [property async]: [atom false] };");
- // async be highlighet as keyword and foo as def, but it requires potentially expensive look-ahead. See #4173
+ // async be highlighted as keyword and foo as def, but it requires potentially expensive look-ahead. See #4173
MT("async_object_function",
"[keyword let] [def obj] [operator =] { [property async] [property foo]([def args]) { [keyword return] [atom true]; } };");
diff --git a/mode/markdown/index.html b/mode/markdown/index.html
index da3fe61b98..4984c04b2c 100644
--- a/mode/markdown/index.html
+++ b/mode/markdown/index.html
@@ -159,7 +159,7 @@
Markdown mode
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
`+`, and `-`) as list markers. These three markers are
-interchangable; this:
+interchangeable; this:
* Candy.
* Gum.
@@ -306,7 +306,7 @@
Markdown mode
I strongly recommend against using any `<blink>` tags.
I wish SmartyPants used named entities like `—`
- instead of decimal-encoded entites like `—`.
+ instead of decimal-encoded entities like `—`.
Output:
@@ -315,7 +315,7 @@
Markdown mode
<p>I wish SmartyPants used named entities like
<code>&mdash;</code> instead of decimal-encoded
- entites like <code>&#8212;</code>.</p>
+ entities like <code>&#8212;</code>.</p>
To specify an entire block of pre-formatted code, indent every line of
@@ -360,7 +360,7 @@
Optionally depends on other modes for properly highlighted code blocks,
and XML mode for properly highlighted inline XML blocks.
@@ -370,7 +370,7 @@
Markdown mode
highlightFormatting: boolean
-
Whether to separately highlight markdown meta characterts (*[]()etc.) (default: false).
+
Whether to separately highlight markdown meta characters (*[]()etc.) (default: false).
diff --git a/mode/markdown/markdown.js b/mode/markdown/markdown.js
index 287f39b55d..aee76c43ac 100644
--- a/mode/markdown/markdown.js
+++ b/mode/markdown/markdown.js
@@ -223,7 +223,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
// Add this list item's content's indentation to the stack
state.listStack.push(state.indentation);
- // Reset inline styles which shouldn't propagate aross list items
+ // Reset inline styles which shouldn't propagate across list items
state.em = false;
state.strong = false;
state.code = false;
diff --git a/mode/markdown/test.js b/mode/markdown/test.js
index 929e7bba19..fd5a1fb4d5 100644
--- a/mode/markdown/test.js
+++ b/mode/markdown/test.js
@@ -315,7 +315,7 @@
"[header&header-2 bar]",
"[header&header-2 ---]");
- MT("setextAferATX",
+ MT("setextAfterATX",
"[header&header-1 # foo]",
"[header&header-2 bar]",
"[header&header-2 ---]");
@@ -659,7 +659,7 @@
" [variable-2 text after fenced code]");
// should correctly parse numbered list content indentation
- MT("listCommonMark_NumeberedListIndent",
+ MT("listCommonMark_NumberedListIndent",
"[variable-2 1000. list with base indent of 6]",
"",
" [variable-2 text must be indented 6 spaces at minimum]",
diff --git a/mode/meta.js b/mode/meta.js
index c7738a514c..92b68074ca 100644
--- a/mode/meta.js
+++ b/mode/meta.js
@@ -44,7 +44,7 @@
{name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
{name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
{name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
- {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
+ {name: "Embedded JavaScript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
{name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
{name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
{name: "Esper", mime: "text/x-esper", mode: "sql"},
diff --git a/mode/modelica/modelica.js b/mode/modelica/modelica.js
index a83a4135d0..2e9622f03f 100644
--- a/mode/modelica/modelica.js
+++ b/mode/modelica/modelica.js
@@ -90,7 +90,7 @@
return "error";
}
- function tokenUnsignedNuber(stream, state) {
+ function tokenUnsignedNumber(stream, state) {
stream.eatWhile(isDigit);
if (stream.eat('.')) {
stream.eatWhile(isDigit);
@@ -164,9 +164,9 @@
else if(ch == '"') {
state.tokenize = tokenString;
}
- // UNSIGNED_NUBER
+ // UNSIGNED_NUMBER
else if(isDigit.test(ch)) {
- state.tokenize = tokenUnsignedNuber;
+ state.tokenize = tokenUnsignedNumber;
}
// ERROR
else {
diff --git a/mode/mumps/mumps.js b/mode/mumps/mumps.js
index 3671c9cb36..c53b4bf3a2 100644
--- a/mode/mumps/mumps.js
+++ b/mode/mumps/mumps.js
@@ -26,7 +26,7 @@
var brackets = new RegExp("[()]");
var identifiers = new RegExp("^[%A-Za-z][A-Za-z0-9]*");
var commandKeywords = ["break","close","do","else","for","goto", "halt", "hang", "if", "job","kill","lock","merge","new","open", "quit", "read", "set", "tcommit", "trollback", "tstart", "use", "view", "write", "xecute", "b","c","d","e","f","g", "h", "i", "j","k","l","m","n","o", "q", "r", "s", "tc", "tro", "ts", "u", "v", "w", "x"];
- // The following list includes instrinsic functions _and_ special variables
+ // The following list includes intrinsic functions _and_ special variables
var intrinsicFuncsWords = ["\\$ascii", "\\$char", "\\$data", "\\$ecode", "\\$estack", "\\$etrap", "\\$extract", "\\$find", "\\$fnumber", "\\$get", "\\$horolog", "\\$io", "\\$increment", "\\$job", "\\$justify", "\\$length", "\\$name", "\\$next", "\\$order", "\\$piece", "\\$qlength", "\\$qsubscript", "\\$query", "\\$quit", "\\$random", "\\$reverse", "\\$select", "\\$stack", "\\$test", "\\$text", "\\$translate", "\\$view", "\\$x", "\\$y", "\\$a", "\\$c", "\\$d", "\\$e", "\\$ec", "\\$es", "\\$et", "\\$f", "\\$fn", "\\$g", "\\$h", "\\$i", "\\$j", "\\$l", "\\$n", "\\$na", "\\$o", "\\$p", "\\$q", "\\$ql", "\\$qs", "\\$r", "\\$re", "\\$s", "\\$st", "\\$t", "\\$tr", "\\$v", "\\$z"];
var intrinsicFuncs = wordRegexp(intrinsicFuncsWords);
var command = wordRegexp(commandKeywords);
diff --git a/mode/nginx/index.html b/mode/nginx/index.html
index 5c2bc6e2cf..1aa690a6d4 100644
--- a/mode/nginx/index.html
+++ b/mode/nginx/index.html
@@ -62,7 +62,7 @@
NGINX mode
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
- expires 30d; ## Assume all files are cachable
+ expires 30d; ## Assume all files are cacheable
}
## These locations would be hidden by .htaccess normally
@@ -128,7 +128,7 @@
NGINX mode
location / {
index index.html index.php; ## Allow a static html file to be shown first
try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
- expires 30d; ## Assume all files are cachable
+ expires 30d; ## Assume all files are cacheable
}
## These locations would be hidden by .htaccess normally
diff --git a/mode/ntriples/index.html b/mode/ntriples/index.html
index 5473dbffc0..275cf08b49 100644
--- a/mode/ntriples/index.html
+++ b/mode/ntriples/index.html
@@ -58,7 +58,7 @@
"literal 1" .
_:bnode3 .
_:bnode4 "literal 2"@lang .
- # if a graph labe
+ # if a graph label
_:bnode5 "literal 3"^^ .
diff --git a/mode/oz/oz.js b/mode/oz/oz.js
index a9738495b6..63ad806abc 100644
--- a/mode/oz/oz.js
+++ b/mode/oz/oz.js
@@ -130,7 +130,7 @@ CodeMirror.defineMode("oz", function (conf) {
return "operator";
}
- // If nothing match, we skip the entire alphanumerical block
+ // If nothing match, we skip the entire alphanumeric block
stream.eatWhile(/\w/);
return "variable";
diff --git a/mode/perl/perl.js b/mode/perl/perl.js
index 220b0a6994..ffe7877af1 100644
--- a/mode/perl/perl.js
+++ b/mode/perl/perl.js
@@ -347,7 +347,7 @@ CodeMirror.defineMode("perl",function(){
lc :1, // - return lower-case version of a string
lcfirst :1, // - return a string with just the next letter in lower case
length :1, // - return the number of bytes in a string
- 'link' :1, // - create a hard link in the filesytem
+ 'link' :1, // - create a hard link in the filesystem
listen :1, // - register your socket as a server
local : 2, // - create a temporary value for a global variable (dynamic scoping)
localtime :1, // - convert UNIX time into record or string using local time
@@ -441,7 +441,7 @@ CodeMirror.defineMode("perl",function(){
state :1, // - declare and assign a state variable (persistent lexical scoping)
study :1, // - optimize input data for repeated searches
'sub' :1, // - declare a subroutine, possibly anonymously
- 'substr' :1, // - get or alter a portion of a stirng
+ 'substr' :1, // - get or alter a portion of a string
symlink :1, // - create a symbolic link to a file
syscall :1, // - execute an arbitrary system call
sysopen :1, // - open a file, pipe, or descriptor
diff --git a/mode/python/index.html b/mode/python/index.html
index bdfc8f574c..78a3a14641 100644
--- a/mode/python/index.html
+++ b/mode/python/index.html
@@ -190,7 +190,7 @@
Configuration Options for Python mode:
hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much that line should be indented. Defaults to one normal indentation unit.
Advanced Configuration Options:
-
Usefull for superset of python syntax like Enthought enaml, IPython magics and questionmark help
+
Useful for superset of python syntax like Enthought enaml, IPython magics and questionmark help
singleOperators - RegEx - Regular Expression for single operator matching, default :
^[\\+\\-\\*/%&|\\^~<>!]
including
@
on Python 3
singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :
^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]
diff --git a/mode/python/test.js b/mode/python/test.js
index 2b605b8e62..39b80cf70a 100644
--- a/mode/python/test.js
+++ b/mode/python/test.js
@@ -31,7 +31,7 @@
}
MT("fValidStringPrefix", "[string f'this is a]{[variable formatted]}[string string']");
- MT("fValidExpressioninFString", "[string f'expression ]{[number 100][operator *][number 5]}[string string']");
+ MT("fValidExpressionInFString", "[string f'expression ]{[number 100][operator *][number 5]}[string string']");
MT("fInvalidFString", "[error f'this is wrong}]");
MT("fNestedFString", "[string f'expression ]{[number 100] [operator +] [string f'inner]{[number 5]}[string ']}[string string']");
MT("uValidStringPrefix", "[string u'this is an unicode string']");
diff --git a/mode/rpm/rpm.js b/mode/rpm/rpm.js
index 2dece2eabd..88a7e889ed 100644
--- a/mode/rpm/rpm.js
+++ b/mode/rpm/rpm.js
@@ -12,14 +12,14 @@
"use strict";
CodeMirror.defineMode("rpm-changes", function() {
- var headerSeperator = /^-+$/;
+ var headerSeparator = /^-+$/;
var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
var simpleEmail = /^[\w+.-]+@[\w.-]+/;
return {
token: function(stream) {
if (stream.sol()) {
- if (stream.match(headerSeperator)) { return 'tag'; }
+ if (stream.match(headerSeparator)) { return 'tag'; }
if (stream.match(headerLine)) { return 'tag'; }
}
if (stream.match(simpleEmail)) { return 'string'; }
diff --git a/mode/ruby/index.html b/mode/ruby/index.html
index 55fe6c5892..daebdca291 100644
--- a/mode/ruby/index.html
+++ b/mode/ruby/index.html
@@ -34,7 +34,7 @@
Ruby mode
# This program evaluates polynomials. It first asks for the coefficients
# of a polynomial, which must be entered on one line, highest-order first.
# It then requests values of x and will compute the value of the poly for
-# each x. It will repeatly ask for x values, unless you the user enters
+# each x. It will repeatedly ask for x values, unless you the user enters
# a blank line. It that case, it will ask for another polynomial. If the
# user types quit for either input, the program immediately exits.
#
diff --git a/mode/scheme/scheme.js b/mode/scheme/scheme.js
index efac89078b..370250d856 100644
--- a/mode/scheme/scheme.js
+++ b/mode/scheme/scheme.js
@@ -170,7 +170,7 @@ CodeMirror.defineMode("scheme", function () {
} else if (stream.match(/^[-+0-9.]/, false)) {
hasRadix = false;
numTest = isDecimalNumber;
- // re-consume the intial # if all matches failed
+ // re-consume the initial # if all matches failed
} else if (!hasExactness) {
stream.eat('#');
}
diff --git a/mode/sieve/sieve.js b/mode/sieve/sieve.js
index f02a867e7a..b7236401a7 100644
--- a/mode/sieve/sieve.js
+++ b/mode/sieve/sieve.js
@@ -43,7 +43,7 @@ CodeMirror.defineMode("sieve", function(config) {
if (ch == "(") {
state._indent.push("(");
// add virtual angel wings so that editor behaves...
- // ...more sane incase of broken brackets
+ // ...more sane in case of broken brackets
state._indent.push("{");
return null;
}
diff --git a/mode/sql/sql.js b/mode/sql/sql.js
index 4127cd9a05..dcde1a771c 100644
--- a/mode/sql/sql.js
+++ b/mode/sql/sql.js
@@ -370,7 +370,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
"$": hookVar,
// The preferred way to escape Identifiers is using double quotes, ref: http://sqlite.org/lang_keywords.html
"\"": hookIdentifierDoublequote,
- // there is also support for backtics, ref: http://sqlite.org/lang_keywords.html
+ // there is also support for backticks, ref: http://sqlite.org/lang_keywords.html
"`": hookIdentifier
}
});
@@ -451,7 +451,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) {
// Spark SQL
CodeMirror.defineMIME("text/x-sparksql", {
name: "sql",
- keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases datata dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),
+ keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),
builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),
atoms: set("false true null"),
operatorChars: /^[*\/+\-%<>!=~&|^]/,
diff --git a/mode/vbscript/vbscript.js b/mode/vbscript/vbscript.js
index 0670c0ceef..4033948133 100644
--- a/mode/vbscript/vbscript.js
+++ b/mode/vbscript/vbscript.js
@@ -32,7 +32,7 @@ CodeMirror.defineMode("vbscript", function(conf, parserConf) {
var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]");
var doubleOperators = new RegExp("^((<>)|(<=)|(>=))");
var singleDelimiters = new RegExp('^[\\.,]');
- var brakets = new RegExp('^[\\(\\)]');
+ var brackets = new RegExp('^[\\(\\)]');
var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*");
var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for'];
@@ -183,7 +183,7 @@ CodeMirror.defineMode("vbscript", function(conf, parserConf) {
return null;
}
- if (stream.match(brakets)) {
+ if (stream.match(brackets)) {
return "bracket";
}
diff --git a/mode/velocity/velocity.js b/mode/velocity/velocity.js
index 56caa671b3..1d17c84ebe 100644
--- a/mode/velocity/velocity.js
+++ b/mode/velocity/velocity.js
@@ -48,7 +48,7 @@ CodeMirror.defineMode("velocity", function() {
else if (state.inParams)
return chain(stream, state, tokenString(ch));
}
- // is it one of the special signs []{}().,;? Seperator?
+ // is it one of the special signs []{}().,;? Separator?
else if (/[\[\]{}\(\),;\.]/.test(ch)) {
if (ch == "(" && beforeParams)
state.inParams = true;
diff --git a/mode/verilog/verilog.js b/mode/verilog/verilog.js
index 89fe9c1ac8..6c799f298b 100644
--- a/mode/verilog/verilog.js
+++ b/mode/verilog/verilog.js
@@ -542,7 +542,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
};
var tlvIndentUnit = 3;
var tlvTrackStatements = false;
- var tlvIdentMatch = /^([~!@#\$%\^&\*-\+=\?\/\\\|'"<>]+)([\d\w_]*)/; // Matches an identifiere.
+ var tlvIdentMatch = /^([~!@#\$%\^&\*-\+=\?\/\\\|'"<>]+)([\d\w_]*)/; // Matches an identifier.
// Note that ':' is excluded, because of it's use in [:].
var tlvFirstLevelIndentMatch = /^[! ] /;
var tlvLineIndentationMatch = /^[! ] */;
@@ -719,7 +719,7 @@ CodeMirror.defineMode("verilog", function(config, parserConfig) {
} else {
// Just swallow one character and try again.
// This enables subsequent identifier match with preceding symbol character, which
- // is legal within a statement. (Eg, !$reset). It also enables detection of
+ // is legal within a statement. (E.g., !$reset). It also enables detection of
// comment start with preceding symbols.
stream.backUp(stream.current().length - 1);
style = "tlv-default";
diff --git a/mode/vue/index.html b/mode/vue/index.html
index df519a5cb7..78b4784840 100644
--- a/mode/vue/index.html
+++ b/mode/vue/index.html
@@ -38,7 +38,7 @@