Compare commits

...

32 Commits

Author SHA1 Message Date
zadam
e22af42cd0 release 0.56.0-beta 2022-10-15 12:49:56 +02:00
zadam
70c9292413 codemirror 5.65.9 2022-10-15 12:22:09 +02:00
zadam
b9c22fcbc8 Merge remote-tracking branch 'origin/master' 2022-10-15 12:03:13 +02:00
zadam
4012ec7498 Merge branch 'stable'
# Conflicts:
#	src/public/app/widgets/attribute_widgets/attribute_detail.js
2022-10-15 12:03:03 +02:00
zadam
7d6d466284 Merge pull request #3199 from DaiYuANg/master
update pwa manifest support deploy in sub folder
2022-10-15 12:00:41 +02:00
DaiYuANg
36842f4a58 update pwa manifest support deploy in sub folder 2022-10-15 13:01:48 +08:00
zadam
dc62cf4805 ckeditor 35.2.1 2022-10-14 22:39:28 +02:00
zadam
ed8acc7ee3 switch-server, switch-electron npm scripts to ease rebuilding better-sqlite3 2022-10-14 21:59:43 +02:00
zadam
4116fe0a20 fix propagation of noteTypeMimeChanged event to global scope to fix e.g. edit button switching depending on note type 2022-10-14 20:36:40 +02:00
zadam
a4e99662cb edit button should get refreshed based on type change 2022-10-13 23:52:53 +02:00
zadam
c6d4eb486e fix toc with > 10 items on the same level, closes #3182 2022-10-09 22:20:11 +02:00
zadam
c2308b7a5d fix comment 2022-10-09 21:34:01 +02:00
zadam
3e07c08043 basic auth etapi should require "etapi" username 2022-10-09 21:33:32 +02:00
zadam
5a3c50d9fb extra null relation checks in notemap 2022-10-08 22:24:58 +02:00
zadam
3e4a9f63fa support basic auth in ETAPI 2022-10-08 20:59:11 +02:00
zadam
6d4ef4ee3d improved error handling of wrong port configuration, #3177 2022-10-01 15:32:30 +02:00
zadam
20ff5627d8 ckeditor 35.1.0 2022-09-28 22:55:53 +02:00
zadam
1d26fd6bf0 added "note color" 2022-09-25 14:19:30 +02:00
zadam
a9c0daa51a FIXME comment on virtual branches 2022-09-24 23:03:38 +02:00
zadam
e3b2bbdca5 Merge remote-tracking branch 'origin/master' 2022-09-24 22:38:27 +02:00
zadam
d905f7cc26 include icon into reference links 2022-09-24 22:38:20 +02:00
zadam
fe3f24cdb0 Merge pull request #3161 from oc013/docker-compose-example
Update docker-compose sample to use node user home dir and pull directly from docker hub
2022-09-24 13:14:28 +02:00
oc013
971c709e87 Update docker-compose sample to use node user home dir 2022-09-23 21:12:50 -04:00
zadam
7f78937543 keyboardShortcut attr detail help 2022-09-23 22:51:17 +02:00
zadam
41dac2bd1b keyboardShortcut attr detail help 2022-09-23 22:50:49 +02:00
zadam
85bf2a5706 fix hidden backlinks, closes #3158 2022-09-22 23:29:20 +02:00
zadam
ce7937a3a3 Merge remote-tracking branch 'origin/master' 2022-09-22 22:53:29 +02:00
zadam
7bb9d33245 0 offset of context menu, fixes #3157 2022-09-22 22:53:22 +02:00
zadam
1be89c094b Merge pull request #3153 from charlesdagenais/master
improve "open" button behaviour for files when in browser
2022-09-22 22:48:33 +02:00
Charles Dagenais
73ad557784 improve "open" button behaviour for files when in browser 2022-09-21 21:56:59 -04:00
zadam
9f744153e3 fix TODO script example 2022-09-22 00:00:32 +02:00
zadam
0c196ae3a5 fix deleting / erasing note 2022-09-21 23:58:54 +02:00
175 changed files with 2382 additions and 3220 deletions

Binary file not shown.

View File

@@ -1,17 +1,14 @@
version: '2.1' version: '2.1'
services: services:
trilium: trilium:
build:
context: .
image: zadam/trilium image: zadam/trilium
restart: always restart: always
environment: environment:
- TRILIUM_DATA_DIR=/data - TRILIUM_DATA_DIR=/home/node/trilium-data
ports: ports:
- "8080:8080" - "8080:8080"
volumes: volumes:
- trilium:/data - trilium:/home/node/trilium-data
volumes: volumes:
trilium: trilium:

View File

@@ -5,9 +5,9 @@
} }
/* /*
* CKEditor 5 (v33.0.0) content styles. * CKEditor 5 (v35.2.1) content styles.
* Generated on Fri, 11 Mar 2022 14:34:26 GMT. * Generated on Fri, 14 Oct 2022 09:47:42 GMT.
* For more information, check out https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/content-styles.html * For more information, check out https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/content-styles.html
*/ */
:root { :root {
@@ -34,6 +34,21 @@
padding: .15em; padding: .15em;
border-radius: 2px; border-radius: 2px;
} }
/* ckeditor5-block-quote/theme/blockquote.css */
.ck-content blockquote {
overflow: hidden;
padding-right: 1.5em;
padding-left: 1.5em;
margin-left: 0;
margin-right: 0;
font-style: italic;
border-left: solid 5px hsl(0, 0%, 80%);
}
/* ckeditor5-block-quote/theme/blockquote.css */
.ck-content[dir="rtl"] blockquote {
border-left: 0;
border-right: solid 5px hsl(0, 0%, 80%);
}
/* ckeditor5-font/theme/fontsize.css */ /* ckeditor5-font/theme/fontsize.css */
.ck-content .text-tiny { .ck-content .text-tiny {
font-size: .7em; font-size: .7em;
@@ -50,21 +65,6 @@
.ck-content .text-huge { .ck-content .text-huge {
font-size: 1.8em; font-size: 1.8em;
} }
/* ckeditor5-block-quote/theme/blockquote.css */
.ck-content blockquote {
overflow: hidden;
padding-right: 1.5em;
padding-left: 1.5em;
margin-left: 0;
margin-right: 0;
font-style: italic;
border-left: solid 5px hsl(0, 0%, 80%);
}
/* ckeditor5-block-quote/theme/blockquote.css */
.ck-content[dir="rtl"] blockquote {
border-left: 0;
border-right: solid 5px hsl(0, 0%, 80%);
}
/* ckeditor5-highlight/theme/highlight.css */ /* ckeditor5-highlight/theme/highlight.css */
.ck-content .marker-yellow { .ck-content .marker-yellow {
background-color: var(--ck-highlight-marker-yellow); background-color: var(--ck-highlight-marker-yellow);
@@ -139,6 +139,20 @@
font-size: .75em; font-size: .75em;
outline-offset: -1px; outline-offset: -1px;
} }
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized {
max-width: 100%;
display: block;
box-sizing: border-box;
}
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized img {
width: 100%;
}
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized > figcaption {
display: block;
}
/* ckeditor5-image/theme/imagestyle.css */ /* ckeditor5-image/theme/imagestyle.css */
.ck-content .image-style-block-align-left, .ck-content .image-style-block-align-left,
.ck-content .image-style-block-align-right { .ck-content .image-style-block-align-right {
@@ -200,20 +214,6 @@
.ck-content .image-inline.image-style-align-right { .ck-content .image-inline.image-style-align-right {
margin-left: var(--ck-inline-image-style-spacing); margin-left: var(--ck-inline-image-style-spacing);
} }
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized {
max-width: 100%;
display: block;
box-sizing: border-box;
}
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized img {
width: 100%;
}
/* ckeditor5-image/theme/imageresize.css */
.ck-content .image.image_resized > figcaption {
display: block;
}
/* ckeditor5-language/theme/language.css */ /* ckeditor5-language/theme/language.css */
.ck-content span[lang] { .ck-content span[lang] {
font-style: italic; font-style: italic;
@@ -328,6 +328,18 @@
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
/* ckeditor5-table/theme/tablecaption.css */
.ck-content .table > figcaption {
display: table-caption;
caption-side: top;
word-break: break-word;
text-align: center;
color: var(--ck-color-table-caption-text);
background-color: var(--ck-color-table-caption-background);
padding: .6em;
font-size: .75em;
outline-offset: -1px;
}
/* ckeditor5-table/theme/table.css */ /* ckeditor5-table/theme/table.css */
.ck-content .table { .ck-content .table {
margin: 0.9em auto; margin: 0.9em auto;
@@ -361,17 +373,18 @@
.ck-content[dir="ltr"] .table th { .ck-content[dir="ltr"] .table th {
text-align: left; text-align: left;
} }
/* ckeditor5-table/theme/tablecaption.css */ /* ckeditor5-table/theme/tablecolumnresize.css */
.ck-content .table > figcaption { .ck-content .table .ck-table-resized {
display: table-caption; table-layout: fixed;
caption-side: top; }
word-break: break-word; /* ckeditor5-table/theme/tablecolumnresize.css */
text-align: center; .ck-content .table table {
color: var(--ck-color-table-caption-text); overflow: hidden;
background-color: var(--ck-color-table-caption-background); }
padding: .6em; /* ckeditor5-table/theme/tablecolumnresize.css */
font-size: .75em; .ck-content .table td,
outline-offset: -1px; .ck-content .table th {
position: relative;
} }
/* ckeditor5-code-block/theme/codeblock.css */ /* ckeditor5-code-block/theme/codeblock.css */
.ck-content pre { .ck-content pre {
@@ -400,6 +413,42 @@
background: hsl(0, 0%, 87%); background: hsl(0, 0%, 87%);
border: 0; border: 0;
} }
/* ckeditor5-list/theme/liststyles.css */
.ck-content ol {
list-style-type: decimal;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ol ol {
list-style-type: lower-latin;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ol ol ol {
list-style-type: lower-roman;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ol ol ol ol {
list-style-type: upper-latin;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ol ol ol ol ol {
list-style-type: upper-roman;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ul {
list-style-type: circle;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ul ul {
list-style-type: disc;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ul ul ul {
list-style-type: square;
}
/* ckeditor5-list/theme/liststyles.css */
.ck-content ul ul ul ul {
list-style-type: square;
}
/* ckeditor5-mention/theme/mention.css */ /* ckeditor5-mention/theme/mention.css */
.ck-content .mention { .ck-content .mention {
background: var(--ck-color-mention-background); background: var(--ck-color-mention-background);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -69,3 +69,11 @@
background-position: right bottom; background-position: right bottom;
width: 100%; height: 100%; width: 100%; height: 100%;
} }
.CodeMirror-lint-line-error {
background-color: rgba(183, 76, 81, 0.08);
}
.CodeMirror-lint-line-warning {
background-color: rgba(255, 211, 0, 0.1);
}

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -11,6 +11,7 @@
})(function(CodeMirror) { })(function(CodeMirror) {
"use strict"; "use strict";
var GUTTER_ID = "CodeMirror-lint-markers"; var GUTTER_ID = "CodeMirror-lint-markers";
var LINT_LINE_ID = "CodeMirror-lint-line-";
function showTooltip(cm, e, content) { function showTooltip(cm, e, content) {
var tt = document.createElement("div"); var tt = document.createElement("div");
@@ -58,29 +59,54 @@
CodeMirror.on(node, "mouseout", hide); CodeMirror.on(node, "mouseout", hide);
} }
function LintState(cm, options, hasGutter) { function LintState(cm, conf, hasGutter) {
this.marked = []; this.marked = [];
this.options = options; if (conf instanceof Function) conf = {getAnnotations: conf};
if (!conf || conf === true) conf = {};
this.options = {};
this.linterOptions = conf.options || {};
for (var prop in defaults) this.options[prop] = defaults[prop];
for (var prop in conf) {
if (defaults.hasOwnProperty(prop)) {
if (conf[prop] != null) this.options[prop] = conf[prop];
} else if (!conf.options) {
this.linterOptions[prop] = conf[prop];
}
}
this.timeout = null; this.timeout = null;
this.hasGutter = hasGutter; this.hasGutter = hasGutter;
this.onMouseOver = function(e) { onMouseOver(cm, e); }; this.onMouseOver = function(e) { onMouseOver(cm, e); };
this.waitingFor = 0 this.waitingFor = 0
} }
function parseOptions(_cm, options) { var defaults = {
if (options instanceof Function) return {getAnnotations: options}; highlightLines: false,
if (!options || options === true) options = {}; tooltips: true,
return options; delay: 500,
lintOnChange: true,
getAnnotations: null,
async: false,
selfContain: null,
formatAnnotation: null,
onUpdateLinting: null
} }
function clearMarks(cm) { function clearMarks(cm) {
var state = cm.state.lint; var state = cm.state.lint;
if (state.hasGutter) cm.clearGutter(GUTTER_ID); if (state.hasGutter) cm.clearGutter(GUTTER_ID);
if (state.options.highlightLines) clearErrorLines(cm);
for (var i = 0; i < state.marked.length; ++i) for (var i = 0; i < state.marked.length; ++i)
state.marked[i].clear(); state.marked[i].clear();
state.marked.length = 0; state.marked.length = 0;
} }
function clearErrorLines(cm) {
cm.eachLine(function(line) {
var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass);
if (has) cm.removeLineClass(line, "wrap", has[0]);
})
}
function makeMarker(cm, labels, severity, multiple, tooltips) { function makeMarker(cm, labels, severity, multiple, tooltips) {
var marker = document.createElement("div"), inner = marker; var marker = document.createElement("div"), inner = marker;
marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity; marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity;
@@ -123,7 +149,7 @@
return tip; return tip;
} }
function lintAsync(cm, getAnnotations, passOptions) { function lintAsync(cm, getAnnotations) {
var state = cm.state.lint var state = cm.state.lint
var id = ++state.waitingFor var id = ++state.waitingFor
function abort() { function abort() {
@@ -136,22 +162,23 @@
if (state.waitingFor != id) return if (state.waitingFor != id) return
if (arg2 && annotations instanceof CodeMirror) annotations = arg2 if (arg2 && annotations instanceof CodeMirror) annotations = arg2
cm.operation(function() {updateLinting(cm, annotations)}) cm.operation(function() {updateLinting(cm, annotations)})
}, passOptions, cm); }, state.linterOptions, cm);
} }
function startLinting(cm) { function startLinting(cm) {
var state = cm.state.lint, options = state.options; var state = cm.state.lint;
if (!state) return;
var options = state.options;
/* /*
* Passing rules in `options` property prevents JSHint (and other linters) from complaining * Passing rules in `options` property prevents JSHint (and other linters) from complaining
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
*/ */
var passOptions = options.options || options;
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
if (!getAnnotations) return; if (!getAnnotations) return;
if (options.async || getAnnotations.async) { if (options.async || getAnnotations.async) {
lintAsync(cm, getAnnotations, passOptions) lintAsync(cm, getAnnotations)
} else { } else {
var annotations = getAnnotations(cm.getValue(), passOptions, cm); var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm);
if (!annotations) return; if (!annotations) return;
if (annotations.then) annotations.then(function(issues) { if (annotations.then) annotations.then(function(issues) {
cm.operation(function() {updateLinting(cm, issues)}) cm.operation(function() {updateLinting(cm, issues)})
@@ -161,8 +188,10 @@
} }
function updateLinting(cm, annotationsNotSorted) { function updateLinting(cm, annotationsNotSorted) {
var state = cm.state.lint;
if (!state) return;
var options = state.options;
clearMarks(cm); clearMarks(cm);
var state = cm.state.lint, options = state.options;
var annotations = groupByLine(annotationsNotSorted); var annotations = groupByLine(annotationsNotSorted);
@@ -194,7 +223,10 @@
// use original annotations[line] to show multiple messages // use original annotations[line] to show multiple messages
if (state.hasGutter) if (state.hasGutter)
cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1, cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1,
state.options.tooltips)); options.tooltips));
if (options.highlightLines)
cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity);
} }
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
} }
@@ -203,7 +235,7 @@
var state = cm.state.lint; var state = cm.state.lint;
if (!state) return; if (!state) return;
clearTimeout(state.timeout); clearTimeout(state.timeout);
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay);
} }
function popupTooltips(cm, annotations, e) { function popupTooltips(cm, annotations, e) {
@@ -243,8 +275,8 @@
if (val) { if (val) {
var gutters = cm.getOption("gutters"), hasLintGutter = false; var gutters = cm.getOption("gutters"), hasLintGutter = false;
for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true; for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); var state = cm.state.lint = new LintState(cm, val, hasLintGutter);
if (state.options.lintOnChange !== false) if (state.options.lintOnChange)
cm.on("change", onChange); cm.on("change", onChange);
if (state.options.tooltips != false && state.options.tooltips != "gutter") if (state.options.tooltips != false && state.options.tooltips != "gutter")
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
@@ -254,6 +286,6 @@
}); });
CodeMirror.defineExtension("performLint", function() { CodeMirror.defineExtension("performLint", function() {
if (this.state.lint) startLinting(this); startLinting(this);
}); });
}); });

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -68,6 +68,7 @@
var flags = ""; var flags = "";
if (val instanceof RegExp) { if (val instanceof RegExp) {
if (val.ignoreCase) flags = "i"; if (val.ignoreCase) flags = "i";
if (val.unicode) flags += "u"
val = val.source; val = val.source;
} else { } else {
val = String(val); val = String(val);

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Highlighting text that matches the selection // Highlighting text that matches the selection
// //

View File

@@ -60,20 +60,13 @@
.cm-fat-cursor div.CodeMirror-cursors { .cm-fat-cursor div.CodeMirror-cursors {
z-index: 1; z-index: 1;
} }
.cm-fat-cursor-mark { .cm-fat-cursor .CodeMirror-line::selection,
background-color: rgba(20, 255, 20, 0.5); .cm-fat-cursor .CodeMirror-line > span::selection,
-webkit-animation: blink 1.06s steps(1) infinite; .cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
-moz-animation: blink 1.06s steps(1) infinite; .cm-fat-cursor .CodeMirror-line::-moz-selection,
animation: blink 1.06s steps(1) infinite; .cm-fat-cursor .CodeMirror-line > span::-moz-selection,
} .cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
.cm-animate-fat-cursor { .cm-fat-cursor { caret-color: transparent; }
width: auto;
border: 0;
-webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite;
background-color: #7e7;
}
@-moz-keyframes blink { @-moz-keyframes blink {
0% {} 0% {}
50% { background-color: transparent; } 50% { background-color: transparent; }
@@ -171,6 +164,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
height: 100%; height: 100%;
outline: none; /* Prevent dragging from highlighting the element */ outline: none; /* Prevent dragging from highlighting the element */
position: relative; position: relative;
z-index: 0;
} }
.CodeMirror-sizer { .CodeMirror-sizer {
position: relative; position: relative;

View File

@@ -1,7 +1,7 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// This is CodeMirror (https://codemirror.net), a code editor // This is CodeMirror (https://codemirror.net/5), a code editor
// implemented in JavaScript on top of the browser's DOM. // implemented in JavaScript on top of the browser's DOM.
// //
// You can find some technical background for some of the code below // You can find some technical background for some of the code below
@@ -26,7 +26,8 @@
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]); var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
var webkit = !edge && /WebKit\//.test(userAgent); var webkit = !edge && /WebKit\//.test(userAgent);
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent); var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
var chrome = !edge && /Chrome\//.test(userAgent); var chrome = !edge && /Chrome\/(\d+)/.exec(userAgent);
var chrome_version = chrome && +chrome[1];
var presto = /Opera\//.test(userAgent); var presto = /Opera\//.test(userAgent);
var safari = /Apple Computer/.test(navigator.vendor); var safari = /Apple Computer/.test(navigator.vendor);
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
@@ -111,15 +112,15 @@
} while (child = child.parentNode) } while (child = child.parentNode)
} }
function activeElt() { function activeElt(doc) {
// IE and Edge may throw an "Unspecified Error" when accessing document.activeElement. // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
// IE < 10 will throw when accessed while the page is loading or in an iframe. // IE < 10 will throw when accessed while the page is loading or in an iframe.
// IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
var activeElement; var activeElement;
try { try {
activeElement = document.activeElement; activeElement = doc.activeElement;
} catch(e) { } catch(e) {
activeElement = document.body || null; activeElement = doc.body || null;
} }
while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
{ activeElement = activeElement.shadowRoot.activeElement; } { activeElement = activeElement.shadowRoot.activeElement; }
@@ -143,6 +144,10 @@
else if (ie) // Suppress mysterious IE10 errors else if (ie) // Suppress mysterious IE10 errors
{ selectInput = function(node) { try { node.select(); } catch(_e) {} }; } { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
function doc(cm) { return cm.display.wrapper.ownerDocument }
function win(cm) { return doc(cm).defaultView }
function bind(f) { function bind(f) {
var args = Array.prototype.slice.call(arguments, 1); var args = Array.prototype.slice.call(arguments, 1);
return function(){return f.apply(null, args)} return function(){return f.apply(null, args)}
@@ -1311,6 +1316,7 @@
if (span.marker == marker) { return span } if (span.marker == marker) { return span }
} } } }
} }
// Remove a span from an array, returning undefined if no spans are // Remove a span from an array, returning undefined if no spans are
// left (we don't store arrays for lines without spans). // left (we don't store arrays for lines without spans).
function removeMarkedSpan(spans, span) { function removeMarkedSpan(spans, span) {
@@ -1319,9 +1325,16 @@
{ if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
return r return r
} }
// Add a span to a line. // Add a span to a line.
function addMarkedSpan(line, span) { function addMarkedSpan(line, span, op) {
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));
if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {
line.markedSpans.push(span);
} else {
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
if (inThisOp) { inThisOp.add(line.markedSpans); }
}
span.marker.attachLine(line); span.marker.attachLine(line);
} }
@@ -2186,6 +2199,7 @@
if (cm.options.lineNumbers || markers) { if (cm.options.lineNumbers || markers) {
var wrap$1 = ensureLineWrapped(lineView); var wrap$1 = ensureLineWrapped(lineView);
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")); var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
gutterWrap.setAttribute("aria-hidden", "true");
cm.display.input.setUneditable(gutterWrap); cm.display.input.setUneditable(gutterWrap);
wrap$1.insertBefore(gutterWrap, lineView.text); wrap$1.insertBefore(gutterWrap, lineView.text);
if (lineView.line.gutterClass) if (lineView.line.gutterClass)
@@ -2342,12 +2356,14 @@
function mapFromLineView(lineView, line, lineN) { function mapFromLineView(lineView, line, lineN) {
if (lineView.line == line) if (lineView.line == line)
{ return {map: lineView.measure.map, cache: lineView.measure.cache} } { return {map: lineView.measure.map, cache: lineView.measure.cache} }
for (var i = 0; i < lineView.rest.length; i++) if (lineView.rest) {
{ if (lineView.rest[i] == line) for (var i = 0; i < lineView.rest.length; i++)
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } { if (lineView.rest[i] == line)
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
{ if (lineNo(lineView.rest[i$1]) > lineN) for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } { if (lineNo(lineView.rest[i$1]) > lineN)
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
}
} }
// Render a line into the hidden node display.externalMeasured. Used // Render a line into the hidden node display.externalMeasured. Used
@@ -2561,22 +2577,24 @@
cm.display.lineNumChars = null; cm.display.lineNumChars = null;
} }
function pageScrollX() { function pageScrollX(doc) {
// Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206 // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
// which causes page_Offset and bounding client rects to use // which causes page_Offset and bounding client rects to use
// different reference viewports and invalidate our calculations. // different reference viewports and invalidate our calculations.
if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) } if (chrome && android) { return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft)) }
return window.pageXOffset || (document.documentElement || document.body).scrollLeft return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft
} }
function pageScrollY() { function pageScrollY(doc) {
if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) } if (chrome && android) { return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop)) }
return window.pageYOffset || (document.documentElement || document.body).scrollTop return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop
} }
function widgetTopHeight(lineObj) { function widgetTopHeight(lineObj) {
var ref = visualLine(lineObj);
var widgets = ref.widgets;
var height = 0; var height = 0;
if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) if (widgets) { for (var i = 0; i < widgets.length; ++i) { if (widgets[i].above)
{ height += widgetHeight(lineObj.widgets[i]); } } } { height += widgetHeight(widgets[i]); } } }
return height return height
} }
@@ -2596,8 +2614,8 @@
else { yOff -= cm.display.viewOffset; } else { yOff -= cm.display.viewOffset; }
if (context == "page" || context == "window") { if (context == "page" || context == "window") {
var lOff = cm.display.lineSpace.getBoundingClientRect(); var lOff = cm.display.lineSpace.getBoundingClientRect();
yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); yOff += lOff.top + (context == "window" ? 0 : pageScrollY(doc(cm)));
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); var xOff = lOff.left + (context == "window" ? 0 : pageScrollX(doc(cm)));
rect.left += xOff; rect.right += xOff; rect.left += xOff; rect.right += xOff;
} }
rect.top += yOff; rect.bottom += yOff; rect.top += yOff; rect.bottom += yOff;
@@ -2611,8 +2629,8 @@
var left = coords.left, top = coords.top; var left = coords.left, top = coords.top;
// First move into "page" coordinate system // First move into "page" coordinate system
if (context == "page") { if (context == "page") {
left -= pageScrollX(); left -= pageScrollX(doc(cm));
top -= pageScrollY(); top -= pageScrollY(doc(cm));
} else if (context == "local" || !context) { } else if (context == "local" || !context) {
var localBox = cm.display.sizer.getBoundingClientRect(); var localBox = cm.display.sizer.getBoundingClientRect();
left += localBox.left; left += localBox.left;
@@ -3141,13 +3159,19 @@
var curFragment = result.cursors = document.createDocumentFragment(); var curFragment = result.cursors = document.createDocumentFragment();
var selFragment = result.selection = document.createDocumentFragment(); var selFragment = result.selection = document.createDocumentFragment();
var customCursor = cm.options.$customCursor;
if (customCursor) { primary = true; }
for (var i = 0; i < doc.sel.ranges.length; i++) { for (var i = 0; i < doc.sel.ranges.length; i++) {
if (!primary && i == doc.sel.primIndex) { continue } if (!primary && i == doc.sel.primIndex) { continue }
var range = doc.sel.ranges[i]; var range = doc.sel.ranges[i];
if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
var collapsed = range.empty(); var collapsed = range.empty();
if (collapsed || cm.options.showCursorWhenSelecting) if (customCursor) {
{ drawSelectionCursor(cm, range.head, curFragment); } var head = customCursor(cm, range);
if (head) { drawSelectionCursor(cm, head, curFragment); }
} else if (collapsed || cm.options.showCursorWhenSelecting) {
drawSelectionCursor(cm, range.head, curFragment);
}
if (!collapsed) if (!collapsed)
{ drawSelectionRange(cm, range, selFragment); } { drawSelectionRange(cm, range, selFragment); }
} }
@@ -3163,6 +3187,12 @@
cursor.style.top = pos.top + "px"; cursor.style.top = pos.top + "px";
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) {
var charPos = charCoords(cm, head, "div", null, null);
var width = charPos.right - charPos.left;
cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px";
}
if (pos.other) { if (pos.other) {
// Secondary cursor, shown when on a 'jump' in bi-directional text // Secondary cursor, shown when on a 'jump' in bi-directional text
var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
@@ -3335,10 +3365,14 @@
function updateHeightsInViewport(cm) { function updateHeightsInViewport(cm) {
var display = cm.display; var display = cm.display;
var prevBottom = display.lineDiv.offsetTop; var prevBottom = display.lineDiv.offsetTop;
var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);
var oldHeight = display.lineDiv.getBoundingClientRect().top;
var mustScroll = 0;
for (var i = 0; i < display.view.length; i++) { for (var i = 0; i < display.view.length; i++) {
var cur = display.view[i], wrapping = cm.options.lineWrapping; var cur = display.view[i], wrapping = cm.options.lineWrapping;
var height = (void 0), width = 0; var height = (void 0), width = 0;
if (cur.hidden) { continue } if (cur.hidden) { continue }
oldHeight += cur.line.height;
if (ie && ie_version < 8) { if (ie && ie_version < 8) {
var bot = cur.node.offsetTop + cur.node.offsetHeight; var bot = cur.node.offsetTop + cur.node.offsetHeight;
height = bot - prevBottom; height = bot - prevBottom;
@@ -3353,6 +3387,7 @@
} }
var diff = cur.line.height - height; var diff = cur.line.height - height;
if (diff > .005 || diff < -.005) { if (diff > .005 || diff < -.005) {
if (oldHeight < viewTop) { mustScroll -= diff; }
updateLineHeight(cur.line, height); updateLineHeight(cur.line, height);
updateWidgetHeight(cur.line); updateWidgetHeight(cur.line);
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
@@ -3367,6 +3402,7 @@
} }
} }
} }
if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }
} }
// Read and store the height of line widgets associated with the // Read and store the height of line widgets associated with the
@@ -3410,8 +3446,9 @@
if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
var doc = display.wrapper.ownerDocument;
if (rect.top + box.top < 0) { doScroll = true; } if (rect.top + box.top < 0) { doScroll = true; }
else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; } else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }
if (doScroll != null && !phantom) { if (doScroll != null && !phantom) {
var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;")); var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
cm.display.lineSpace.appendChild(scrollNode); cm.display.lineSpace.appendChild(scrollNode);
@@ -3430,8 +3467,8 @@
// Set pos and end to the cursor positions around the character pos sticks to // Set pos and end to the cursor positions around the character pos sticks to
// If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
// If pos == Pos(_, 0, "before"), pos and end are unchanged // If pos == Pos(_, 0, "before"), pos and end are unchanged
pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos; end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
} }
for (var limit = 0; limit < 5; limit++) { for (var limit = 0; limit < 5; limit++) {
var changed = false; var changed = false;
@@ -3627,6 +3664,7 @@
this.vert.firstChild.style.height = this.vert.firstChild.style.height =
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
} else { } else {
this.vert.scrollTop = 0;
this.vert.style.display = ""; this.vert.style.display = "";
this.vert.firstChild.style.height = "0"; this.vert.firstChild.style.height = "0";
} }
@@ -3664,13 +3702,13 @@
NativeScrollbars.prototype.zeroWidthHack = function () { NativeScrollbars.prototype.zeroWidthHack = function () {
var w = mac && !mac_geMountainLion ? "12px" : "18px"; var w = mac && !mac_geMountainLion ? "12px" : "18px";
this.horiz.style.height = this.vert.style.width = w; this.horiz.style.height = this.vert.style.width = w;
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"; this.horiz.style.visibility = this.vert.style.visibility = "hidden";
this.disableHoriz = new Delayed; this.disableHoriz = new Delayed;
this.disableVert = new Delayed; this.disableVert = new Delayed;
}; };
NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) { NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
bar.style.pointerEvents = "auto"; bar.style.visibility = "";
function maybeDisable() { function maybeDisable() {
// To find out whether the scrollbar is still visible, we // To find out whether the scrollbar is still visible, we
// check whether the element under the pixel in the bottom // check whether the element under the pixel in the bottom
@@ -3681,7 +3719,7 @@
var box = bar.getBoundingClientRect(); var box = bar.getBoundingClientRect();
var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2) var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
: document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1); : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
if (elt != bar) { bar.style.pointerEvents = "none"; } if (elt != bar) { bar.style.visibility = "hidden"; }
else { delay.set(1000, maybeDisable); } else { delay.set(1000, maybeDisable); }
} }
delay.set(1000, maybeDisable); delay.set(1000, maybeDisable);
@@ -3782,7 +3820,8 @@
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
scrollToPos: null, // Used to scroll to a specific position scrollToPos: null, // Used to scroll to a specific position
focus: false, focus: false,
id: ++nextOpId // Unique ID id: ++nextOpId, // Unique ID
markArrays: null // Used by addMarkedSpan
}; };
pushOperation(cm.curOp); pushOperation(cm.curOp);
} }
@@ -3861,7 +3900,7 @@
cm.display.maxLineChanged = false; cm.display.maxLineChanged = false;
} }
var takeFocus = op.focus && op.focus == activeElt(); var takeFocus = op.focus && op.focus == activeElt(doc(cm));
if (op.preparedSelection) if (op.preparedSelection)
{ cm.display.input.showSelection(op.preparedSelection, takeFocus); } { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
if (op.updatedDisplay || op.startHeight != cm.doc.height) if (op.updatedDisplay || op.startHeight != cm.doc.height)
@@ -4038,11 +4077,11 @@
function selectionSnapshot(cm) { function selectionSnapshot(cm) {
if (cm.hasFocus()) { return null } if (cm.hasFocus()) { return null }
var active = activeElt(); var active = activeElt(doc(cm));
if (!active || !contains(cm.display.lineDiv, active)) { return null } if (!active || !contains(cm.display.lineDiv, active)) { return null }
var result = {activeElt: active}; var result = {activeElt: active};
if (window.getSelection) { if (window.getSelection) {
var sel = window.getSelection(); var sel = win(cm).getSelection();
if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) { if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
result.anchorNode = sel.anchorNode; result.anchorNode = sel.anchorNode;
result.anchorOffset = sel.anchorOffset; result.anchorOffset = sel.anchorOffset;
@@ -4054,11 +4093,12 @@
} }
function restoreSelection(snapshot) { function restoreSelection(snapshot) {
if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return } if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(snapshot.activeElt.ownerDocument)) { return }
snapshot.activeElt.focus(); snapshot.activeElt.focus();
if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) && if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) { snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
var sel = window.getSelection(), range = document.createRange(); var doc = snapshot.activeElt.ownerDocument;
var sel = doc.defaultView.getSelection(), range = doc.createRange();
range.setEnd(snapshot.anchorNode, snapshot.anchorOffset); range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
range.collapse(false); range.collapse(false);
sel.removeAllRanges(); sel.removeAllRanges();
@@ -4235,6 +4275,8 @@
function updateGutterSpace(display) { function updateGutterSpace(display) {
var width = display.gutters.offsetWidth; var width = display.gutters.offsetWidth;
display.sizer.style.marginLeft = width + "px"; display.sizer.style.marginLeft = width + "px";
// Send an event to consumers responding to changes in gutter width.
signalLater(display, "gutterChanged", display);
} }
function setDocumentHeight(cm, measure) { function setDocumentHeight(cm, measure) {
@@ -4373,6 +4415,12 @@
d.scroller.setAttribute("tabIndex", "-1"); d.scroller.setAttribute("tabIndex", "-1");
// The element in which the editor lives. // The element in which the editor lives.
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
// See #6982. FIXME remove when this has been fixed for a while in Chrome
if (chrome && chrome_version >= 105) { d.wrapper.style.clipPath = "inset(0px)"; }
// This attribute is respected by automatic translation systems such as Google Translate,
// and may also be respected by tools used by human translators.
d.wrapper.setAttribute('translate', 'no');
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
@@ -4470,7 +4518,24 @@
} }
function onScrollWheel(cm, e) { function onScrollWheel(cm, e) {
// On Chrome 102, viewport updates somehow stop wheel-based
// scrolling. Turning off pointer events during the scroll seems
// to avoid the issue.
if (chrome && chrome_version == 102) {
if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = "none"; }
else { clearTimeout(cm.display.chromeScrollHack); }
cm.display.chromeScrollHack = setTimeout(function () {
cm.display.chromeScrollHack = null;
cm.display.sizer.style.pointerEvents = "";
}, 100);
}
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
var pixelsPerUnit = wheelPixelsPerUnit;
if (e.deltaMode === 0) {
dx = e.deltaX;
dy = e.deltaY;
pixelsPerUnit = 1;
}
var display = cm.display, scroll = display.scroller; var display = cm.display, scroll = display.scroller;
// Quit if there's nothing to scroll here // Quit if there's nothing to scroll here
@@ -4499,10 +4564,10 @@
// estimated pixels/delta value, we just handle horizontal // estimated pixels/delta value, we just handle horizontal
// scrolling entirely here. It'll be slightly off from native, but // scrolling entirely here. It'll be slightly off from native, but
// better than glitching out. // better than glitching out.
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { if (dx && !gecko && !presto && pixelsPerUnit != null) {
if (dy && canScrollY) if (dy && canScrollY)
{ updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); } { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); }
setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit));
// Only prevent default scrolling if vertical scrolling is // Only prevent default scrolling if vertical scrolling is
// actually possible. Otherwise, it causes vertical scroll // actually possible. Otherwise, it causes vertical scroll
// jitter on OSX trackpads when deltaX is small and deltaY // jitter on OSX trackpads when deltaX is small and deltaY
@@ -4515,15 +4580,15 @@
// 'Project' the visible viewport to cover the area that is being // 'Project' the visible viewport to cover the area that is being
// scrolled into view (if we know enough to estimate it). // scrolled into view (if we know enough to estimate it).
if (dy && wheelPixelsPerUnit != null) { if (dy && pixelsPerUnit != null) {
var pixels = dy * wheelPixelsPerUnit; var pixels = dy * pixelsPerUnit;
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
if (pixels < 0) { top = Math.max(0, top + pixels - 50); } if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
else { bot = Math.min(cm.doc.height, bot + pixels + 50); } else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
updateDisplaySimple(cm, {top: top, bottom: bot}); updateDisplaySimple(cm, {top: top, bottom: bot});
} }
if (wheelSamples < 20) { if (wheelSamples < 20 && e.deltaMode !== 0) {
if (display.wheelStartX == null) { if (display.wheelStartX == null) {
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
display.wheelDX = dx; display.wheelDY = dy; display.wheelDX = dx; display.wheelDY = dy;
@@ -4782,6 +4847,7 @@
estimateLineHeights(cm); estimateLineHeights(cm);
loadMode(cm); loadMode(cm);
setDirectionClass(cm); setDirectionClass(cm);
cm.options.direction = doc.direction;
if (!cm.options.lineWrapping) { findMaxLine(cm); } if (!cm.options.lineWrapping) { findMaxLine(cm); }
cm.options.mode = doc.modeOption; cm.options.mode = doc.modeOption;
regChange(cm); regChange(cm);
@@ -5146,7 +5212,7 @@
var range = sel.ranges[i]; var range = sel.ranges[i];
var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear); var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear); var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);
if (out || newAnchor != range.anchor || newHead != range.head) { if (out || newAnchor != range.anchor || newHead != range.head) {
if (!out) { out = sel.ranges.slice(0, i); } if (!out) { out = sel.ranges.slice(0, i); }
out[i] = new Range(newAnchor, newHead); out[i] = new Range(newAnchor, newHead);
@@ -5958,7 +6024,7 @@
if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
addMarkedSpan(line, new MarkedSpan(marker, addMarkedSpan(line, new MarkedSpan(marker,
curLine == from.line ? from.ch : null, curLine == from.line ? from.ch : null,
curLine == to.line ? to.ch : null)); curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp);
++curLine; ++curLine;
}); });
// lineIsHidden depends on the presence of the spans, so needs a second pass // lineIsHidden depends on the presence of the spans, so needs a second pass
@@ -6130,6 +6196,7 @@
getRange: function(from, to, lineSep) { getRange: function(from, to, lineSep) {
var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
if (lineSep === false) { return lines } if (lineSep === false) { return lines }
if (lineSep === '') { return lines.join('') }
return lines.join(lineSep || this.lineSeparator()) return lines.join(lineSep || this.lineSeparator())
}, },
@@ -6684,10 +6751,9 @@
// Very basic readline/emacs-style bindings, which are standard on Mac. // Very basic readline/emacs-style bindings, which are standard on Mac.
keyMap.emacsy = { keyMap.emacsy = {
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp",
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine",
"Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", "Ctrl-T": "transposeChars", "Ctrl-O": "openLine"
"Ctrl-O": "openLine"
}; };
keyMap.macDefault = { keyMap.macDefault = {
"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
@@ -7198,7 +7264,7 @@
function onKeyDown(e) { function onKeyDown(e) {
var cm = this; var cm = this;
if (e.target && e.target != cm.display.input.getField()) { return } if (e.target && e.target != cm.display.input.getField()) { return }
cm.curOp.focus = activeElt(); cm.curOp.focus = activeElt(doc(cm));
if (signalDOMEvent(cm, e)) { return } if (signalDOMEvent(cm, e)) { return }
// IE does strange things with escape. // IE does strange things with escape.
if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; } if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
@@ -7305,7 +7371,7 @@
} }
if (clickInGutter(cm, e)) { return } if (clickInGutter(cm, e)) { return }
var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"; var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
window.focus(); win(cm).focus();
// #3261: make sure, that we're not starting a second selection // #3261: make sure, that we're not starting a second selection
if (button == 1 && cm.state.selectingText) if (button == 1 && cm.state.selectingText)
@@ -7360,7 +7426,7 @@
function leftButtonDown(cm, pos, repeat, event) { function leftButtonDown(cm, pos, repeat, event) {
if (ie) { setTimeout(bind(ensureFocus, cm), 0); } if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
else { cm.curOp.focus = activeElt(); } else { cm.curOp.focus = activeElt(doc(cm)); }
var behavior = configureMouse(cm, repeat, event); var behavior = configureMouse(cm, repeat, event);
@@ -7430,19 +7496,19 @@
// Normal selection, as opposed to text dragging. // Normal selection, as opposed to text dragging.
function leftButtonSelect(cm, event, start, behavior) { function leftButtonSelect(cm, event, start, behavior) {
if (ie) { delayBlurEvent(cm); } if (ie) { delayBlurEvent(cm); }
var display = cm.display, doc = cm.doc; var display = cm.display, doc$1 = cm.doc;
e_preventDefault(event); e_preventDefault(event);
var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; var ourRange, ourIndex, startSel = doc$1.sel, ranges = startSel.ranges;
if (behavior.addNew && !behavior.extend) { if (behavior.addNew && !behavior.extend) {
ourIndex = doc.sel.contains(start); ourIndex = doc$1.sel.contains(start);
if (ourIndex > -1) if (ourIndex > -1)
{ ourRange = ranges[ourIndex]; } { ourRange = ranges[ourIndex]; }
else else
{ ourRange = new Range(start, start); } { ourRange = new Range(start, start); }
} else { } else {
ourRange = doc.sel.primary(); ourRange = doc$1.sel.primary();
ourIndex = doc.sel.primIndex; ourIndex = doc$1.sel.primIndex;
} }
if (behavior.unit == "rectangle") { if (behavior.unit == "rectangle") {
@@ -7459,18 +7525,18 @@
if (!behavior.addNew) { if (!behavior.addNew) {
ourIndex = 0; ourIndex = 0;
setSelection(doc, new Selection([ourRange], 0), sel_mouse); setSelection(doc$1, new Selection([ourRange], 0), sel_mouse);
startSel = doc.sel; startSel = doc$1.sel;
} else if (ourIndex == -1) { } else if (ourIndex == -1) {
ourIndex = ranges.length; ourIndex = ranges.length;
setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), setSelection(doc$1, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
{scroll: false, origin: "*mouse"}); {scroll: false, origin: "*mouse"});
} else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) { } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), setSelection(doc$1, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
{scroll: false, origin: "*mouse"}); {scroll: false, origin: "*mouse"});
startSel = doc.sel; startSel = doc$1.sel;
} else { } else {
replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); replaceOneSelection(doc$1, ourIndex, ourRange, sel_mouse);
} }
var lastPos = start; var lastPos = start;
@@ -7480,19 +7546,19 @@
if (behavior.unit == "rectangle") { if (behavior.unit == "rectangle") {
var ranges = [], tabSize = cm.options.tabSize; var ranges = [], tabSize = cm.options.tabSize;
var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); var startCol = countColumn(getLine(doc$1, start.line).text, start.ch, tabSize);
var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); var posCol = countColumn(getLine(doc$1, pos.line).text, pos.ch, tabSize);
var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
line <= end; line++) { line <= end; line++) {
var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); var text = getLine(doc$1, line).text, leftPos = findColumn(text, left, tabSize);
if (left == right) if (left == right)
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
else if (text.length > leftPos) else if (text.length > leftPos)
{ ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); } { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
} }
if (!ranges.length) { ranges.push(new Range(start, start)); } if (!ranges.length) { ranges.push(new Range(start, start)); }
setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), setSelection(doc$1, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
{origin: "*mouse", scroll: false}); {origin: "*mouse", scroll: false});
cm.scrollIntoView(pos); cm.scrollIntoView(pos);
} else { } else {
@@ -7507,8 +7573,8 @@
anchor = maxPos(oldRange.to(), range.head); anchor = maxPos(oldRange.to(), range.head);
} }
var ranges$1 = startSel.ranges.slice(0); var ranges$1 = startSel.ranges.slice(0);
ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)); ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc$1, anchor), head));
setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); setSelection(doc$1, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
} }
} }
@@ -7524,9 +7590,9 @@
var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle"); var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
if (!cur) { return } if (!cur) { return }
if (cmp(cur, lastPos) != 0) { if (cmp(cur, lastPos) != 0) {
cm.curOp.focus = activeElt(); cm.curOp.focus = activeElt(doc(cm));
extendTo(cur); extendTo(cur);
var visible = visibleLines(display, doc); var visible = visibleLines(display, doc$1);
if (cur.line >= visible.to || cur.line < visible.from) if (cur.line >= visible.to || cur.line < visible.from)
{ setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); } { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
} else { } else {
@@ -7551,7 +7617,7 @@
} }
off(display.wrapper.ownerDocument, "mousemove", move); off(display.wrapper.ownerDocument, "mousemove", move);
off(display.wrapper.ownerDocument, "mouseup", up); off(display.wrapper.ownerDocument, "mouseup", up);
doc.history.lastSelOrigin = null; doc$1.history.lastSelOrigin = null;
} }
var move = operation(cm, function (e) { var move = operation(cm, function (e) {
@@ -7708,7 +7774,7 @@
for (var i = newBreaks.length - 1; i >= 0; i--) for (var i = newBreaks.length - 1; i >= 0; i--)
{ replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
}); });
option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
if (old != Init) { cm.refresh(); } if (old != Init) { cm.refresh(); }
}); });
@@ -8151,7 +8217,7 @@
var pasted = e.clipboardData && e.clipboardData.getData("Text"); var pasted = e.clipboardData && e.clipboardData.getData("Text");
if (pasted) { if (pasted) {
e.preventDefault(); e.preventDefault();
if (!cm.isReadOnly() && !cm.options.disableInput) if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())
{ runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); } { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
return true return true
} }
@@ -8199,7 +8265,7 @@
} }
function hiddenTextarea() { function hiddenTextarea() {
var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none");
var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
// The textarea is kept positioned near the cursor to prevent the // The textarea is kept positioned near the cursor to prevent the
// fact that it'll be scrolled into view on input from scrolling // fact that it'll be scrolled into view on input from scrolling
@@ -8228,7 +8294,7 @@
CodeMirror.prototype = { CodeMirror.prototype = {
constructor: CodeMirror, constructor: CodeMirror,
focus: function(){window.focus(); this.display.input.focus();}, focus: function(){win(this).focus(); this.display.input.focus();},
setOption: function(option, value) { setOption: function(option, value) {
var options = this.options, old = options[option]; var options = this.options, old = options[option];
@@ -8552,7 +8618,7 @@
signal(this, "overwriteToggle", this, this.state.overwrite); signal(this, "overwriteToggle", this, this.state.overwrite);
}, },
hasFocus: function() { return this.display.input.getField() == activeElt() }, hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) },
isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }), scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
@@ -8733,7 +8799,7 @@
function findPosV(cm, pos, dir, unit) { function findPosV(cm, pos, dir, unit) {
var doc = cm.doc, x = pos.left, y; var doc = cm.doc, x = pos.left, y;
if (unit == "page") { if (unit == "page") {
var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);
var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
@@ -8833,7 +8899,7 @@
var kludge = hiddenTextarea(), te = kludge.firstChild; var kludge = hiddenTextarea(), te = kludge.firstChild;
cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
te.value = lastCopied.text.join("\n"); te.value = lastCopied.text.join("\n");
var hadFocus = document.activeElement; var hadFocus = activeElt(div.ownerDocument);
selectInput(te); selectInput(te);
setTimeout(function () { setTimeout(function () {
cm.display.lineSpace.removeChild(kludge); cm.display.lineSpace.removeChild(kludge);
@@ -8856,7 +8922,7 @@
ContentEditableInput.prototype.prepareSelection = function () { ContentEditableInput.prototype.prepareSelection = function () {
var result = prepareSelection(this.cm, false); var result = prepareSelection(this.cm, false);
result.focus = document.activeElement == this.div; result.focus = activeElt(this.div.ownerDocument) == this.div;
return result return result
}; };
@@ -8952,7 +9018,7 @@
ContentEditableInput.prototype.focus = function () { ContentEditableInput.prototype.focus = function () {
if (this.cm.options.readOnly != "nocursor") { if (this.cm.options.readOnly != "nocursor") {
if (!this.selectionInEditor() || document.activeElement != this.div) if (!this.selectionInEditor() || activeElt(this.div.ownerDocument) != this.div)
{ this.showSelection(this.prepareSelection(), true); } { this.showSelection(this.prepareSelection(), true); }
this.div.focus(); this.div.focus();
} }
@@ -8963,9 +9029,11 @@
ContentEditableInput.prototype.supportsTouch = function () { return true }; ContentEditableInput.prototype.supportsTouch = function () { return true };
ContentEditableInput.prototype.receivedFocus = function () { ContentEditableInput.prototype.receivedFocus = function () {
var this$1 = this;
var input = this; var input = this;
if (this.selectionInEditor()) if (this.selectionInEditor())
{ this.pollSelection(); } { setTimeout(function () { return this$1.pollSelection(); }, 20); }
else else
{ runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
@@ -9302,6 +9370,7 @@
// Used to work around IE issue with selection being forgotten when focus moves away from textarea // Used to work around IE issue with selection being forgotten when focus moves away from textarea
this.hasSelection = false; this.hasSelection = false;
this.composing = null; this.composing = null;
this.resetting = false;
}; };
TextareaInput.prototype.init = function (display) { TextareaInput.prototype.init = function (display) {
@@ -9434,8 +9503,9 @@
// Reset the input to correspond to the selection (or to be empty, // Reset the input to correspond to the selection (or to be empty,
// when not typing and nothing is selected) // when not typing and nothing is selected)
TextareaInput.prototype.reset = function (typing) { TextareaInput.prototype.reset = function (typing) {
if (this.contextMenuPending || this.composing) { return } if (this.contextMenuPending || this.composing && typing) { return }
var cm = this.cm; var cm = this.cm;
this.resetting = true;
if (cm.somethingSelected()) { if (cm.somethingSelected()) {
this.prevInput = ""; this.prevInput = "";
var content = cm.getSelection(); var content = cm.getSelection();
@@ -9446,6 +9516,7 @@
this.prevInput = this.textarea.value = ""; this.prevInput = this.textarea.value = "";
if (ie && ie_version >= 9) { this.hasSelection = null; } if (ie && ie_version >= 9) { this.hasSelection = null; }
} }
this.resetting = false;
}; };
TextareaInput.prototype.getField = function () { return this.textarea }; TextareaInput.prototype.getField = function () { return this.textarea };
@@ -9453,7 +9524,7 @@
TextareaInput.prototype.supportsTouch = function () { return false }; TextareaInput.prototype.supportsTouch = function () { return false };
TextareaInput.prototype.focus = function () { TextareaInput.prototype.focus = function () {
if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(this.textarea.ownerDocument) != this.textarea)) {
try { this.textarea.focus(); } try { this.textarea.focus(); }
catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
} }
@@ -9507,7 +9578,7 @@
// possible when it is clear that nothing happened. hasSelection // possible when it is clear that nothing happened. hasSelection
// will be the case when there is a lot of text in the textarea, // will be the case when there is a lot of text in the textarea,
// in which case reading its value would be expensive. // in which case reading its value would be expensive.
if (this.contextMenuPending || !cm.state.focused || if (this.contextMenuPending || this.resetting || !cm.state.focused ||
(hasSelection(input) && !prevInput && !this.composing) || (hasSelection(input) && !prevInput && !this.composing) ||
cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
{ return false } { return false }
@@ -9576,9 +9647,9 @@
input.wrapper.style.cssText = "position: static"; input.wrapper.style.cssText = "position: static";
te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
var oldScrollY; var oldScrollY;
if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712) if (webkit) { oldScrollY = te.ownerDocument.defaultView.scrollY; } // Work around Chrome issue (#2712)
display.input.focus(); display.input.focus();
if (webkit) { window.scrollTo(null, oldScrollY); } if (webkit) { te.ownerDocument.defaultView.scrollTo(null, oldScrollY); }
display.input.reset(); display.input.reset();
// Adds "Select all" to context menu in FF // Adds "Select all" to context menu in FF
if (!cm.somethingSelected()) { te.value = input.prevInput = " "; } if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
@@ -9660,7 +9731,7 @@
// Set autofocus to true if this textarea is focused, or if it has // Set autofocus to true if this textarea is focused, or if it has
// autofocus and no other element is focused. // autofocus and no other element is focused.
if (options.autofocus == null) { if (options.autofocus == null) {
var hasFocus = activeElt(); var hasFocus = activeElt(textarea.ownerDocument);
options.autofocus = hasFocus == textarea || options.autofocus = hasFocus == textarea ||
textarea.getAttribute("autofocus") != null && hasFocus == document.body; textarea.getAttribute("autofocus") != null && hasFocus == document.body;
} }
@@ -9794,7 +9865,7 @@
addLegacyProps(CodeMirror); addLegacyProps(CodeMirror);
CodeMirror.version = "5.60.0"; CodeMirror.version = "5.65.9";
return CodeMirror; return CodeMirror;

View File

@@ -1,5 +1,14 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others (function(mod) {
// Distributed under an MIT license: https://codemirror.net/LICENSE if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js"));
else if (typeof define == "function" && define.amd) // AMD
define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
'use strict';
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
/** /**
* Supported keybindings: * Supported keybindings:
@@ -34,15 +43,7 @@
* 9. Ex command implementations. * 9. Ex command implementations.
*/ */
(function(mod) { function initVim$1(CodeMirror) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js"));
else if (typeof define == "function" && define.amd) // AMD
define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
'use strict';
var Pos = CodeMirror.Pos; var Pos = CodeMirror.Pos;
@@ -87,6 +88,8 @@
{ keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>' }, { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>' },
{ keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' }, { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
{ keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' }, { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
{ keys: '<C-Esc>', type: 'keyToKey', toKeys: '<Esc>' }, // ipad keyboard sends C-Esc instead of C-[
{ keys: '<C-Esc>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
{ keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' }, { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },
{ keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'}, { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},
{ keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },
@@ -225,8 +228,8 @@
{ keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
{ keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }}, { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }},
{ keys: 'z<CR>', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: 'z<CR>', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
{ keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }}, { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }},
{ keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
{ keys: '.', type: 'action', action: 'repeatLastEdit' }, { keys: '.', type: 'action', action: 'repeatLastEdit' },
{ keys: '<C-a>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}}, { keys: '<C-a>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}},
{ keys: '<C-x>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}}, { keys: '<C-x>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}},
@@ -276,7 +279,6 @@
{ name: 'global', shortName: 'g' } { name: 'global', shortName: 'g' }
]; ];
var Vim = function() {
function enterVimMode(cm) { function enterVimMode(cm) {
cm.setOption('disableInput', true); cm.setOption('disableInput', true);
cm.setOption('showCursorWhenSelecting', false); cm.setOption('showCursorWhenSelecting', false);
@@ -642,8 +644,8 @@
register.clear(); register.clear();
this.latestRegister = registerName; this.latestRegister = registerName;
if (cm.openDialog) { if (cm.openDialog) {
this.onRecordingDone = cm.openDialog( var template = dom('span', {class: 'cm-vim-message'}, 'recording @' + registerName);
document.createTextNode('(recording)['+registerName+']'), null, {bottom:true}); this.onRecordingDone = cm.openDialog(template, null, {bottom:true});
} }
this.isRecording = true; this.isRecording = true;
} }
@@ -716,7 +718,8 @@
} }
var lastInsertModeKeyTimer; var lastInsertModeKeyTimer;
var vimApi= { var vimApi = {
enterVimMode: enterVimMode,
buildKeyMap: function() { buildKeyMap: function() {
// TODO: Convert keymap into dictionary format for fast lookup. // TODO: Convert keymap into dictionary format for fast lookup.
}, },
@@ -838,6 +841,8 @@
return command(); return command();
} }
}, },
multiSelectHandleKey: multiSelectHandleKey,
/** /**
* This is the outermost function called by CodeMirror, after keys have * This is the outermost function called by CodeMirror, after keys have
* been mapped to their Vim equivalents. * been mapped to their Vim equivalents.
@@ -865,13 +870,17 @@
} }
function handleEsc() { function handleEsc() {
if (key == '<Esc>') { if (key == '<Esc>') {
// Clear input state and get back to normal mode.
clearInputState(cm);
if (vim.visualMode) { if (vim.visualMode) {
// Get back to normal mode.
exitVisualMode(cm); exitVisualMode(cm);
} else if (vim.insertMode) { } else if (vim.insertMode) {
// Get back to normal mode.
exitInsertMode(cm); exitInsertMode(cm);
} else {
// We're already in normal mode. Let '<Esc>' be handled normally.
return;
} }
clearInputState(cm);
return true; return true;
} }
} }
@@ -939,9 +948,10 @@
var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context);
if (match.type == 'none') { clearInputState(cm); return false; } if (match.type == 'none') { clearInputState(cm); return false; }
else if (match.type == 'partial') { return true; } else if (match.type == 'partial') { return true; }
else if (match.type == 'clear') { clearInputState(cm); return true; }
vim.inputState.keyBuffer = ''; vim.inputState.keyBuffer = '';
var keysMatcher = /^(\d*)(.*)$/.exec(keys); keysMatcher = /^(\d*)(.*)$/.exec(keys);
if (keysMatcher[1] && keysMatcher[1] != '0') { if (keysMatcher[1] && keysMatcher[1] != '0') {
vim.inputState.pushRepeatDigit(keysMatcher[1]); vim.inputState.pushRepeatDigit(keysMatcher[1]);
} }
@@ -1243,7 +1253,7 @@
} }
if (bestMatch.keys.slice(-11) == '<character>') { if (bestMatch.keys.slice(-11) == '<character>') {
var character = lastChar(keys); var character = lastChar(keys);
if (!character) return {type: 'none'}; if (!character || character.length > 1) return {type: 'clear'};
inputState.selectedCharacter = character; inputState.selectedCharacter = character;
} }
return {type: 'full', command: bestMatch}; return {type: 'full', command: bestMatch};
@@ -1270,8 +1280,6 @@
case 'keyToEx': case 'keyToEx':
this.processEx(cm, vim, command); this.processEx(cm, vim, command);
break; break;
default:
break;
} }
}, },
processMotion: function(cm, vim, command) { processMotion: function(cm, vim, command) {
@@ -1487,6 +1495,7 @@
vimGlobalState.exCommandHistoryController.pushInput(input); vimGlobalState.exCommandHistoryController.pushInput(input);
vimGlobalState.exCommandHistoryController.reset(); vimGlobalState.exCommandHistoryController.reset();
exCommandDispatcher.processCommand(cm, input); exCommandDispatcher.processCommand(cm, input);
clearInputState(cm);
} }
function onPromptKeyDown(e, input, close) { function onPromptKeyDown(e, input, close) {
var keyName = CodeMirror.keyName(e), up, offset; var keyName = CodeMirror.keyName(e), up, offset;
@@ -2007,7 +2016,7 @@
} }
var orig = cm.charCoords(head, 'local'); var orig = cm.charCoords(head, 'local');
motionArgs.repeat = repeat; motionArgs.repeat = repeat;
var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim);
if (!curEnd) { if (!curEnd) {
return null; return null;
} }
@@ -2150,6 +2159,20 @@
} }
} else if (character === 't') { } else if (character === 't') {
tmp = expandTagUnderCursor(cm, head, inclusive); tmp = expandTagUnderCursor(cm, head, inclusive);
} else if (character === 's') {
// account for cursor on end of sentence symbol
var content = cm.getLine(head.line);
if (head.ch > 0 && isEndOfSentenceSymbol(content[head.ch])) {
head.ch -= 1;
}
var end = getSentence(cm, head, motionArgs.repeat, 1, inclusive);
var start = getSentence(cm, head, motionArgs.repeat, -1, inclusive);
// closer vim behaviour, 'a' only takes the space after the sentence if there is one before and after
if (isWhiteSpaceString(cm.getLine(start.line)[start.ch])
&& isWhiteSpaceString(cm.getLine(end.line)[end.ch -1])) {
start = {line: start.line, ch: start.ch + 1};
}
tmp = {start: start, end: end};
} else { } else {
// No text object defined for this, don't move. // No text object defined for this, don't move.
return null; return null;
@@ -2232,7 +2255,7 @@
} else if (args.fullLine) { } else if (args.fullLine) {
head.ch = Number.MAX_VALUE; head.ch = Number.MAX_VALUE;
head.line--; head.line--;
cm.setSelection(anchor, head) cm.setSelection(anchor, head);
text = cm.getSelection(); text = cm.getSelection();
cm.replaceSelection(""); cm.replaceSelection("");
finalHead = anchor; finalHead = anchor;
@@ -2284,22 +2307,30 @@
}, },
indent: function(cm, args, ranges) { indent: function(cm, args, ranges) {
var vim = cm.state.vim; var vim = cm.state.vim;
var startLine = ranges[0].anchor.line; if (cm.indentMore) {
var endLine = vim.visualBlock ? var repeat = (vim.visualMode) ? args.repeat : 1;
ranges[ranges.length - 1].anchor.line :
ranges[0].head.line;
// In visual mode, n> shifts the selection right n times, instead of
// shifting n lines right once.
var repeat = (vim.visualMode) ? args.repeat : 1;
if (args.linewise) {
// The only way to delete a newline is to delete until the start of
// the next line, so in linewise mode evalInput will include the next
// line. We don't want this in indent, so we go back a line.
endLine--;
}
for (var i = startLine; i <= endLine; i++) {
for (var j = 0; j < repeat; j++) { for (var j = 0; j < repeat; j++) {
cm.indentLine(i, args.indentRight); if (args.indentRight) cm.indentMore();
else cm.indentLess();
}
} else {
var startLine = ranges[0].anchor.line;
var endLine = vim.visualBlock ?
ranges[ranges.length - 1].anchor.line :
ranges[0].head.line;
// In visual mode, n> shifts the selection right n times, instead of
// shifting n lines right once.
var repeat = (vim.visualMode) ? args.repeat : 1;
if (args.linewise) {
// The only way to delete a newline is to delete until the start of
// the next line, so in linewise mode evalInput will include the next
// line. We don't want this in indent, so we go back a line.
endLine--;
}
for (var i = startLine; i <= endLine; i++) {
for (var j = 0; j < repeat; j++) {
cm.indentLine(i, args.indentRight);
}
} }
} }
return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
@@ -2412,11 +2443,14 @@
var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local'); var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local');
var height = cm.getScrollInfo().clientHeight; var height = cm.getScrollInfo().clientHeight;
var y = charCoords.top; var y = charCoords.top;
var lineHeight = charCoords.bottom - y;
switch (actionArgs.position) { switch (actionArgs.position) {
case 'center': y = y - (height / 2) + lineHeight; case 'center': y = charCoords.bottom - height / 2;
break; break;
case 'bottom': y = y - height + lineHeight; case 'bottom':
var lineLastCharPos = new Pos(lineNum, cm.getLine(lineNum).length - 1);
var lineLastCharCoords = cm.charCoords(lineLastCharPos, 'local');
var lineHeight = lineLastCharCoords.bottom - y;
y = y - height + lineHeight;
break; break;
} }
cm.scrollTo(null, y); cm.scrollTo(null, y);
@@ -2866,13 +2900,13 @@
} }
if (!actionArgs.backtrack && (end <= cur.ch))return; if (!actionArgs.backtrack && (end <= cur.ch))return;
if (match) { if (match) {
var baseStr = match[2] || match[4] var baseStr = match[2] || match[4];
var digits = match[3] || match[5] var digits = match[3] || match[5];
var increment = actionArgs.increase ? 1 : -1; var increment = actionArgs.increase ? 1 : -1;
var base = {'0b': 2, '0': 8, '': 10, '0x': 16}[baseStr.toLowerCase()]; var base = {'0b': 2, '0': 8, '': 10, '0x': 16}[baseStr.toLowerCase()];
var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat); var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat);
numberStr = number.toString(base); numberStr = number.toString(base);
var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '' var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '';
if (numberStr.charAt(0) === '-') { if (numberStr.charAt(0) === '-') {
numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1); numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1);
} else { } else {
@@ -3244,9 +3278,8 @@
fromCh = anchor.ch, fromCh = anchor.ch,
bottom = Math.max(anchor.line, head.line), bottom = Math.max(anchor.line, head.line),
toCh = head.ch; toCh = head.ch;
if (fromCh < toCh) { toCh += 1 } if (fromCh < toCh) { toCh += 1; }
else { fromCh += 1 }; else { fromCh += 1; } var height = bottom - top + 1;
var height = bottom - top + 1;
var primary = head.line == top ? 0 : height - 1; var primary = head.line == top ? 0 : height - 1;
var ranges = []; var ranges = [];
for (var i = 0; i < height; i++) { for (var i = 0; i < height; i++) {
@@ -3798,21 +3831,156 @@
start = new Pos(i, 0); start = new Pos(i, 0);
return { start: start, end: end }; return { start: start, end: end };
} }
function getSentence(cm, cur, repeat, dir, inclusive /*includes whitespace*/) {
function findSentence(cm, cur, repeat, dir) { /*
Takes an index object
/* {
Takes an index object line: the line string,
{ ln: line number,
line: the line string, pos: index in line,
ln: line number, dir: direction of traversal (-1 or 1)
pos: index in line, }
dir: direction of traversal (-1 or 1) and modifies the pos member to represent the
next valid position or sets the line to null if there are
no more valid positions.
*/
function nextChar(curr) {
if (curr.pos + curr.dir < 0 || curr.pos + curr.dir >= curr.line.length) {
curr.line = null;
} }
and modifies the line, ln, and pos members to represent the else {
next valid position or sets them to null if there are curr.pos += curr.dir;
no more valid positions. }
*/ }
/*
Performs one iteration of traversal in forward direction
Returns an index object of the new location
*/
function forward(cm, ln, pos, dir) {
var line = cm.getLine(ln);
var curr = {
line: line,
ln: ln,
pos: pos,
dir: dir,
};
if (curr.line === "") {
return { ln: curr.ln, pos: curr.pos };
}
var lastSentencePos = curr.pos;
// Move one step to skip character we start on
nextChar(curr);
while (curr.line !== null) {
lastSentencePos = curr.pos;
if (isEndOfSentenceSymbol(curr.line[curr.pos])) {
if (!inclusive) {
return { ln: curr.ln, pos: curr.pos + 1 };
} else {
nextChar(curr);
while (curr.line !== null ) {
if (isWhiteSpaceString(curr.line[curr.pos])) {
lastSentencePos = curr.pos;
nextChar(curr);
} else {
break;
}
}
return { ln: curr.ln, pos: lastSentencePos + 1, };
}
}
nextChar(curr);
}
return { ln: curr.ln, pos: lastSentencePos + 1 };
}
/*
Performs one iteration of traversal in reverse direction
Returns an index object of the new location
*/
function reverse(cm, ln, pos, dir) {
var line = cm.getLine(ln);
var curr = {
line: line,
ln: ln,
pos: pos,
dir: dir,
};
if (curr.line === "") {
return { ln: curr.ln, pos: curr.pos };
}
var lastSentencePos = curr.pos;
// Move one step to skip character we start on
nextChar(curr);
while (curr.line !== null) {
if (!isWhiteSpaceString(curr.line[curr.pos]) && !isEndOfSentenceSymbol(curr.line[curr.pos])) {
lastSentencePos = curr.pos;
}
else if (isEndOfSentenceSymbol(curr.line[curr.pos]) ) {
if (!inclusive) {
return { ln: curr.ln, pos: lastSentencePos };
} else {
if (isWhiteSpaceString(curr.line[curr.pos + 1])) {
return { ln: curr.ln, pos: curr.pos + 1, };
} else {
return {ln: curr.ln, pos: lastSentencePos};
}
}
}
nextChar(curr);
}
curr.line = line;
if (inclusive && isWhiteSpaceString(curr.line[curr.pos])) {
return { ln: curr.ln, pos: curr.pos };
} else {
return { ln: curr.ln, pos: lastSentencePos };
}
}
var curr_index = {
ln: cur.line,
pos: cur.ch,
};
while (repeat > 0) {
if (dir < 0) {
curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);
}
else {
curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);
}
repeat--;
}
return new Pos(curr_index.ln, curr_index.pos);
}
function findSentence(cm, cur, repeat, dir) {
/*
Takes an index object
{
line: the line string,
ln: line number,
pos: index in line,
dir: direction of traversal (-1 or 1)
}
and modifies the line, ln, and pos members to represent the
next valid position or sets them to null if there are
no more valid positions.
*/
function nextChar(cm, idx) { function nextChar(cm, idx) {
if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) { if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {
idx.ln += idx.dir; idx.ln += idx.dir;
@@ -3843,12 +4011,12 @@
ln: ln, ln: ln,
pos: pos, pos: pos,
dir: dir, dir: dir,
} };
var last_valid = { var last_valid = {
ln: curr.ln, ln: curr.ln,
pos: curr.pos, pos: curr.pos,
} };
var skip_empty_lines = (curr.line === ""); var skip_empty_lines = (curr.line === "");
@@ -3904,7 +4072,7 @@
ln: ln, ln: ln,
pos: pos, pos: pos,
dir: dir, dir: dir,
} };
var last_valid = { var last_valid = {
ln: curr.ln, ln: curr.ln,
@@ -3933,7 +4101,7 @@
} }
else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) { else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
skip_empty_lines = false; skip_empty_lines = false;
last_valid = { ln: curr.ln, pos: curr.pos } last_valid = { ln: curr.ln, pos: curr.pos };
} }
nextChar(cm, curr); nextChar(cm, curr);
@@ -4325,7 +4493,7 @@
} }
function showConfirm(cm, template) { function showConfirm(cm, template) {
var pre = dom('pre', {$color: 'red', class: 'cm-vim-message'}, template); var pre = dom('div', {$color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message'}, template);
if (cm.openNotification) { if (cm.openNotification) {
cm.openNotification(pre, {bottom: true, duration: 5000}); cm.openNotification(pre, {bottom: true, duration: 5000});
} else { } else {
@@ -4920,7 +5088,7 @@
for (var registerName in registers) { for (var registerName in registers) {
var text = registers[registerName].toString(); var text = registers[registerName].toString();
if (text.length) { if (text.length) {
regInfo += '"' + registerName + ' ' + text + '\n' regInfo += '"' + registerName + ' ' + text + '\n';
} }
} }
} else { } else {
@@ -4932,7 +5100,7 @@
continue; continue;
} }
var register = registers[registerName] || new Register(); var register = registers[registerName] || new Register();
regInfo += '"' + registerName + ' ' + register.toString() + '\n' regInfo += '"' + registerName + ' ' + register.toString() + '\n';
} }
} }
showConfirm(cm, regInfo); showConfirm(cm, regInfo);
@@ -5726,9 +5894,85 @@
} }
} }
// multiselect support
function cloneVimState(state) {
var n = new state.constructor();
Object.keys(state).forEach(function(key) {
var o = state[key];
if (Array.isArray(o))
o = o.slice();
else if (o && typeof o == "object" && o.constructor != Object)
o = cloneVimState(o);
n[key] = o;
});
if (state.sel) {
n.sel = {
head: state.sel.head && copyCursor(state.sel.head),
anchor: state.sel.anchor && copyCursor(state.sel.anchor)
};
}
return n;
}
function multiSelectHandleKey(cm, key, origin) {
var isHandled = false;
var vim = vimApi.maybeInitVimState_(cm);
var visualBlock = vim.visualBlock || vim.wasInVisualBlock;
var wasMultiselect = cm.isInMultiSelectMode();
if (vim.wasInVisualBlock && !wasMultiselect) {
vim.wasInVisualBlock = false;
} else if (wasMultiselect && vim.visualBlock) {
vim.wasInVisualBlock = true;
}
if (key == '<Esc>' && !vim.insertMode && !vim.visualMode && wasMultiselect && vim.status == "<Esc>") {
// allow editor to exit multiselect
clearInputState(cm);
} else if (visualBlock || !wasMultiselect || cm.inVirtualSelectionMode) {
isHandled = vimApi.handleKey(cm, key, origin);
} else {
var old = cloneVimState(vim);
cm.operation(function() {
cm.curOp.isVimOp = true;
cm.forEachSelection(function() {
var head = cm.getCursor("head");
var anchor = cm.getCursor("anchor");
var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;
var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;
head = offsetCursor(head, 0, headOffset);
anchor = offsetCursor(anchor, 0, anchorOffset);
cm.state.vim.sel.head = head;
cm.state.vim.sel.anchor = anchor;
isHandled = vimApi.handleKey(cm, key, origin);
if (cm.virtualSelection) {
cm.state.vim = cloneVimState(old);
}
});
if (cm.curOp.cursorActivity && !isHandled)
cm.curOp.cursorActivity = false;
cm.state.vim = vim;
}, true);
}
// some commands may bring visualMode and selection out of sync
if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) {
handleExternalSelection(cm, vim);
}
return isHandled;
}
resetVimGlobalState(); resetVimGlobalState();
return vimApi;
}; return vimApi;
// Initialize Vim and make it available as an API. }
CodeMirror.Vim = Vim();
}); function initVim(CodeMirror5) {
CodeMirror5.Vim = initVim$1(CodeMirror5);
return CodeMirror5.Vim;
}
CodeMirror.Vim = initVim(CodeMirror);
});

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/* /*
* ===================================================================================== * =====================================================================================

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11 // Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -484,7 +484,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"instanceof interface native new package private protected public " + "instanceof interface native new package private protected public " +
"return static strictfp super switch synchronized this throw throws transient " + "return static strictfp super switch synchronized this throw throws transient " +
"try volatile while @interface"), "try volatile while @interface"),
types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " + types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float " +
"Integer Long Number Object Short String StringBuffer StringBuilder Void"), "Integer Long Number Object Short String StringBuffer StringBuilder Void"),
blockKeywords: words("catch class do else finally for if switch try while"), blockKeywords: words("catch class do else finally for if switch try while"),
defKeywords: words("class interface enum @interface"), defKeywords: words("class interface enum @interface"),
@@ -498,6 +498,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
stream.eatWhile(/[\w\$_]/); stream.eatWhile(/[\w\$_]/);
return "meta"; return "meta";
},
'"': function(stream, state) {
if (!stream.match(/""$/)) return false;
state.tokenize = tokenTripleString;
return state.tokenize(stream, state);
} }
}, },
modeProps: {fold: ["brace", "import"]} modeProps: {fold: ["brace", "import"]}
@@ -659,7 +664,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
"file import where by get set abstract enum open inner override private public internal " + "file import where by get set abstract enum open inner override private public internal " +
"protected catch finally out final vararg reified dynamic companion constructor init " + "protected catch finally out final vararg reified dynamic companion constructor init " +
"sealed field property receiver param sparam lateinit data inline noinline tailrec " + "sealed field property receiver param sparam lateinit data inline noinline tailrec " +
"external annotation crossinline const operator infix suspend actual expect setparam" "external annotation crossinline const operator infix suspend actual expect setparam value"
), ),
types: words( types: words(
/* package java.lang */ /* package java.lang */

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports === "object" && typeof module === "object") // CommonJS if (typeof exports === "object" && typeof module === "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") if (typeof exports == "object" && typeof module == "object")

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/** /**
* Author: Gautam Mehta * Author: Gautam Mehta
@@ -195,7 +195,7 @@ CodeMirror.defineMode("cobol", function () {
case "string": // multi-line string parsing mode case "string": // multi-line string parsing mode
var next = false; var next = false;
while ((next = stream.next()) != null) { while ((next = stream.next()) != null) {
if (next == "\"" || next == "\'") { if ((next == "\"" || next == "\'") && !stream.match(/['"]/, false)) {
state.mode = false; state.mode = false;
break; break;
} }

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/** /**
* Link to the project's GitHub page: * Link to the project's GitHub page:

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -114,6 +114,7 @@ CodeMirror.defineMode("commonlisp", function (config) {
closeBrackets: {pairs: "()[]{}\"\""}, closeBrackets: {pairs: "()[]{}\"\""},
lineComment: ";;", lineComment: ";;",
fold: "brace-paren",
blockCommentStart: "#|", blockCommentStart: "#|",
blockCommentEnd: "|#" blockCommentEnd: "|#"
}; };

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -164,10 +164,10 @@
} else { } else {
if(delim = stream.match(/^%([^\w\s=])/)) { if(delim = stream.match(/^%([^\w\s=])/)) {
delim = delim[1]; delim = delim[1];
} else if (stream.match(/^%[a-zA-Z0-9_\u009F-\uFFFF]*/)) { } else if (stream.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/)) {
// Macro variables // Macro variables
return "meta"; return "meta";
} else { } else if (stream.eat('%')) {
// '%' operator // '%' operator
return "operator"; return "operator";
} }

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -228,7 +228,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
if (type == "}" || type == "{") return popAndPass(type, stream, state); if (type == "}" || type == "{") return popAndPass(type, stream, state);
if (type == "(") return pushContext(state, stream, "parens"); if (type == "(") return pushContext(state, stream, "parens");
if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) { if (type == "hash" && !/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(stream.current())) {
override += " error"; override += " error";
} else if (type == "word") { } else if (type == "word") {
wordAsValue(stream); wordAsValue(stream);
@@ -443,13 +443,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"monochrome", "min-monochrome", "max-monochrome", "resolution", "monochrome", "min-monochrome", "max-monochrome", "resolution",
"min-resolution", "max-resolution", "scan", "grid", "orientation", "min-resolution", "max-resolution", "scan", "grid", "orientation",
"device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
"pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme" "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme",
"dynamic-range", "video-dynamic-range"
], mediaFeatures = keySet(mediaFeatures_); ], mediaFeatures = keySet(mediaFeatures_);
var mediaValueKeywords_ = [ var mediaValueKeywords_ = [
"landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
"interlace", "progressive", "interlace", "progressive",
"dark", "light" "dark", "light",
"standard", "high"
], mediaValueKeywords = keySet(mediaValueKeywords_); ], mediaValueKeywords = keySet(mediaValueKeywords_);
var propertyKeywords_ = [ var propertyKeywords_ = [
@@ -482,7 +484,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"cue-before", "cursor", "direction", "display", "dominant-baseline", "cue-before", "cursor", "direction", "display", "dominant-baseline",
"drop-initial-after-adjust", "drop-initial-after-align", "drop-initial-after-adjust", "drop-initial-after-align",
"drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size", "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size",
"drop-initial-value", "elevation", "empty-cells", "fit", "fit-position", "drop-initial-value", "elevation", "empty-cells", "fit", "fit-content", "fit-position",
"flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow",
"flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into", "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into",
"font", "font-family", "font-feature-settings", "font-kerning", "font", "font-family", "font-feature-settings", "font-kerning",
@@ -564,7 +566,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
], propertyKeywords = keySet(propertyKeywords_); ], propertyKeywords = keySet(propertyKeywords_);
var nonStandardPropertyKeywords_ = [ var nonStandardPropertyKeywords_ = [
"border-block", "border-block-color", "border-block-end", "accent-color", "aspect-ratio", "border-block", "border-block-color", "border-block-end",
"border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-end-color", "border-block-end-style", "border-block-end-width",
"border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start", "border-block-start-color", "border-block-start-style",
"border-block-start-width", "border-block-style", "border-block-width", "border-block-start-width", "border-block-style", "border-block-width",
@@ -572,9 +574,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"border-inline-end-color", "border-inline-end-style", "border-inline-end-color", "border-inline-end-style",
"border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-end-width", "border-inline-start", "border-inline-start-color",
"border-inline-start-style", "border-inline-start-width", "border-inline-start-style", "border-inline-start-width",
"border-inline-style", "border-inline-width", "margin-block", "border-inline-style", "border-inline-width", "content-visibility", "margin-block",
"margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end", "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end",
"margin-inline-start", "padding-block", "padding-block-end", "margin-inline-start", "overflow-anchor", "overscroll-behavior", "padding-block", "padding-block-end",
"padding-block-start", "padding-inline", "padding-inline-end", "padding-block-start", "padding-inline", "padding-inline-end",
"padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color", "padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color",
"scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
@@ -598,16 +600,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
"burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
"darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen",
"darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
"darkslateblue", "darkslategray", "darkturquoise", "darkviolet", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet",
"deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick",
"floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
"gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
"hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
"lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
"lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink",
"lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey",
"lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
"maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
"mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
@@ -617,7 +619,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
"purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
"salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
"slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan",
"teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
"whitesmoke", "yellow", "yellowgreen" "whitesmoke", "yellow", "yellowgreen"
], colorKeywords = keySet(colorKeywords_); ], colorKeywords = keySet(colorKeywords_);
@@ -628,21 +630,21 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
"arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
"avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary",
"bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box",
"both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button",
"buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
"capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
"cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
"cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
"col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
"compact", "condensed", "contain", "content", "contents", "compact", "condensed", "conic-gradient", "contain", "content", "contents",
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop",
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
"destination-in", "destination-out", "destination-over", "devanagari", "difference", "destination-in", "destination-out", "destination-over", "devanagari", "difference",
"disc", "discard", "disclosure-closed", "disclosure-open", "document", "disc", "discard", "disclosure-closed", "disclosure-open", "document",
"dot-dash", "dot-dot-dash", "dot-dash", "dot-dot-dash",
"dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "dotted", "double", "down", "drop-shadow", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
"element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
"ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
"ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
@@ -652,10 +654,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
"extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
"forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", "forwards", "from", "geometricPrecision", "georgian", "grayscale", "graytext", "grid", "groove",
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
"help", "hidden", "hide", "higher", "highlight", "highlighttext", "help", "hidden", "hide", "higher", "highlight", "highlighttext",
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "hue-rotate", "icon", "ignore",
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
"inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
@@ -667,14 +669,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
"lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
"lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d", "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d",
"media-controls-background", "media-current-time-display", "media-play-button", "media-slider", "media-sliderthumb",
"media-fullscreen-button", "media-mute-button", "media-play-button", "media-volume-slider", "media-volume-sliderthumb", "medium",
"media-return-to-realtime-button", "media-rewind-button", "menu", "menulist", "menulist-button",
"media-seek-back-button", "media-seek-forward-button", "media-slider", "menutext", "message-box", "middle", "min-intrinsic",
"media-sliderthumb", "media-time-remaining-display", "media-volume-slider",
"media-volume-slider-container", "media-volume-sliderthumb", "medium",
"menu", "menulist", "menulist-button", "menulist-text",
"menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic",
"mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize", "mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize",
"narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
"no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
@@ -685,15 +683,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
"pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
"progress", "push-button", "radial-gradient", "radio", "read-only", "progress", "push-button", "radial-gradient", "radio", "read-only",
"read-write", "read-write-plaintext-only", "rectangle", "region", "read-write", "read-write-plaintext-only", "rectangle", "region",
"relative", "repeat", "repeating-linear-gradient", "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient",
"repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", "repeating-conic-gradient", "repeat-x", "repeat-y", "reset", "reverse",
"rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
"rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
"s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
"scroll", "scrollbar", "scroll-position", "se-resize", "searchfield", "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
"searchfield-cancel-button", "searchfield-decoration", "searchfield-cancel-button", "searchfield-decoration",
"searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end", "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
"semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", "semi-condensed", "semi-expanded", "separate", "sepia", "serif", "show", "sidama",
"simp-chinese-formal", "simp-chinese-informal", "single", "simp-chinese-formal", "simp-chinese-informal", "single",
"skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
"slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// By the Neo4j Team and contributors. // By the Neo4j Team and contributors.
// https://github.com/neo4j-contrib/CodeMirror // https://github.com/neo4j-contrib/CodeMirror
@@ -19,6 +19,7 @@
CodeMirror.defineMode("cypher", function(config) { CodeMirror.defineMode("cypher", function(config) {
var tokenBase = function(stream/*, state*/) { var tokenBase = function(stream/*, state*/) {
curPunc = null
var ch = stream.next(); var ch = stream.next();
if (ch ==='"') { if (ch ==='"') {
stream.match(/^[^"]*"/); stream.match(/^[^"]*"/);

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/* /*
DTD mode DTD mode

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE // Distributed under an MIT license: http://codemirror.net/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -230,6 +230,8 @@
startState: function () { return { f: normal() }; }, startState: function () { return { f: normal() }; },
copyState: function (s) { return { f: s.f }; }, copyState: function (s) { return { f: s.f }; },
lineComment: '--',
token: function(stream, state) { token: function(stream, state) {
var type = state.f(stream, function(s) { state.f = s; }); var type = state.f(stream, function(s) { state.f = s; });
var word = stream.current(); var word = stream.current();

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/*jshint unused:true, eqnull:true, curly:true, bitwise:true */ /*jshint unused:true, eqnull:true, curly:true, bitwise:true */
/*jshint undef:true, latedef:true, trailing:true */ /*jshint undef:true, latedef:true, trailing:true */

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Factor syntax highlight - simple mode // Factor syntax highlight - simple mode
// //
@@ -77,7 +77,7 @@
// specific to simple modes. // specific to simple modes.
meta: { meta: {
dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"], dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"],
lineComment: [ "!", "#!" ] lineComment: "!"
} }
}); });

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Author: Aliaksei Chapyzhenka // Author: Aliaksei Chapyzhenka

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -112,7 +112,7 @@ CodeMirror.defineMode("fortran", function() {
"c_short", "c_signed_char", "c_size_t", "character", "c_short", "c_signed_char", "c_size_t", "character",
"complex", "double", "integer", "logical", "real"]); "complex", "double", "integer", "logical", "real"]);
var isOperatorChar = /[+\-*&=<>\/\:]/; var isOperatorChar = /[+\-*&=<>\/\:]/;
var litOperator = new RegExp("(\.and\.|\.or\.|\.eq\.|\.lt\.|\.le\.|\.gt\.|\.ge\.|\.ne\.|\.not\.|\.eqv\.|\.neqv\.)", "i"); var litOperator = /^\.(and|or|eq|lt|le|gt|ge|ne|not|eqv|neqv)\./i;
function tokenBase(stream, state) { function tokenBase(stream, state) {

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -144,18 +144,26 @@ CodeMirror.defineMode("gas", function(_config, parserConfig) {
function x86(_parserConfig) { function x86(_parserConfig) {
lineCommentStartSymbol = "#"; lineCommentStartSymbol = "#";
registers.al = "variable";
registers.ah = "variable";
registers.ax = "variable"; registers.ax = "variable";
registers.eax = "variable-2"; registers.eax = "variable-2";
registers.rax = "variable-3"; registers.rax = "variable-3";
registers.bl = "variable";
registers.bh = "variable";
registers.bx = "variable"; registers.bx = "variable";
registers.ebx = "variable-2"; registers.ebx = "variable-2";
registers.rbx = "variable-3"; registers.rbx = "variable-3";
registers.cl = "variable";
registers.ch = "variable";
registers.cx = "variable"; registers.cx = "variable";
registers.ecx = "variable-2"; registers.ecx = "variable-2";
registers.rcx = "variable-3"; registers.rcx = "variable-3";
registers.dl = "variable";
registers.dh = "variable";
registers.dx = "variable"; registers.dx = "variable";
registers.edx = "variable-2"; registers.edx = "variable-2";
registers.rdx = "variable-3"; registers.rdx = "variable-3";

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/* /*
Gherkin mode - http://www.cukes.info/ Gherkin mode - http://www.cukes.info/

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -24,7 +24,7 @@ CodeMirror.defineMode("go", function(config) {
"float32":true, "float64":true, "int8":true, "int16":true, "int32":true, "float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
"int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true, "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
"uint64":true, "int":true, "uint":true, "uintptr":true, "error": true, "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true,
"rune":true "rune":true, "any":true, "comparable":true
}; };
var atoms = { var atoms = {

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -91,9 +91,14 @@ CodeMirror.defineMode("groovy", function(config) {
if (!tripleQuoted) { break; } if (!tripleQuoted) { break; }
if (stream.match(quote + quote)) { end = true; break; } if (stream.match(quote + quote)) { end = true; break; }
} }
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) { if (quote == '"' && next == "$" && !escaped) {
state.tokenize.push(tokenBaseUntilBrace()); if (stream.eat("{")) {
return "string"; state.tokenize.push(tokenBaseUntilBrace());
return "string";
} else if (stream.match(/^\w/, false)) {
state.tokenize.push(tokenVariableDeref);
return "string";
}
} }
escaped = !escaped && next == "\\"; escaped = !escaped && next == "\\";
} }
@@ -122,6 +127,15 @@ CodeMirror.defineMode("groovy", function(config) {
return t; return t;
} }
function tokenVariableDeref(stream, state) {
var next = stream.match(/^(\.|[\w\$_]+)/)
if (!next) {
state.tokenize.pop()
return state.tokenize[state.tokenize.length-1](stream, state)
}
return next[0] == "." ? null : "variable"
}
function tokenComment(stream, state) { function tokenComment(stream, state) {
var maybeEnd = false, ch; var maybeEnd = false, ch;
while (ch = stream.next()) { while (ch = stream.next()) {

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function (mod) { (function (mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -50,7 +50,7 @@
} }
function getTagRegexp(tagName, anchored) { function getTagRegexp(tagName, anchored) {
return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i"); return new RegExp((anchored ? "^" : "") + "<\/\\s*" + tagName + "\\s*>", "i");
} }
function addTags(from, to) { function addTags(from, to) {

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -16,6 +16,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
var statementIndent = parserConfig.statementIndent; var statementIndent = parserConfig.statementIndent;
var jsonldMode = parserConfig.jsonld; var jsonldMode = parserConfig.jsonld;
var jsonMode = parserConfig.json || jsonldMode; var jsonMode = parserConfig.json || jsonldMode;
var trackScope = parserConfig.trackScope !== false
var isTS = parserConfig.typescript; var isTS = parserConfig.typescript;
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
@@ -231,6 +232,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
} }
function inScope(state, varname) { function inScope(state, varname) {
if (!trackScope) return false
for (var v = state.localVars; v; v = v.next) for (var v = state.localVars; v; v = v.next)
if (v.name == varname) return true; if (v.name == varname) return true;
for (var cx = state.context; cx; cx = cx.prev) { for (var cx = state.context; cx; cx = cx.prev) {
@@ -277,6 +279,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function register(varname) { function register(varname) {
var state = cx.state; var state = cx.state;
cx.marked = "def"; cx.marked = "def";
if (!trackScope) return
if (state.context) { if (state.context) {
if (state.lexical.info == "var" && state.context && state.context.block) { if (state.lexical.info == "var" && state.context && state.context.block) {
// FIXME function decls are also not block scoped // FIXME function decls are also not block scoped
@@ -327,6 +330,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
cx.state.context = new Context(cx.state.context, cx.state.localVars, true) cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
cx.state.localVars = null cx.state.localVars = null
} }
pushcontext.lex = pushblockcontext.lex = true
function popcontext() { function popcontext() {
cx.state.localVars = cx.state.context.vars cx.state.localVars = cx.state.context.vars
cx.state.context = cx.state.context.prev cx.state.context = cx.state.context.prev
@@ -376,7 +380,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
} }
if (type == "function") return cont(functiondef); if (type == "function") return cont(functiondef);
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); if (type == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex);
if (type == "class" || (isTS && value == "interface")) { if (type == "class" || (isTS && value == "interface")) {
cx.marked = "keyword" cx.marked = "keyword"
return cont(pushlex("form", type == "class" ? type : value), className, poplex) return cont(pushlex("form", type == "class" ? type : value), className, poplex)
@@ -479,7 +483,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
function quasi(type, value) { function quasi(type, value) {
if (type != "quasi") return pass(); if (type != "quasi") return pass();
if (value.slice(value.length - 2) != "${") return cont(quasi); if (value.slice(value.length - 2) != "${") return cont(quasi);
return cont(expression, continueQuasi); return cont(maybeexpression, continueQuasi);
} }
function continueQuasi(type) { function continueQuasi(type) {
if (type == "}") { if (type == "}") {
@@ -619,6 +623,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType) if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType)
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType) if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)
if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr) if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
if (type == "quasi") { return pass(quasiType, afterType); }
} }
function maybeReturnType(type) { function maybeReturnType(type) {
if (type == "=>") return cont(typeexpr) if (type == "=>") return cont(typeexpr)
@@ -644,6 +649,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
return cont() return cont()
} }
} }
function quasiType(type, value) {
if (type != "quasi") return pass();
if (value.slice(value.length - 2) != "${") return cont(quasiType);
return cont(typeexpr, continueQuasiType);
}
function continueQuasiType(type) {
if (type == "}") {
cx.marked = "string-2";
cx.state.tokenize = tokenQuasi;
return cont(quasiType);
}
}
function typearg(type, value) { function typearg(type, value) {
if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg) if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
if (type == ":") return cont(typeexpr) if (type == ":") return cont(typeexpr)
@@ -783,6 +800,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (value == "@") return cont(expression, classBody) if (value == "@") return cont(expression, classBody)
} }
function classfield(type, value) { function classfield(type, value) {
if (value == "!") return cont(classfield)
if (value == "?") return cont(classfield) if (value == "?") return cont(classfield)
if (type == ":") return cont(typeexpr, maybeAssign) if (type == ":") return cont(typeexpr, maybeAssign)
if (value == "=") return cont(expressionNoComma) if (value == "=") return cont(expressionNoComma)
@@ -883,7 +901,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
var c = state.cc[i]; var c = state.cc[i];
if (c == poplex) lexical = lexical.prev; if (c == poplex) lexical = lexical.prev;
else if (c != maybeelse) break; else if (c != maybeelse && c != popcontext) break;
} }
while ((lexical.type == "stat" || lexical.type == "form") && while ((lexical.type == "stat" || lexical.type == "form") &&
(firstChar == "}" || ((top = state.cc[state.cc.length - 1]) && (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
@@ -920,8 +938,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
expressionAllowed: expressionAllowed, expressionAllowed: expressionAllowed,
skipExpression: function(state) { skipExpression: function(state) {
var top = state.cc[state.cc.length - 1] parseJS(state, "atom", "atom", "true", new CodeMirror.StringStream("", 2, null))
if (top == expression || top == expressionNoComma) state.cc.pop()
} }
}; };
}); });

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -13,18 +13,18 @@
CodeMirror.defineMode("jinja2", function() { CodeMirror.defineMode("jinja2", function() {
var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
"extends", "filter", "endfilter", "firstof", "for", "extends", "filter", "endfilter", "firstof", "do", "for",
"endfor", "if", "endif", "ifchanged", "endifchanged", "endfor", "if", "endif", "ifchanged", "endifchanged",
"ifequal", "endifequal", "ifnotequal", "ifequal", "endifequal", "ifnotequal", "set", "raw", "endraw",
"endifnotequal", "in", "include", "load", "not", "now", "or", "endifnotequal", "in", "include", "load", "not", "now", "or",
"parsed", "regroup", "reversed", "spaceless", "parsed", "regroup", "reversed", "spaceless", "call", "endcall", "macro",
"endspaceless", "ssi", "templatetag", "openblock", "endmacro", "endspaceless", "ssi", "templatetag", "openblock",
"closeblock", "openvariable", "closevariable", "closeblock", "openvariable", "closevariable", "without", "context",
"openbrace", "closebrace", "opencomment", "openbrace", "closebrace", "opencomment",
"closecomment", "widthratio", "url", "with", "endwith", "closecomment", "widthratio", "url", "with", "endwith",
"get_current_language", "trans", "endtrans", "noop", "blocktrans", "get_current_language", "trans", "endtrans", "noop", "blocktrans",
"endblocktrans", "get_available_languages", "endblocktrans", "get_available_languages",
"get_current_language_bidi", "plural"], "get_current_language_bidi", "pluralize", "autoescape", "endautoescape"],
operator = /^[+\-*&%=<>!?|~^]/, operator = /^[+\-*&%=<>!?|~^]/,
sign = /^[:\[\(\{]/, sign = /^[:\[\(\{]/,
atom = ["true", "false"], atom = ["true", "false"],
@@ -78,7 +78,24 @@
state.instring = ch; state.instring = ch;
stream.next(); stream.next();
return "string"; return "string";
} else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) { }
else if (state.inbraces > 0 && ch ==")") {
stream.next()
state.inbraces--;
}
else if (ch == "(") {
stream.next()
state.inbraces++;
}
else if (state.inbrackets > 0 && ch =="]") {
stream.next()
state.inbrackets--;
}
else if (ch == "[") {
stream.next()
state.inbrackets++;
}
else if (!state.lineTag && (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}"))) {
state.intag = false; state.intag = false;
return "tag"; return "tag";
} else if(stream.match(operator)) { } else if(stream.match(operator)) {
@@ -87,6 +104,10 @@
} else if(stream.match(sign)) { } else if(stream.match(sign)) {
state.sign = true; state.sign = true;
} else { } else {
if (stream.column() == 1 && state.lineTag && stream.match(keywords)) {
//allow nospace after tag before the keyword
return "keyword";
}
if(stream.eat(" ") || stream.sol()) { if(stream.eat(" ") || stream.sol()) {
if(stream.match(keywords)) { if(stream.match(keywords)) {
return "keyword"; return "keyword";
@@ -120,25 +141,51 @@
} else if (ch = stream.eat(/\{|%/)) { } else if (ch = stream.eat(/\{|%/)) {
//Cache close tag //Cache close tag
state.intag = ch; state.intag = ch;
state.inbraces = 0;
state.inbrackets = 0;
if(ch == "{") { if(ch == "{") {
state.intag = "}"; state.intag = "}";
} }
stream.eat("-"); stream.eat("-");
return "tag"; return "tag";
} }
//Line statements
} else if (stream.eat('#')) {
if (stream.peek() == '#') {
stream.skipToEnd();
return "comment"
}
else if (!stream.eol()) {
state.intag = true;
state.lineTag = true;
state.inbraces = 0;
state.inbrackets = 0;
return "tag";
}
} }
stream.next(); stream.next();
}; };
return { return {
startState: function () { startState: function () {
return {tokenize: tokenBase}; return {
tokenize: tokenBase,
inbrackets:0,
inbraces:0
};
}, },
token: function (stream, state) { token: function(stream, state) {
return state.tokenize(stream, state); var style = state.tokenize(stream, state);
if (stream.eol() && state.lineTag && !state.instring && state.inbraces == 0 && state.inbrackets == 0) {
//Close line statement at the EOL
state.intag = false
state.lineTag = false
}
return style;
}, },
blockCommentStart: "{#", blockCommentStart: "{#",
blockCommentEnd: "#}" blockCommentEnd: "#}",
lineComment: "##",
}; };
}); });

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -104,9 +104,9 @@
function jsToken(stream, state, cx) { function jsToken(stream, state, cx) {
if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) { if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) {
jsMode.skipExpression(cx.state)
state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")), state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")),
xmlMode, 0, state.context) xmlMode, 0, state.context)
jsMode.skipExpression(cx.state)
return null return null
} }

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -12,9 +12,10 @@
"use strict"; "use strict";
CodeMirror.defineMode("julia", function(config, parserConf) { CodeMirror.defineMode("julia", function(config, parserConf) {
function wordRegexp(words, end) { function wordRegexp(words, end, pre) {
if (typeof pre === "undefined") { pre = ""; }
if (typeof end === "undefined") { end = "\\b"; } if (typeof end === "undefined") { end = "\\b"; }
return new RegExp("^((" + words.join(")|(") + "))" + end); return new RegExp("^" + pre + "((" + words.join(")|(") + "))" + end);
} }
var octChar = "\\\\[0-7]{1,3}"; var octChar = "\\\\[0-7]{1,3}";
@@ -22,13 +23,18 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
var sChar = "\\\\[abefnrtv0%?'\"\\\\]"; var sChar = "\\\\[abefnrtv0%?'\"\\\\]";
var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])"; var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])";
var asciiOperatorsList = [
"[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/",
"\\.{2,3}", "[\\.\\\\%*+\\-<>!\\/^|&]=?", "\\?", "\\$", "~", ":"
];
var operators = parserConf.operators || wordRegexp([ var operators = parserConf.operators || wordRegexp([
"[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/", "[<>]:", "[<>=]=", "[!=]==", "<<=?", ">>>?=?", "=>?", "--?>", "<--[->]?", "\\/\\/",
"[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", "[\\\\%*+\\-<>!\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":",
"\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218",
"\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264",
"\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5",
"\\b(in|isa)\\b(?!\.?\\()"], ""); "\\b(in|isa)\\b(?!\.?\\()"
], "");
var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; var delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
var identifiers = parserConf.identifiers || var identifiers = parserConf.identifiers ||
/^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/; /^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/;
@@ -57,10 +63,13 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
var keywords = wordRegexp(keywordsList); var keywords = wordRegexp(keywordsList);
var builtins = wordRegexp(builtinsList); var builtins = wordRegexp(builtinsList);
var macro = /^@[_A-Za-z][\w]*/; var macro = /^@[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/; var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/;
var macroOperators = wordRegexp(asciiOperatorsList, "", "@");
var symbolOperators = wordRegexp(asciiOperatorsList, "", ":");
function inArray(state) { function inArray(state) {
return (state.nestedArrays > 0); return (state.nestedArrays > 0);
} }
@@ -165,8 +174,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
} }
// Handle symbols // Handle symbols
if (!leavingExpr && stream.match(symbol) || if (!leavingExpr && (stream.match(symbol) || stream.match(symbolOperators))) {
stream.match(/:([<>]:|<<=?|>>>?=?|->|\/\/|\.{2,3}|[\.\\%*+\-<>!\/^|&]=?|[~\?\$])/)) {
return "builtin"; return "builtin";
} }
@@ -212,7 +220,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) {
return state.tokenize(stream, state); return state.tokenize(stream, state);
} }
if (stream.match(macro)) { if (stream.match(macro) || stream.match(macroOperators)) {
return "meta"; return "meta";
} }

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/** /**
* Link to the project's GitHub page: * Link to the project's GitHub page:

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's // LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
// CodeMirror 1 mode. // CodeMirror 1 mode.

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Mathematica mode copyright (c) 2015 by Calin Barbat // Mathematica mode copyright (c) 2015 by Calin Barbat
// Based on code by Patrick Scheibe (halirutan) // Based on code by Patrick Scheibe (halirutan)

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -19,7 +19,7 @@
{name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]}, {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]}, {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
{name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy", "cbl"]},
{name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]},
{name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
{name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
@@ -44,7 +44,7 @@
{name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]}, {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
{name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
{name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]}, {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: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
{name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
{name: "Esper", mime: "text/x-esper", mode: "sql"}, {name: "Esper", mime: "text/x-esper", mode: "sql"},
@@ -71,12 +71,12 @@
{name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
{name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
{name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript", "application/javascript;env=frontend", "application/javascript;env=backend"], {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript", "application/javascript;env=frontend", "application/javascript;env=backend"],
mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
{name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
{name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]}, {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]},
{name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]}, {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]},
{name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"], alias: ["jl"]},
{name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]}, {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]},
{name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
{name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara //mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -60,7 +60,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) {
} }
} }
if (ch === '(') { if (ch === '(') {
if (stream.eat('*')) { if (stream.match(/^\*(?!\))/)) {
state.commentLevel++; state.commentLevel++;
state.tokenize = tokenComment; state.tokenize = tokenComment;
return state.tokenize(stream, state); return state.tokenize(stream, state);

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Modelica support for CodeMirror, copyright (c) by Lennart Ochel // Modelica support for CodeMirror, copyright (c) by Lennart Ochel

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// mode(s) for the sequence chart dsl's mscgen, xù and msgenny // mode(s) for the sequence chart dsl's mscgen, xù and msgenny
// For more information on mscgen, see the site of the original author: // For more information on mscgen, see the site of the original author:

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/* /*
This MUMPS Language script was constructed using vbscript.js as a template. This MUMPS Language script was constructed using vbscript.js as a template.

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// Author: Jan T. Sott (http://github.com/idleberg) // Author: Jan T. Sott (http://github.com/idleberg)
@@ -24,42 +24,42 @@ CodeMirror.defineSimpleMode("nsis",{
{ regex: /`(?:[^\\`]|\\.)*`?/, token: "string" }, { regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
// Compile Time Commands // Compile Time Commands
{regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace))\b/, token: "keyword"}, {regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"},
// Conditional Compilation // Conditional Compilation
{regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true}, {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i, token: "keyword", indent: true},
{regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true}, {regex: /^\s*(?:\!(else|endif|macroend))\b/i, token: "keyword", dedent: true},
// Runtime Commands // 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|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*(?: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|GetWinVer|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|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/i, token: "keyword"},
{regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true}, {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/i, token: "keyword", indent: true},
{regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true}, {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/i, token: "keyword", dedent: true},
// Command Options // Command Options
{regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/, token: "atom"}, {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/i, token: "atom"},
{regex: /\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/, token: "builtin"}, {regex: /\b(?:admin|all|amd64-unicode|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|x-86-(ansi|unicode)|zlib)\b/i, token: "builtin"},
// LogicLib.nsh // LogicLib.nsh
{regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/, token: "variable-2", indent: true}, {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:2|3|4|5|Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true},
// FileFunc.nsh // FileFunc.nsh
{regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/, token: "variable-2", dedent: true}, {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i, token: "variable-2", dedent: true},
// Memento.nsh // Memento.nsh
{regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/, token: "variable-2", dedent: true}, {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/i, token: "variable-2", dedent: true},
// TextFunc.nsh // TextFunc.nsh
{regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/, token: "variable-2", dedent: true}, {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/i, token: "variable-2", dedent: true},
// WinVer.nsh // WinVer.nsh
{regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/, token: "variable", dedent: true}, {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/i, token: "variable", dedent: true},
// WordFunc.nsh // WordFunc.nsh
{regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/, token: "variable-2", dedent: true}, {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/i, token: "variable-2", dedent: true},
// x64.nsh // x64.nsh
{regex: /\$\{(?:RunningX64)\}/, token: "variable", dedent: true}, {regex: /\$\{(?:RunningX64)\}/i, token: "variable", dedent: true},
{regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/, token: "variable-2", dedent: true}, {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/i, token: "variable-2", dedent: true},
// Line Comment // Line Comment
{regex: /(#|;).*/, token: "comment"}, {regex: /(#|;).*/, token: "comment"},
@@ -71,20 +71,20 @@ CodeMirror.defineSimpleMode("nsis",{
{regex: /[-+\/*=<>!]+/, token: "operator"}, {regex: /[-+\/*=<>!]+/, token: "operator"},
// Variable // Variable
{regex: /\$\w+/, token: "variable"}, {regex: /\$\w[\w\.]*/, token: "variable"},
// Constant // Constant
{regex: /\${[\w\.:-]+}/, token: "variable-2"}, {regex: /\${[\!\w\.:-]+}/, token: "variable-2"},
// Language String // Language String
{regex: /\$\([\w\.:-]+\)/, token: "variable-3"} {regex: /\$\([\!\w\.:-]+\)/, token: "variable-3"}
], ],
comment: [ comment: [
{regex: /.*?\*\//, token: "comment", next: "start"}, {regex: /.*?\*\//, token: "comment", next: "start"},
{regex: /.*/, token: "comment"} {regex: /.*/, token: "comment"}
], ],
meta: { meta: {
electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/, electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/i,
blockCommentStart: "/*", blockCommentStart: "/*",
blockCommentEnd: "*/", blockCommentEnd: "*/",
lineComment: ["#", ";"] lineComment: ["#", ";"]

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/********************************************************** /**********************************************************
* This script provides syntax highlighting support for * This script provides syntax highlighting support for

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) // CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) // This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
@@ -513,9 +513,8 @@ CodeMirror.defineMode("perl",function(){
return null; return null;
if(state.chain) if(state.chain)
return tokenChain(stream,state,state.chain,state.style,state.tail); return tokenChain(stream,state,state.chain,state.style,state.tail);
if(stream.match(/^\-?[\d\.]/,false)) if(stream.match(/^(\-?((\d[\d_]*)?\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F_]+|0b[01_]+|\d[\d_]*(e[+-]?\d+)?)/))
if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) return 'number';
return 'number';
if(stream.match(/^<<(?=[_a-zA-Z])/)){ // NOTE: <<SOMETHING\n...\nSOMETHING\n if(stream.match(/^<<(?=[_a-zA-Z])/)){ // NOTE: <<SOMETHING\n...\nSOMETHING\n
stream.eatWhile(/\w/); stream.eatWhile(/\w/);
return tokenSOMETHING(stream,state,stream.current().substr(2));} return tokenSOMETHING(stream,state,stream.current().substr(2));}

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
/* /*
* Pig Latin Mode for CodeMirror 2 * Pig Latin Mode for CodeMirror 2

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
'use strict'; 'use strict';

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -32,7 +32,7 @@
"sorted", "staticmethod", "str", "sum", "super", "tuple", "sorted", "staticmethod", "str", "sum", "super", "tuple",
"type", "vars", "zip", "__import__", "NotImplemented", "type", "vars", "zip", "__import__", "NotImplemented",
"Ellipsis", "__debug__"]; "Ellipsis", "__debug__"];
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins)); CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins).concat(["exec", "print"]));
function top(state) { function top(state) {
return state.scopes[state.scopes.length - 1]; return state.scopes[state.scopes.length - 1];
@@ -62,7 +62,7 @@
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/; var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]); myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]); myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i"); var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i");
} else { } else {
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/; var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
myKeywords = myKeywords.concat(["exec", "print"]); myKeywords = myKeywords.concat(["exec", "print"]);
@@ -298,7 +298,10 @@
} }
function tokenLexer(stream, state) { function tokenLexer(stream, state) {
if (stream.sol()) state.beginningOfLine = true; if (stream.sol()) {
state.beginningOfLine = true;
state.dedent = false;
}
var style = state.tokenize(stream, state); var style = state.tokenize(stream, state);
var current = stream.current(); var current = stream.current();
@@ -315,10 +318,10 @@
// Handle scope changes. // Handle scope changes.
if (current == "pass" || current == "return") if (current == "pass" || current == "return")
state.dedent += 1; state.dedent = true;
if (current == "lambda") state.lambda = true; if (current == "lambda") state.lambda = true;
if (current == ":" && !state.lambda && top(state).type == "py") if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
pushPyScope(state); pushPyScope(state);
if (current.length == 1 && !/string|comment/.test(style)) { if (current.length == 1 && !/string|comment/.test(style)) {
@@ -332,10 +335,8 @@
else return ERRORCLASS; else return ERRORCLASS;
} }
} }
if (state.dedent > 0 && stream.eol() && top(state).type == "py") { if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
if (state.scopes.length > 1) state.scopes.pop(); state.scopes.pop();
state.dedent -= 1;
}
return style; return style;
} }
@@ -370,14 +371,16 @@
if (state.tokenize != tokenBase) if (state.tokenize != tokenBase)
return state.tokenize.isString ? CodeMirror.Pass : 0; return state.tokenize.isString ? CodeMirror.Pass : 0;
var scope = top(state), closing = scope.type == textAfter.charAt(0) var scope = top(state)
var closing = scope.type == textAfter.charAt(0) ||
scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter)
if (scope.align != null) if (scope.align != null)
return scope.align - (closing ? 1 : 0) return scope.align - (closing ? 1 : 0)
else else
return scope.offset - (closing ? hangingIndent : 0) return scope.offset - (closing ? hangingIndent : 0)
}, },
electricInput: /^\s*[\}\]\)]$/, electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
closeBrackets: {triples: "'\""}, closeBrackets: {triples: "'\""},
lineComment: "#", lineComment: "#",
fold: "indent" fold: "indent"

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -54,9 +54,9 @@ CodeMirror.defineMode("r", function(config) {
} else if (ch == "`") { } else if (ch == "`") {
stream.match(/[^`]+`/); stream.match(/[^`]+`/);
return "variable-3"; return "variable-3";
} else if (ch == "." && stream.match(/.[.\d]+/)) { } else if (ch == "." && stream.match(/.(?:[.]|\d+)/)) {
return "keyword"; return "keyword";
} else if (/[\w\.]/.test(ch) && ch != "_") { } else if (/[a-zA-Z\.]/.test(ch)) {
stream.eatWhile(/[\w\.]/); stream.eatWhile(/[\w\.]/);
var word = stream.current(); var word = stream.current();
if (atoms.propertyIsEnumerable(word)) return "atom"; if (atoms.propertyIsEnumerable(word)) return "atom";

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS
@@ -26,7 +26,7 @@ var keywordList = [
"require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__"
], keywords = wordObj(keywordList); ], keywords = wordObj(keywordList);
var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then", var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module",
"catch", "loop", "proc", "begin"]); "catch", "loop", "proc", "begin"]);
var dedentWords = wordObj(["end", "until"]); var dedentWords = wordObj(["end", "until"]);
var opening = {"[": "]", "{": "}", "(": ")"}; var opening = {"[": "]", "{": "}", "(": ")"};

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
(function(mod) { (function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS if (typeof exports == "object" && typeof module == "object") // CommonJS

View File

@@ -1,5 +1,5 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others // 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/5/LICENSE
// SAS mode copyright (c) 2016 Jared Dean, SAS Institute // SAS mode copyright (c) 2016 Jared Dean, SAS Institute

Some files were not shown because too many files have changed in this diff Show More