codemirror-rails 4.5 → 4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +5 -2
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +18 -4
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/merge/merge.js +6 -6
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +28 -4
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +3 -5
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +5 -13
- data/vendor/assets/javascripts/codemirror/modes/modelica.js +245 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/rst.js +29 -50
- data/vendor/assets/javascripts/codemirror/modes/sass.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +2 -1
- data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/xml.js +1 -1
- data/vendor/assets/javascripts/codemirror.js +32 -32
- data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +1 -1
- data/vendor/assets/stylesheets/codemirror/themes/mbo.css +10 -14
- data/vendor/assets/stylesheets/codemirror.css +9 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0dc163906cdde80e53bf37feab12977c1e7b2b2
|
4
|
+
data.tar.gz: b0873a8e31d2bf4de51277bf0f0905cb5ca513cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79b85436b6af48c0b30b94449c633b645150b52c43a9bed89a491e899cd66edfbc785f37438f67521a7197990ea9daca9d2734ac2342d60c0a8afe2faef23f73
|
7
|
+
data.tar.gz: 3c7ddbd04956e5297f60d017c3da1ab6155b88e8ebf34bc5829ec36941b79a338d2b909a865ad813f3872b70c716f9b12b5919bd1a103491e03f9f4631fb8df7
|
@@ -129,8 +129,8 @@
|
|
129
129
|
CodeMirror.defineExtension("openNotification", function(template, options) {
|
130
130
|
closeNotification(this, close);
|
131
131
|
var dialog = dialogDiv(this, template, options && options.bottom);
|
132
|
-
var duration = options && (options.duration === undefined ? 5000 : options.duration);
|
133
132
|
var closed = false, doneTimer;
|
133
|
+
var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000;
|
134
134
|
|
135
135
|
function close() {
|
136
136
|
if (closed) return;
|
@@ -143,7 +143,10 @@
|
|
143
143
|
CodeMirror.e_preventDefault(e);
|
144
144
|
close();
|
145
145
|
});
|
146
|
+
|
146
147
|
if (duration)
|
147
|
-
doneTimer = setTimeout(close,
|
148
|
+
doneTimer = setTimeout(close, duration);
|
149
|
+
|
150
|
+
return close;
|
148
151
|
});
|
149
152
|
});
|
@@ -102,11 +102,25 @@
|
|
102
102
|
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
103
103
|
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
104
104
|
if (tok.type == "string" || tok.string.charAt(0) != "<" ||
|
105
|
-
tok.start != pos.ch - 1
|
106
|
-
!state.context || !state.context.tagName ||
|
107
|
-
closingTagExists(cm, state.context.tagName, pos, state))
|
105
|
+
tok.start != pos.ch - 1)
|
108
106
|
return CodeMirror.Pass;
|
109
|
-
|
107
|
+
// Kludge to get around the fact that we are not in XML mode
|
108
|
+
// when completing in JS/CSS snippet in htmlmixed mode. Does not
|
109
|
+
// work for other XML embedded languages (there is no general
|
110
|
+
// way to go from a mixed mode to its current XML state).
|
111
|
+
if (inner.mode.name != "xml") {
|
112
|
+
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript")
|
113
|
+
replacements[i] = "/script>";
|
114
|
+
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css")
|
115
|
+
replacements[i] = "/style>";
|
116
|
+
else
|
117
|
+
return CodeMirror.Pass;
|
118
|
+
} else {
|
119
|
+
if (!state.context || !state.context.tagName ||
|
120
|
+
closingTagExists(cm, state.context.tagName, pos, state))
|
121
|
+
return CodeMirror.Pass;
|
122
|
+
replacements[i] = "/" + state.context.tagName + ">";
|
123
|
+
}
|
110
124
|
}
|
111
125
|
cm.replaceSelections(replacements);
|
112
126
|
ranges = cm.listSelections();
|
@@ -3,9 +3,9 @@
|
|
3
3
|
|
4
4
|
(function(mod) {
|
5
5
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
-
mod(require("../../lib/codemirror"));
|
6
|
+
mod(require("../../lib/codemirror", "./xml-hint"));
|
7
7
|
else if (typeof define == "function" && define.amd) // AMD
|
8
|
-
define(["../../lib/codemirror"], mod);
|
8
|
+
define(["../../lib/codemirror", "./xml-hint"], mod);
|
9
9
|
else // Plain browser env
|
10
10
|
mod(CodeMirror);
|
11
11
|
})(function(CodeMirror) {
|
@@ -1,17 +1,17 @@
|
|
1
1
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
2
|
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
3
|
|
4
|
+
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL
|
5
|
+
|
4
6
|
(function(mod) {
|
5
7
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
-
mod(require("../../lib/codemirror"));
|
8
|
+
mod(require("../../lib/codemirror"), require("diff_match_patch"));
|
7
9
|
else if (typeof define == "function" && define.amd) // AMD
|
8
|
-
define(["../../lib/codemirror"], mod);
|
10
|
+
define(["../../lib/codemirror", "diff_match_patch"], mod);
|
9
11
|
else // Plain browser env
|
10
|
-
mod(CodeMirror);
|
11
|
-
})(function(CodeMirror) {
|
12
|
+
mod(CodeMirror, diff_match_patch);
|
13
|
+
})(function(CodeMirror, diff_match_patch) {
|
12
14
|
"use strict";
|
13
|
-
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL
|
14
|
-
|
15
15
|
var Pos = CodeMirror.Pos;
|
16
16
|
var svgNS = "http://www.w3.org/2000/svg";
|
17
17
|
|
@@ -8,12 +8,15 @@
|
|
8
8
|
// document.
|
9
9
|
//
|
10
10
|
// The option can be set to true to simply enable it, or to a
|
11
|
-
// {minChars, style, showToken} object to explicitly
|
12
|
-
// minChars is the minimum amount of characters that should be
|
11
|
+
// {minChars, style, wordsOnly, showToken, delay} object to explicitly
|
12
|
+
// configure it. minChars is the minimum amount of characters that should be
|
13
13
|
// selected for the behavior to occur, and style is the token style to
|
14
14
|
// apply to the matches. This will be prefixed by "cm-" to create an
|
15
|
-
// actual CSS class name.
|
16
|
-
//
|
15
|
+
// actual CSS class name. If wordsOnly is enabled, the matches will be
|
16
|
+
// highlighted only if the selected text is a word. showToken, when enabled,
|
17
|
+
// will cause the current token to be highlighted when nothing is selected.
|
18
|
+
// delay is used to specify how much time to wait, in milliseconds, before
|
19
|
+
// highlighting the matches.
|
17
20
|
|
18
21
|
(function(mod) {
|
19
22
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -28,6 +31,7 @@
|
|
28
31
|
var DEFAULT_MIN_CHARS = 2;
|
29
32
|
var DEFAULT_TOKEN_STYLE = "matchhighlight";
|
30
33
|
var DEFAULT_DELAY = 100;
|
34
|
+
var DEFAULT_WORDS_ONLY = false;
|
31
35
|
|
32
36
|
function State(options) {
|
33
37
|
if (typeof options == "object") {
|
@@ -35,10 +39,12 @@
|
|
35
39
|
this.style = options.style;
|
36
40
|
this.showToken = options.showToken;
|
37
41
|
this.delay = options.delay;
|
42
|
+
this.wordsOnly = options.wordsOnly;
|
38
43
|
}
|
39
44
|
if (this.style == null) this.style = DEFAULT_TOKEN_STYLE;
|
40
45
|
if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS;
|
41
46
|
if (this.delay == null) this.delay = DEFAULT_DELAY;
|
47
|
+
if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY;
|
42
48
|
this.overlay = this.timeout = null;
|
43
49
|
}
|
44
50
|
|
@@ -81,12 +87,30 @@
|
|
81
87
|
}
|
82
88
|
var from = cm.getCursor("from"), to = cm.getCursor("to");
|
83
89
|
if (from.line != to.line) return;
|
90
|
+
if (state.wordsOnly && !isWord(cm, from, to)) return;
|
84
91
|
var selection = cm.getRange(from, to).replace(/^\s+|\s+$/g, "");
|
85
92
|
if (selection.length >= state.minChars)
|
86
93
|
cm.addOverlay(state.overlay = makeOverlay(selection, false, state.style));
|
87
94
|
});
|
88
95
|
}
|
89
96
|
|
97
|
+
function isWord(cm, from, to) {
|
98
|
+
var str = cm.getRange(from, to);
|
99
|
+
if (str.match(/^\w+$/) !== null) {
|
100
|
+
if (from.ch > 0) {
|
101
|
+
var pos = {line: from.line, ch: from.ch - 1};
|
102
|
+
var chr = cm.getRange(pos, from);
|
103
|
+
if (chr.match(/\W/) === null) return false;
|
104
|
+
}
|
105
|
+
if (to.ch < cm.getLine(from.line).length) {
|
106
|
+
var pos = {line: to.line, ch: to.ch + 1};
|
107
|
+
var chr = cm.getRange(to, pos);
|
108
|
+
if (chr.match(/\W/) === null) return false;
|
109
|
+
}
|
110
|
+
return true;
|
111
|
+
} else return false;
|
112
|
+
}
|
113
|
+
|
90
114
|
function boundariesAround(stream, re) {
|
91
115
|
return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) &&
|
92
116
|
(stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos)));
|
@@ -30,6 +30,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
|
|
30
30
|
|
31
31
|
function html(stream, state) {
|
32
32
|
var tagName = state.htmlState.tagName;
|
33
|
+
if (tagName) tagName = tagName.toLowerCase();
|
33
34
|
var style = htmlMode.token(stream, state.htmlState);
|
34
35
|
if (tagName == "script" && /\btag\b/.test(style) && stream.current() == ">") {
|
35
36
|
// Script block: mode to change to depends on type attribute
|
@@ -391,7 +391,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
391
391
|
function maybeoperatorNoComma(type, value, noComma) {
|
392
392
|
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
393
393
|
var expr = noComma == false ? expression : expressionNoComma;
|
394
|
-
if (
|
394
|
+
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
395
395
|
if (type == "operator") {
|
396
396
|
if (/\+\+|--/.test(value)) return cont(me);
|
397
397
|
if (value == "?") return cont(expression, expect(":"), expr);
|
@@ -417,13 +417,11 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
417
417
|
}
|
418
418
|
function arrowBody(type) {
|
419
419
|
findFatArrow(cx.stream, cx.state);
|
420
|
-
|
421
|
-
return pass(expression);
|
420
|
+
return pass(type == "{" ? statement : expression);
|
422
421
|
}
|
423
422
|
function arrowBodyNoComma(type) {
|
424
423
|
findFatArrow(cx.stream, cx.state);
|
425
|
-
|
426
|
-
return pass(expressionNoComma);
|
424
|
+
return pass(type == "{" ? statement : expressionNoComma);
|
427
425
|
}
|
428
426
|
function maybelabel(type) {
|
429
427
|
if (type == ":") return cont(poplex, statement);
|
@@ -360,15 +360,12 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
360
360
|
|
361
361
|
var ch = stream.next();
|
362
362
|
|
363
|
-
if (state.escape) {
|
364
|
-
state.escape = false;
|
365
|
-
return getType(state);
|
366
|
-
}
|
367
|
-
|
368
363
|
if (ch === '\\') {
|
369
|
-
|
370
|
-
|
371
|
-
|
364
|
+
stream.next();
|
365
|
+
if (modeCfg.highlightFormatting) {
|
366
|
+
var type = getType(state);
|
367
|
+
return type ? type + " formatting-escape" : "formatting-escape";
|
368
|
+
}
|
372
369
|
}
|
373
370
|
|
374
371
|
// Matches link titles present on next line
|
@@ -650,7 +647,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
650
647
|
inline: inlineNormal,
|
651
648
|
text: handleText,
|
652
649
|
|
653
|
-
escape: false,
|
654
650
|
formatting: false,
|
655
651
|
linkText: false,
|
656
652
|
linkHref: false,
|
@@ -683,7 +679,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
683
679
|
|
684
680
|
inline: s.inline,
|
685
681
|
text: s.text,
|
686
|
-
escape: false,
|
687
682
|
formatting: false,
|
688
683
|
linkTitle: s.linkTitle,
|
689
684
|
em: s.em,
|
@@ -718,9 +713,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
718
713
|
state.thisLineHasContent = true;
|
719
714
|
}
|
720
715
|
|
721
|
-
// Reset state.escape
|
722
|
-
state.escape = false;
|
723
|
-
|
724
716
|
// Reset state.taskList
|
725
717
|
state.taskList = false;
|
726
718
|
|
@@ -0,0 +1,245 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
// Modelica support for CodeMirror, copyright (c) by Lennart Ochel
|
5
|
+
|
6
|
+
(function(mod) {
|
7
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8
|
+
mod(require("../../lib/codemirror"));
|
9
|
+
else if (typeof define == "function" && define.amd) // AMD
|
10
|
+
define(["../../lib/codemirror"], mod);
|
11
|
+
else // Plain browser env
|
12
|
+
mod(CodeMirror);
|
13
|
+
})
|
14
|
+
|
15
|
+
(function(CodeMirror) {
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
CodeMirror.defineMode("modelica", function(config, parserConfig) {
|
19
|
+
|
20
|
+
var indentUnit = config.indentUnit;
|
21
|
+
var keywords = parserConfig.keywords || {};
|
22
|
+
var builtin = parserConfig.builtin || {};
|
23
|
+
var atoms = parserConfig.atoms || {};
|
24
|
+
|
25
|
+
var isSingleOperatorChar = /[;=\(:\),{}.*<>+\-\/^\[\]]/;
|
26
|
+
var isDoubleOperatorChar = /(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/;
|
27
|
+
var isDigit = /[0-9]/;
|
28
|
+
var isNonDigit = /[_a-zA-Z]/;
|
29
|
+
|
30
|
+
function tokenLineComment(stream, state) {
|
31
|
+
stream.skipToEnd();
|
32
|
+
state.tokenize = null;
|
33
|
+
return "comment";
|
34
|
+
}
|
35
|
+
|
36
|
+
function tokenBlockComment(stream, state) {
|
37
|
+
var maybeEnd = false, ch;
|
38
|
+
while (ch = stream.next()) {
|
39
|
+
if (maybeEnd && ch == "/") {
|
40
|
+
state.tokenize = null;
|
41
|
+
break;
|
42
|
+
}
|
43
|
+
maybeEnd = (ch == "*");
|
44
|
+
}
|
45
|
+
return "comment";
|
46
|
+
}
|
47
|
+
|
48
|
+
function tokenString(stream, state) {
|
49
|
+
var escaped = false, ch;
|
50
|
+
while ((ch = stream.next()) != null) {
|
51
|
+
if (ch == '"' && !escaped) {
|
52
|
+
state.tokenize = null;
|
53
|
+
state.sol = false;
|
54
|
+
break;
|
55
|
+
}
|
56
|
+
escaped = !escaped && ch == "\\";
|
57
|
+
}
|
58
|
+
|
59
|
+
return "string";
|
60
|
+
}
|
61
|
+
|
62
|
+
function tokenIdent(stream, state) {
|
63
|
+
stream.eatWhile(isDigit);
|
64
|
+
while (stream.eat(isDigit) || stream.eat(isNonDigit)) { }
|
65
|
+
|
66
|
+
|
67
|
+
var cur = stream.current();
|
68
|
+
|
69
|
+
if(state.sol && (cur == "package" || cur == "model" || cur == "when" || cur == "connector")) state.level++;
|
70
|
+
else if(state.sol && cur == "end" && state.level > 0) state.level--;
|
71
|
+
|
72
|
+
state.tokenize = null;
|
73
|
+
state.sol = false;
|
74
|
+
|
75
|
+
if (keywords.propertyIsEnumerable(cur)) return "keyword";
|
76
|
+
else if (builtin.propertyIsEnumerable(cur)) return "builtin";
|
77
|
+
else if (atoms.propertyIsEnumerable(cur)) return "atom";
|
78
|
+
else return "variable";
|
79
|
+
}
|
80
|
+
|
81
|
+
function tokenQIdent(stream, state) {
|
82
|
+
while (stream.eat(/[^']/)) { }
|
83
|
+
|
84
|
+
state.tokenize = null;
|
85
|
+
state.sol = false;
|
86
|
+
|
87
|
+
if(stream.eat("'"))
|
88
|
+
return "variable";
|
89
|
+
else
|
90
|
+
return "error";
|
91
|
+
}
|
92
|
+
|
93
|
+
function tokenUnsignedNuber(stream, state) {
|
94
|
+
stream.eatWhile(isDigit);
|
95
|
+
if (stream.eat('.')) {
|
96
|
+
stream.eatWhile(isDigit);
|
97
|
+
}
|
98
|
+
if (stream.eat('e') || stream.eat('E')) {
|
99
|
+
if (!stream.eat('-'))
|
100
|
+
stream.eat('+');
|
101
|
+
stream.eatWhile(isDigit);
|
102
|
+
}
|
103
|
+
|
104
|
+
state.tokenize = null;
|
105
|
+
state.sol = false;
|
106
|
+
return "number";
|
107
|
+
}
|
108
|
+
|
109
|
+
// Interface
|
110
|
+
return {
|
111
|
+
startState: function() {
|
112
|
+
return {
|
113
|
+
tokenize: null,
|
114
|
+
level: 0,
|
115
|
+
sol: true
|
116
|
+
};
|
117
|
+
},
|
118
|
+
|
119
|
+
token: function(stream, state) {
|
120
|
+
if(state.tokenize != null) {
|
121
|
+
return state.tokenize(stream, state);
|
122
|
+
}
|
123
|
+
|
124
|
+
if(stream.sol()) {
|
125
|
+
state.sol = true;
|
126
|
+
}
|
127
|
+
|
128
|
+
// WHITESPACE
|
129
|
+
if(stream.eatSpace()) {
|
130
|
+
state.tokenize = null;
|
131
|
+
return null;
|
132
|
+
}
|
133
|
+
|
134
|
+
var ch = stream.next();
|
135
|
+
|
136
|
+
// LINECOMMENT
|
137
|
+
if(ch == '/' && stream.eat('/')) {
|
138
|
+
state.tokenize = tokenLineComment;
|
139
|
+
}
|
140
|
+
// BLOCKCOMMENT
|
141
|
+
else if(ch == '/' && stream.eat('*')) {
|
142
|
+
state.tokenize = tokenBlockComment;
|
143
|
+
}
|
144
|
+
// TWO SYMBOL TOKENS
|
145
|
+
else if(isDoubleOperatorChar.test(ch+stream.peek())) {
|
146
|
+
stream.next();
|
147
|
+
state.tokenize = null;
|
148
|
+
return "operator";
|
149
|
+
}
|
150
|
+
// SINGLE SYMBOL TOKENS
|
151
|
+
else if(isSingleOperatorChar.test(ch)) {
|
152
|
+
state.tokenize = null;
|
153
|
+
return "operator";
|
154
|
+
}
|
155
|
+
// IDENT
|
156
|
+
else if(isNonDigit.test(ch)) {
|
157
|
+
state.tokenize = tokenIdent;
|
158
|
+
}
|
159
|
+
// Q-IDENT
|
160
|
+
else if(ch == "'" && stream.peek() && stream.peek() != "'") {
|
161
|
+
state.tokenize = tokenQIdent;
|
162
|
+
}
|
163
|
+
// STRING
|
164
|
+
else if(ch == '"') {
|
165
|
+
state.tokenize = tokenString;
|
166
|
+
}
|
167
|
+
// UNSIGNED_NUBER
|
168
|
+
else if(isDigit.test(ch)) {
|
169
|
+
state.tokenize = tokenUnsignedNuber;
|
170
|
+
}
|
171
|
+
// ERROR
|
172
|
+
else {
|
173
|
+
state.tokenize = null;
|
174
|
+
return "error";
|
175
|
+
}
|
176
|
+
|
177
|
+
return state.tokenize(stream, state);
|
178
|
+
},
|
179
|
+
|
180
|
+
indent: function(state, textAfter) {
|
181
|
+
if (state.tokenize != null) return CodeMirror.Pass;
|
182
|
+
|
183
|
+
var level = state.level;
|
184
|
+
if(/(algorithm)/.test(textAfter)) level--;
|
185
|
+
if(/(equation)/.test(textAfter)) level--;
|
186
|
+
if(/(initial algorithm)/.test(textAfter)) level--;
|
187
|
+
if(/(initial equation)/.test(textAfter)) level--;
|
188
|
+
if(/(end)/.test(textAfter)) level--;
|
189
|
+
|
190
|
+
if(level > 0)
|
191
|
+
return indentUnit*level;
|
192
|
+
else
|
193
|
+
return 0;
|
194
|
+
},
|
195
|
+
|
196
|
+
blockCommentStart: "/*",
|
197
|
+
blockCommentEnd: "*/",
|
198
|
+
lineComment: "//"
|
199
|
+
};
|
200
|
+
});
|
201
|
+
|
202
|
+
function words(str) {
|
203
|
+
var obj = {}, words = str.split(" ");
|
204
|
+
for (var i=0; i<words.length; ++i)
|
205
|
+
obj[words[i]] = true;
|
206
|
+
return obj;
|
207
|
+
}
|
208
|
+
|
209
|
+
var modelicaKeywords = "algorithm and annotation assert block break class connect connector constant constrainedby der discrete each else elseif elsewhen encapsulated end enumeration equation expandable extends external false final flow for function if import impure in initial inner input loop model not operator or outer output package parameter partial protected public pure record redeclare replaceable return stream then true type when while within";
|
210
|
+
var modelicaBuiltin = "abs acos actualStream asin atan atan2 cardinality ceil cos cosh delay div edge exp floor getInstanceName homotopy inStream integer log log10 mod pre reinit rem semiLinear sign sin sinh spatialDistribution sqrt tan tanh";
|
211
|
+
var modelicaAtoms = "Real Boolean Integer String";
|
212
|
+
|
213
|
+
function def(mimes, mode) {
|
214
|
+
if (typeof mimes == "string")
|
215
|
+
mimes = [mimes];
|
216
|
+
|
217
|
+
var words = [];
|
218
|
+
|
219
|
+
function add(obj) {
|
220
|
+
if (obj)
|
221
|
+
for (var prop in obj)
|
222
|
+
if (obj.hasOwnProperty(prop))
|
223
|
+
words.push(prop);
|
224
|
+
}
|
225
|
+
|
226
|
+
add(mode.keywords);
|
227
|
+
add(mode.builtin);
|
228
|
+
add(mode.atoms);
|
229
|
+
|
230
|
+
if (words.length) {
|
231
|
+
mode.helperType = mimes[0];
|
232
|
+
CodeMirror.registerHelper("hintWords", mimes[0], words);
|
233
|
+
}
|
234
|
+
|
235
|
+
for (var i=0; i<mimes.length; ++i)
|
236
|
+
CodeMirror.defineMIME(mimes[i], mode);
|
237
|
+
}
|
238
|
+
|
239
|
+
def(["text/x-modelica"], {
|
240
|
+
name: "modelica",
|
241
|
+
keywords: words(modelicaKeywords),
|
242
|
+
builtin: words(modelicaBuiltin),
|
243
|
+
atoms: words(modelicaAtoms)
|
244
|
+
});
|
245
|
+
});
|
@@ -15,12 +15,12 @@
|
|
15
15
|
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
16
16
|
}
|
17
17
|
|
18
|
-
var wordOperators = wordRegexp(["and", "or", "not", "is"
|
18
|
+
var wordOperators = wordRegexp(["and", "or", "not", "is"]);
|
19
19
|
var commonKeywords = ["as", "assert", "break", "class", "continue",
|
20
20
|
"def", "del", "elif", "else", "except", "finally",
|
21
21
|
"for", "from", "global", "if", "import",
|
22
22
|
"lambda", "pass", "raise", "return",
|
23
|
-
"try", "while", "with", "yield"];
|
23
|
+
"try", "while", "with", "yield", "in"];
|
24
24
|
var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
|
25
25
|
"classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
|
26
26
|
"enumerate", "eval", "filter", "float", "format", "frozenset",
|
@@ -80,19 +80,6 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
80
80
|
});
|
81
81
|
}
|
82
82
|
|
83
|
-
function AssertException(message) {
|
84
|
-
this.message = message;
|
85
|
-
}
|
86
|
-
|
87
|
-
AssertException.prototype.toString = function () {
|
88
|
-
return 'AssertException: ' + this.message;
|
89
|
-
};
|
90
|
-
|
91
|
-
function assert(expression, message) {
|
92
|
-
if (!expression) throw new AssertException(message);
|
93
|
-
return expression;
|
94
|
-
}
|
95
|
-
|
96
83
|
///////////////////////////////////////////////////////////////////////////
|
97
84
|
///////////////////////////////////////////////////////////////////////////
|
98
85
|
|
@@ -185,12 +172,12 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
185
172
|
switch (stage(state)) {
|
186
173
|
case 0:
|
187
174
|
change(state, to_normal, context(rx_role_pre, 1));
|
188
|
-
|
175
|
+
stream.match(/^:/);
|
189
176
|
token = 'meta';
|
190
177
|
break;
|
191
178
|
case 1:
|
192
179
|
change(state, to_normal, context(rx_role_pre, 2));
|
193
|
-
|
180
|
+
stream.match(rx_NAME);
|
194
181
|
token = 'keyword';
|
195
182
|
|
196
183
|
if (stream.current().match(/^(?:math|latex)/)) {
|
@@ -199,7 +186,7 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
199
186
|
break;
|
200
187
|
case 2:
|
201
188
|
change(state, to_normal, context(rx_role_pre, 3));
|
202
|
-
|
189
|
+
stream.match(/^:`/);
|
203
190
|
token = 'meta';
|
204
191
|
break;
|
205
192
|
case 3:
|
@@ -221,21 +208,20 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
221
208
|
}
|
222
209
|
|
223
210
|
change(state, to_normal, context(rx_role_pre, 4));
|
224
|
-
|
211
|
+
stream.match(rx_TEXT2);
|
225
212
|
token = 'string';
|
226
213
|
break;
|
227
214
|
case 4:
|
228
215
|
change(state, to_normal, context(rx_role_pre, 5));
|
229
|
-
|
216
|
+
stream.match(/^`/);
|
230
217
|
token = 'meta';
|
231
218
|
break;
|
232
219
|
case 5:
|
233
220
|
change(state, to_normal, context(rx_role_pre, 6));
|
234
|
-
|
221
|
+
stream.match(rx_TAIL);
|
235
222
|
break;
|
236
223
|
default:
|
237
224
|
change(state, to_normal);
|
238
|
-
assert(stream.current() == '');
|
239
225
|
}
|
240
226
|
} else if (phase(state) == rx_role_suf ||
|
241
227
|
stream.match(rx_role_suf, false)) {
|
@@ -243,62 +229,60 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
243
229
|
switch (stage(state)) {
|
244
230
|
case 0:
|
245
231
|
change(state, to_normal, context(rx_role_suf, 1));
|
246
|
-
|
232
|
+
stream.match(/^`/);
|
247
233
|
token = 'meta';
|
248
234
|
break;
|
249
235
|
case 1:
|
250
236
|
change(state, to_normal, context(rx_role_suf, 2));
|
251
|
-
|
237
|
+
stream.match(rx_TEXT2);
|
252
238
|
token = 'string';
|
253
239
|
break;
|
254
240
|
case 2:
|
255
241
|
change(state, to_normal, context(rx_role_suf, 3));
|
256
|
-
|
242
|
+
stream.match(/^`:/);
|
257
243
|
token = 'meta';
|
258
244
|
break;
|
259
245
|
case 3:
|
260
246
|
change(state, to_normal, context(rx_role_suf, 4));
|
261
|
-
|
247
|
+
stream.match(rx_NAME);
|
262
248
|
token = 'keyword';
|
263
249
|
break;
|
264
250
|
case 4:
|
265
251
|
change(state, to_normal, context(rx_role_suf, 5));
|
266
|
-
|
252
|
+
stream.match(/^:/);
|
267
253
|
token = 'meta';
|
268
254
|
break;
|
269
255
|
case 5:
|
270
256
|
change(state, to_normal, context(rx_role_suf, 6));
|
271
|
-
|
257
|
+
stream.match(rx_TAIL);
|
272
258
|
break;
|
273
259
|
default:
|
274
260
|
change(state, to_normal);
|
275
|
-
assert(stream.current() == '');
|
276
261
|
}
|
277
262
|
} else if (phase(state) == rx_role || stream.match(rx_role, false)) {
|
278
263
|
|
279
264
|
switch (stage(state)) {
|
280
265
|
case 0:
|
281
266
|
change(state, to_normal, context(rx_role, 1));
|
282
|
-
|
267
|
+
stream.match(/^:/);
|
283
268
|
token = 'meta';
|
284
269
|
break;
|
285
270
|
case 1:
|
286
271
|
change(state, to_normal, context(rx_role, 2));
|
287
|
-
|
272
|
+
stream.match(rx_NAME);
|
288
273
|
token = 'keyword';
|
289
274
|
break;
|
290
275
|
case 2:
|
291
276
|
change(state, to_normal, context(rx_role, 3));
|
292
|
-
|
277
|
+
stream.match(/^:/);
|
293
278
|
token = 'meta';
|
294
279
|
break;
|
295
280
|
case 3:
|
296
281
|
change(state, to_normal, context(rx_role, 4));
|
297
|
-
|
282
|
+
stream.match(rx_TAIL);
|
298
283
|
break;
|
299
284
|
default:
|
300
285
|
change(state, to_normal);
|
301
|
-
assert(stream.current() == '');
|
302
286
|
}
|
303
287
|
} else if (phase(state) == rx_substitution_ref ||
|
304
288
|
stream.match(rx_substitution_ref, false)) {
|
@@ -306,7 +290,7 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
306
290
|
switch (stage(state)) {
|
307
291
|
case 0:
|
308
292
|
change(state, to_normal, context(rx_substitution_ref, 1));
|
309
|
-
|
293
|
+
stream.match(rx_substitution_text);
|
310
294
|
token = 'variable-2';
|
311
295
|
break;
|
312
296
|
case 1:
|
@@ -315,7 +299,6 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
315
299
|
break;
|
316
300
|
default:
|
317
301
|
change(state, to_normal);
|
318
|
-
assert(stream.current() == '');
|
319
302
|
}
|
320
303
|
} else if (stream.match(rx_footnote_ref)) {
|
321
304
|
change(state, to_normal);
|
@@ -341,21 +324,20 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
341
324
|
break;
|
342
325
|
case 1:
|
343
326
|
change(state, to_normal, context(rx_link_ref2, 2));
|
344
|
-
|
327
|
+
stream.match(/^`/);
|
345
328
|
token = 'link';
|
346
329
|
break;
|
347
330
|
case 2:
|
348
331
|
change(state, to_normal, context(rx_link_ref2, 3));
|
349
|
-
|
332
|
+
stream.match(rx_TEXT2);
|
350
333
|
break;
|
351
334
|
case 3:
|
352
335
|
change(state, to_normal, context(rx_link_ref2, 4));
|
353
|
-
|
336
|
+
stream.match(/^`_/);
|
354
337
|
token = 'link';
|
355
338
|
break;
|
356
339
|
default:
|
357
340
|
change(state, to_normal);
|
358
|
-
assert(stream.current() == '');
|
359
341
|
}
|
360
342
|
} else if (stream.match(rx_verbatim)) {
|
361
343
|
change(state, to_verbatim);
|
@@ -380,26 +362,25 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
380
362
|
switch (stage(state)) {
|
381
363
|
case 0:
|
382
364
|
change(state, to_explicit, context(rx_substitution, 1));
|
383
|
-
|
365
|
+
stream.match(rx_substitution_text);
|
384
366
|
token = 'variable-2';
|
385
367
|
break;
|
386
368
|
case 1:
|
387
369
|
change(state, to_explicit, context(rx_substitution, 2));
|
388
|
-
|
370
|
+
stream.match(rx_substitution_sepa);
|
389
371
|
break;
|
390
372
|
case 2:
|
391
373
|
change(state, to_explicit, context(rx_substitution, 3));
|
392
|
-
|
374
|
+
stream.match(rx_substitution_name);
|
393
375
|
token = 'keyword';
|
394
376
|
break;
|
395
377
|
case 3:
|
396
378
|
change(state, to_explicit, context(rx_substitution, 4));
|
397
|
-
|
379
|
+
stream.match(rx_substitution_tail);
|
398
380
|
token = 'meta';
|
399
381
|
break;
|
400
382
|
default:
|
401
383
|
change(state, to_normal);
|
402
|
-
assert(stream.current() == '');
|
403
384
|
}
|
404
385
|
} else if (phase(state) == rx_directive ||
|
405
386
|
stream.match(rx_directive, false)) {
|
@@ -407,7 +388,7 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
407
388
|
switch (stage(state)) {
|
408
389
|
case 0:
|
409
390
|
change(state, to_explicit, context(rx_directive, 1));
|
410
|
-
|
391
|
+
stream.match(rx_directive_name);
|
411
392
|
token = 'keyword';
|
412
393
|
|
413
394
|
if (stream.current().match(/^(?:math|latex)/))
|
@@ -417,7 +398,7 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
417
398
|
break;
|
418
399
|
case 1:
|
419
400
|
change(state, to_explicit, context(rx_directive, 2));
|
420
|
-
|
401
|
+
stream.match(rx_directive_tail);
|
421
402
|
token = 'meta';
|
422
403
|
|
423
404
|
if (stream.match(/^latex\s*$/) || state.tmp_stex) {
|
@@ -436,25 +417,23 @@ CodeMirror.defineMode('rst-base', function (config) {
|
|
436
417
|
break;
|
437
418
|
default:
|
438
419
|
change(state, to_normal);
|
439
|
-
assert(stream.current() == '');
|
440
420
|
}
|
441
421
|
} else if (phase(state) == rx_link || stream.match(rx_link, false)) {
|
442
422
|
|
443
423
|
switch (stage(state)) {
|
444
424
|
case 0:
|
445
425
|
change(state, to_explicit, context(rx_link, 1));
|
446
|
-
|
447
|
-
|
426
|
+
stream.match(rx_link_head);
|
427
|
+
stream.match(rx_link_name);
|
448
428
|
token = 'link';
|
449
429
|
break;
|
450
430
|
case 1:
|
451
431
|
change(state, to_explicit, context(rx_link, 2));
|
452
|
-
|
432
|
+
stream.match(rx_link_tail);
|
453
433
|
token = 'meta';
|
454
434
|
break;
|
455
435
|
default:
|
456
436
|
change(state, to_normal);
|
457
|
-
assert(stream.current() == '');
|
458
437
|
}
|
459
438
|
} else if (stream.match(rx_footnote)) {
|
460
439
|
change(state, to_normal);
|
@@ -53,7 +53,7 @@ CodeMirror.defineMode('smalltalk', function(config) {
|
|
53
53
|
stream.next();
|
54
54
|
token = nextSymbol(stream, new Context(nextSymbol, context));
|
55
55
|
} else {
|
56
|
-
if (stream.eatWhile(/[
|
56
|
+
if (stream.eatWhile(/[^\s.{}\[\]()]/))
|
57
57
|
token.name = 'string-2';
|
58
58
|
else
|
59
59
|
token.name = 'meta';
|
@@ -61,7 +61,7 @@ CodeMirror.defineMode('smalltalk', function(config) {
|
|
61
61
|
|
62
62
|
} else if (aChar === '$') {
|
63
63
|
if (stream.next() === '<') {
|
64
|
-
stream.eatWhile(/[
|
64
|
+
stream.eatWhile(/[^\s>]/);
|
65
65
|
stream.next();
|
66
66
|
}
|
67
67
|
token.name = 'string-2';
|
@@ -21,7 +21,7 @@ CodeMirror.defineMode("xml", function(config, parserConfig) {
|
|
21
21
|
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
22
22
|
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
23
23
|
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
24
|
-
'track': true, 'wbr': true},
|
24
|
+
'track': true, 'wbr': true, 'menuitem': true},
|
25
25
|
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
26
26
|
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
27
27
|
'th': true, 'tr': true},
|
@@ -1646,7 +1646,7 @@
|
|
1646
1646
|
|
1647
1647
|
var rect;
|
1648
1648
|
if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
|
1649
|
-
for (
|
1649
|
+
for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned
|
1650
1650
|
while (start && isExtendingChar(prepared.line.text.charAt(mStart + start))) --start;
|
1651
1651
|
while (mStart + end < mEnd && isExtendingChar(prepared.line.text.charAt(mStart + end))) ++end;
|
1652
1652
|
if (ie && ie_version < 9 && start == 0 && end == mEnd - mStart) {
|
@@ -1665,6 +1665,7 @@
|
|
1665
1665
|
start = start - 1;
|
1666
1666
|
collapse = "right";
|
1667
1667
|
}
|
1668
|
+
if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);
|
1668
1669
|
} else { // If it is a widget, simply get the box for the whole widget.
|
1669
1670
|
if (start > 0) collapse = bias = "right";
|
1670
1671
|
var rects;
|
@@ -1681,8 +1682,6 @@
|
|
1681
1682
|
rect = nullRect;
|
1682
1683
|
}
|
1683
1684
|
|
1684
|
-
if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect);
|
1685
|
-
|
1686
1685
|
var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
|
1687
1686
|
var mid = (rtop + rbot) / 2;
|
1688
1687
|
var heights = prepared.view.measure.heights;
|
@@ -2090,11 +2089,11 @@
|
|
2090
2089
|
display.wheelStartX = display.wheelStartY = null;
|
2091
2090
|
|
2092
2091
|
// Propagate the scroll position to the actual DOM scroller
|
2093
|
-
if (op.scrollTop != null && display.scroller.scrollTop != op.scrollTop) {
|
2092
|
+
if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
|
2094
2093
|
var top = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop));
|
2095
2094
|
display.scroller.scrollTop = display.scrollbarV.scrollTop = doc.scrollTop = top;
|
2096
2095
|
}
|
2097
|
-
if (op.scrollLeft != null && display.scroller.scrollLeft != op.scrollLeft) {
|
2096
|
+
if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
|
2098
2097
|
var left = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft));
|
2099
2098
|
display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = left;
|
2100
2099
|
alignHorizontally(cm);
|
@@ -2457,16 +2456,16 @@
|
|
2457
2456
|
cm.options.smartIndent && range.head.ch < 100 &&
|
2458
2457
|
(!i || doc.sel.ranges[i - 1].head.line != range.head.line)) {
|
2459
2458
|
var mode = cm.getModeAt(range.head);
|
2459
|
+
var end = changeEnd(changeEvent);
|
2460
2460
|
if (mode.electricChars) {
|
2461
2461
|
for (var j = 0; j < mode.electricChars.length; j++)
|
2462
2462
|
if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
|
2463
|
-
indentLine(cm,
|
2463
|
+
indentLine(cm, end.line, "smart");
|
2464
2464
|
break;
|
2465
2465
|
}
|
2466
2466
|
} else if (mode.electricInput) {
|
2467
|
-
var end = changeEnd(changeEvent);
|
2468
2467
|
if (mode.electricInput.test(getLine(doc, end.line).text.slice(0, end.ch)))
|
2469
|
-
indentLine(cm,
|
2468
|
+
indentLine(cm, end.line, "smart");
|
2470
2469
|
}
|
2471
2470
|
}
|
2472
2471
|
}
|
@@ -2528,7 +2527,7 @@
|
|
2528
2527
|
var pos = posFromMouse(cm, e);
|
2529
2528
|
if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return;
|
2530
2529
|
e_preventDefault(e);
|
2531
|
-
var word = findWordAt(
|
2530
|
+
var word = cm.findWordAt(pos);
|
2532
2531
|
extendSelection(cm.doc, word.anchor, word.head);
|
2533
2532
|
}));
|
2534
2533
|
else
|
@@ -2807,7 +2806,7 @@
|
|
2807
2806
|
start = posFromMouse(cm, e, true, true);
|
2808
2807
|
ourIndex = -1;
|
2809
2808
|
} else if (type == "double") {
|
2810
|
-
var word = findWordAt(
|
2809
|
+
var word = cm.findWordAt(start);
|
2811
2810
|
if (cm.display.shift || doc.extend)
|
2812
2811
|
ourRange = extendRange(doc, ourRange, word.anchor, word.head);
|
2813
2812
|
else
|
@@ -2861,7 +2860,7 @@
|
|
2861
2860
|
var anchor = oldRange.anchor, head = pos;
|
2862
2861
|
if (type != "single") {
|
2863
2862
|
if (type == "double")
|
2864
|
-
var range = findWordAt(
|
2863
|
+
var range = cm.findWordAt(pos);
|
2865
2864
|
else
|
2866
2865
|
var range = new Range(Pos(pos.line, 0), clipPos(doc, Pos(pos.line + 1, 0)));
|
2867
2866
|
if (cmp(range.anchor, anchor) > 0) {
|
@@ -3999,24 +3998,6 @@
|
|
3999
3998
|
return target;
|
4000
3999
|
}
|
4001
4000
|
|
4002
|
-
// Find the word at the given position (as returned by coordsChar).
|
4003
|
-
function findWordAt(cm, pos) {
|
4004
|
-
var doc = cm.doc, line = getLine(doc, pos.line).text;
|
4005
|
-
var start = pos.ch, end = pos.ch;
|
4006
|
-
if (line) {
|
4007
|
-
var helper = cm.getHelper(pos, "wordChars");
|
4008
|
-
if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;
|
4009
|
-
var startChar = line.charAt(start);
|
4010
|
-
var check = isWordChar(startChar, helper)
|
4011
|
-
? function(ch) { return isWordChar(ch, helper); }
|
4012
|
-
: /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
|
4013
|
-
: function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
|
4014
|
-
while (start > 0 && check(line.charAt(start - 1))) --start;
|
4015
|
-
while (end < line.length && check(line.charAt(end))) ++end;
|
4016
|
-
}
|
4017
|
-
return new Range(Pos(pos.line, start), Pos(pos.line, end));
|
4018
|
-
}
|
4019
|
-
|
4020
4001
|
// EDITOR METHODS
|
4021
4002
|
|
4022
4003
|
// The publicly visible API. Note that methodOp(f) means
|
@@ -4358,6 +4339,24 @@
|
|
4358
4339
|
doc.sel.ranges[i].goalColumn = goals[i];
|
4359
4340
|
}),
|
4360
4341
|
|
4342
|
+
// Find the word at the given position (as returned by coordsChar).
|
4343
|
+
findWordAt: function(pos) {
|
4344
|
+
var doc = this.doc, line = getLine(doc, pos.line).text;
|
4345
|
+
var start = pos.ch, end = pos.ch;
|
4346
|
+
if (line) {
|
4347
|
+
var helper = this.getHelper(pos, "wordChars");
|
4348
|
+
if ((pos.xRel < 0 || end == line.length) && start) --start; else ++end;
|
4349
|
+
var startChar = line.charAt(start);
|
4350
|
+
var check = isWordChar(startChar, helper)
|
4351
|
+
? function(ch) { return isWordChar(ch, helper); }
|
4352
|
+
: /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);}
|
4353
|
+
: function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
|
4354
|
+
while (start > 0 && check(line.charAt(start - 1))) --start;
|
4355
|
+
while (end < line.length && check(line.charAt(end))) ++end;
|
4356
|
+
}
|
4357
|
+
return new Range(Pos(pos.line, start), Pos(pos.line, end));
|
4358
|
+
},
|
4359
|
+
|
4361
4360
|
toggleOverwrite: function(value) {
|
4362
4361
|
if (value != null && value == this.state.overwrite) return;
|
4363
4362
|
if (this.state.overwrite = !this.state.overwrite)
|
@@ -4444,6 +4443,7 @@
|
|
4444
4443
|
clearCaches(this);
|
4445
4444
|
resetInput(this);
|
4446
4445
|
this.scrollTo(doc.scrollLeft, doc.scrollTop);
|
4446
|
+
this.curOp.forceScroll = true;
|
4447
4447
|
signalLater(this, "swapDoc", this, old);
|
4448
4448
|
return old;
|
4449
4449
|
}),
|
@@ -7295,7 +7295,7 @@
|
|
7295
7295
|
return function(){return f.apply(null, args);};
|
7296
7296
|
}
|
7297
7297
|
|
7298
|
-
var nonASCIISingleCaseWordChar = /[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
7298
|
+
var nonASCIISingleCaseWordChar = /[\u00df\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
7299
7299
|
var isWordCharBasic = CodeMirror.isWordChar = function(ch) {
|
7300
7300
|
return /\w/.test(ch) || ch > "\x80" &&
|
7301
7301
|
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
|
@@ -7462,7 +7462,7 @@
|
|
7462
7462
|
if (badBidiRects != null) return badBidiRects;
|
7463
7463
|
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
|
7464
7464
|
var r0 = range(txt, 0, 1).getBoundingClientRect();
|
7465
|
-
if (r0.left == r0.right) return false;
|
7465
|
+
if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)
|
7466
7466
|
var r1 = range(txt, 1, 2).getBoundingClientRect();
|
7467
7467
|
return badBidiRects = (r1.right - r0.right < 3);
|
7468
7468
|
}
|
@@ -7825,7 +7825,7 @@
|
|
7825
7825
|
|
7826
7826
|
// THE END
|
7827
7827
|
|
7828
|
-
CodeMirror.version = "4.
|
7828
|
+
CodeMirror.version = "4.6.0";
|
7829
7829
|
|
7830
7830
|
return CodeMirror;
|
7831
7831
|
});
|
@@ -1,6 +1,10 @@
|
|
1
|
-
|
1
|
+
/****************************************************************/
|
2
|
+
/* Based on mbonaci's Brackets mbo theme */
|
3
|
+
/* https://github.com/mbonaci/global/blob/master/Mbo.tmTheme */
|
4
|
+
/* Create your own: http://tmtheme-editor.herokuapp.com */
|
5
|
+
/****************************************************************/
|
2
6
|
|
3
|
-
.cm-s-mbo.CodeMirror {background: #2c2c2c; color: #
|
7
|
+
.cm-s-mbo.CodeMirror {background: #2c2c2c; color: #ffffec;}
|
4
8
|
.cm-s-mbo div.CodeMirror-selected {background: #716C62 !important;}
|
5
9
|
.cm-s-mbo .CodeMirror-gutters {background: #4e4e4e; border-right: 0px;}
|
6
10
|
.cm-s-mbo .CodeMirror-guttermarker { color: white; }
|
@@ -15,6 +19,7 @@
|
|
15
19
|
.cm-s-mbo span.cm-property, .cm-s-mbo span.cm-attribute {color: #9ddfe9;}
|
16
20
|
.cm-s-mbo span.cm-keyword {color: #ffb928;}
|
17
21
|
.cm-s-mbo span.cm-string {color: #ffcf6c;}
|
22
|
+
.cm-s-mbo span.cm-string.cm-property {color: #ffffec;}
|
18
23
|
|
19
24
|
.cm-s-mbo span.cm-variable {color: #ffffec;}
|
20
25
|
.cm-s-mbo span.cm-variable-2 {color: #00a8c6;}
|
@@ -23,17 +28,8 @@
|
|
23
28
|
.cm-s-mbo span.cm-tag {color: #9ddfe9;}
|
24
29
|
.cm-s-mbo span.cm-link {color: #f54b07;}
|
25
30
|
.cm-s-mbo span.cm-error {border-bottom: #636363; color: #ffffec;}
|
31
|
+
.cm-s-mbo span.cm-qualifier {color: #ffffec;}
|
26
32
|
|
27
33
|
.cm-s-mbo .CodeMirror-activeline-background {background: #494b41 !important;}
|
28
|
-
.cm-s-mbo .CodeMirror-matchingbracket {
|
29
|
-
|
30
|
-
color: #f5e107 !important;
|
31
|
-
}
|
32
|
-
|
33
|
-
.cm-s-mbo .CodeMirror-matchingtag { background: rgba(255, 255, 255, .37); }
|
34
|
-
|
35
|
-
.cm-s-mbo span.cm-searching {
|
36
|
-
background-color: none;
|
37
|
-
background: none;
|
38
|
-
box-shadow: 0 0 0 1px #ffffec;
|
39
|
-
}
|
34
|
+
.cm-s-mbo .CodeMirror-matchingbracket {color: #222 !important;}
|
35
|
+
.cm-s-mbo .CodeMirror-matchingtag {background: rgba(255, 255, 255, .37);}
|
@@ -57,6 +57,10 @@
|
|
57
57
|
border: 0;
|
58
58
|
background: #7e7;
|
59
59
|
}
|
60
|
+
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursors {
|
61
|
+
z-index: 1;
|
62
|
+
}
|
63
|
+
|
60
64
|
.cm-animate-fat-cursor {
|
61
65
|
width: auto;
|
62
66
|
border: 0;
|
@@ -213,6 +217,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|
213
217
|
|
214
218
|
.CodeMirror-lines {
|
215
219
|
cursor: text;
|
220
|
+
min-height: 1px; /* prevents collapsing before first draw */
|
216
221
|
}
|
217
222
|
.CodeMirror pre {
|
218
223
|
/* Reset some styles that the rest of the page might have set */
|
@@ -272,7 +277,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|
272
277
|
div.CodeMirror-cursors {
|
273
278
|
visibility: hidden;
|
274
279
|
position: relative;
|
275
|
-
z-index:
|
280
|
+
z-index: 3;
|
276
281
|
}
|
277
282
|
.CodeMirror-focused div.CodeMirror-cursors {
|
278
283
|
visibility: visible;
|
@@ -299,3 +304,6 @@ div.CodeMirror-cursors {
|
|
299
304
|
visibility: hidden;
|
300
305
|
}
|
301
306
|
}
|
307
|
+
|
308
|
+
/* Help users use markselection to safely style text background */
|
309
|
+
span.CodeMirror-selectedtext { background: none; }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codemirror-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '4.
|
4
|
+
version: '4.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Fixler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -301,6 +301,7 @@ files:
|
|
301
301
|
- vendor/assets/javascripts/codemirror/modes/markdown.js
|
302
302
|
- vendor/assets/javascripts/codemirror/modes/mirc.js
|
303
303
|
- vendor/assets/javascripts/codemirror/modes/mllike.js
|
304
|
+
- vendor/assets/javascripts/codemirror/modes/modelica.js
|
304
305
|
- vendor/assets/javascripts/codemirror/modes/nginx.js
|
305
306
|
- vendor/assets/javascripts/codemirror/modes/ntriples.js
|
306
307
|
- vendor/assets/javascripts/codemirror/modes/octave.js
|
@@ -403,7 +404,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
403
404
|
version: '0'
|
404
405
|
requirements: []
|
405
406
|
rubyforge_project:
|
406
|
-
rubygems_version: 2.4.
|
407
|
+
rubygems_version: 2.4.4
|
407
408
|
signing_key:
|
408
409
|
specification_version: 4
|
409
410
|
summary: Use CodeMirror with Rails
|