resin 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/amber/bin/amberc +10 -350
- data/amber/js/Benchfib.deploy.js +80 -89
- data/amber/js/Benchfib.js +80 -89
- data/amber/js/Canvas.deploy.js +558 -545
- data/amber/js/Canvas.js +563 -545
- data/amber/js/Compiler-AST.deploy.js +431 -243
- data/amber/js/Compiler-AST.js +487 -244
- data/amber/js/Compiler-Core.deploy.js +201 -1045
- data/amber/js/Compiler-Core.js +208 -1207
- data/amber/js/Compiler-Exceptions.deploy.js +37 -18
- data/amber/js/Compiler-Exceptions.js +42 -18
- data/amber/js/Compiler-IR.deploy.js +1071 -774
- data/amber/js/Compiler-IR.js +1194 -848
- data/amber/js/Compiler-Inlining.deploy.js +395 -373
- data/amber/js/Compiler-Inlining.js +395 -373
- data/amber/js/Compiler-Interpreter.deploy.js +1202 -0
- data/amber/js/Compiler-Interpreter.js +1631 -0
- data/amber/js/Compiler-Semantic.deploy.js +695 -600
- data/amber/js/Compiler-Semantic.js +721 -611
- data/amber/js/Compiler-Tests.deploy.js +699 -376
- data/amber/js/Compiler-Tests.js +834 -381
- data/amber/js/Compiler.deploy.js +8563 -1805
- data/amber/js/Compiler.js +11476 -2633
- data/amber/js/Examples.deploy.js +29 -29
- data/amber/js/Examples.js +29 -29
- data/amber/js/IDE.deploy.js +3292 -2649
- data/amber/js/IDE.js +3318 -2710
- data/amber/js/Importer-Exporter.deploy.js +393 -349
- data/amber/js/Importer-Exporter.js +398 -354
- data/amber/js/Kernel-Announcements.deploy.js +53 -44
- data/amber/js/Kernel-Announcements.js +55 -44
- data/amber/js/Kernel-Classes.deploy.js +566 -368
- data/amber/js/Kernel-Classes.js +660 -402
- data/amber/js/Kernel-Collections.deploy.js +1149 -1098
- data/amber/js/Kernel-Collections.js +1183 -1116
- data/amber/js/Kernel-Exceptions.deploy.js +173 -75
- data/amber/js/Kernel-Exceptions.js +215 -77
- data/amber/js/Kernel-Methods.deploy.js +530 -313
- data/amber/js/Kernel-Methods.js +632 -338
- data/amber/js/Kernel-Objects.deploy.js +1734 -1577
- data/amber/js/Kernel-Objects.js +1867 -1654
- data/amber/js/Kernel-Tests.deploy.js +1416 -973
- data/amber/js/Kernel-Tests.js +1495 -981
- data/amber/js/Kernel-Transcript.deploy.js +23 -24
- data/amber/js/Kernel-Transcript.js +25 -26
- data/amber/js/SUnit-Tests.deploy.js +402 -0
- data/amber/js/SUnit-Tests.js +518 -0
- data/amber/js/SUnit.deploy.js +535 -237
- data/amber/js/SUnit.js +634 -246
- data/amber/js/amber.js +90 -53
- data/amber/js/boot.js +441 -255
- data/amber/js/init.js +1 -3
- data/amber/js/lib/CodeMirror/codemirror.css +3 -0
- data/amber/js/lib/CodeMirror/codemirror.js +104 -55
- data/amber/js/lib/peg-0.7.0.min.js +9 -0
- data/amber/js/parser.js +1504 -802
- data/amber/js/parser.pegjs +170 -165
- data/amber/st/Canvas.st +6 -0
- data/amber/st/Compiler-AST.st +54 -3
- data/amber/st/Compiler-Core.st +6 -551
- data/amber/st/Compiler-Exceptions.st +4 -0
- data/amber/st/Compiler-IR.st +205 -87
- data/amber/st/Compiler-Interpreter.st +597 -0
- data/amber/st/Compiler-Semantic.st +46 -21
- data/amber/st/Compiler-Tests.st +254 -7
- data/amber/st/Compiler.st +3172 -1541
- data/amber/st/IDE.st +57 -93
- data/amber/st/Importer-Exporter.st +4 -7
- data/amber/st/Kernel-Announcements.st +8 -0
- data/amber/st/Kernel-Classes.st +149 -40
- data/amber/st/Kernel-Collections.st +43 -32
- data/amber/st/Kernel-Exceptions.st +70 -1
- data/amber/st/Kernel-Methods.st +165 -27
- data/amber/st/Kernel-Objects.st +215 -140
- data/amber/st/Kernel-Tests.st +195 -10
- data/amber/st/Kernel-Transcript.st +1 -3
- data/amber/st/SUnit-Tests.st +186 -0
- data/amber/st/SUnit.st +186 -14
- data/bin/resin +6 -0
- data/lib/resin/cli.rb +19 -0
- metadata +41 -25
- data/amber/js/lib/peg-0.6.2.min.js +0 -2
- data/bin/resin-compile +0 -6
- data/bin/runresin +0 -12
data/amber/js/init.js
CHANGED
@@ -80,6 +80,7 @@
|
|
80
80
|
word-wrap: normal;
|
81
81
|
line-height: inherit;
|
82
82
|
color: inherit;
|
83
|
+
overflow: visible;
|
83
84
|
}
|
84
85
|
|
85
86
|
.CodeMirror-wrap pre {
|
@@ -152,6 +153,8 @@ div.CodeMirror-selected { background: #d9d9d9; }
|
|
152
153
|
.cm-s-default span.cm-quote {color: #090;}
|
153
154
|
.cm-s-default span.cm-hr {color: #999;}
|
154
155
|
.cm-s-default span.cm-link {color: #00c;}
|
156
|
+
span.cm-negative {color: #d44;}
|
157
|
+
span.cm-positive {color: #292;}
|
155
158
|
|
156
159
|
span.cm-header, span.cm-strong {font-weight: bold;}
|
157
160
|
span.cm-em {font-style: italic;}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// CodeMirror version 2.
|
1
|
+
// CodeMirror version 2.37
|
2
2
|
|
3
3
|
// All functions that need access to the editor's state live inside
|
4
4
|
// the CodeMirror function. Below that, at the bottom of the file,
|
@@ -77,7 +77,7 @@ window.CodeMirror = (function() {
|
|
77
77
|
// Selection-related flags. shiftSelecting obviously tracks
|
78
78
|
// whether the user is holding shift.
|
79
79
|
var shiftSelecting, lastClick, lastDoubleClick, lastScrollTop = 0, draggingText,
|
80
|
-
overwrite = false, suppressEdits = false;
|
80
|
+
overwrite = false, suppressEdits = false, pasteIncoming = false;
|
81
81
|
// Variables used by startOperation/endOperation to track what
|
82
82
|
// happened during the operation.
|
83
83
|
var updateInput, userSelChange, changes, textChanged, selectionChanged,
|
@@ -130,7 +130,7 @@ window.CodeMirror = (function() {
|
|
130
130
|
connect(scroller, "drop", operation(onDrop));
|
131
131
|
}
|
132
132
|
connect(scroller, "paste", function(){focusInput(); fastPoll();});
|
133
|
-
connect(input, "paste", fastPoll);
|
133
|
+
connect(input, "paste", function(){pasteIncoming = true; fastPoll();});
|
134
134
|
connect(input, "cut", operation(function(){
|
135
135
|
if (!options.readOnly) replaceSelection("");
|
136
136
|
}));
|
@@ -169,6 +169,8 @@ window.CodeMirror = (function() {
|
|
169
169
|
else if (option == "lineWrapping" && oldVal != value) operation(wrappingChanged)();
|
170
170
|
else if (option == "tabSize") updateDisplay(true);
|
171
171
|
else if (option == "keyMap") keyMapChanged();
|
172
|
+
else if (option == "tabindex") input.tabIndex = value;
|
173
|
+
else if (option == "showCursorWhenSelecting") updateSelection();
|
172
174
|
if (option == "lineNumbers" || option == "gutter" || option == "firstLineNumber" ||
|
173
175
|
option == "theme" || option == "lineNumberFormatter") {
|
174
176
|
gutterChanged();
|
@@ -231,6 +233,7 @@ window.CodeMirror = (function() {
|
|
231
233
|
var off = eltOffset(lineSpace);
|
232
234
|
return coordsChar(coords.x - off.left, coords.y - off.top);
|
233
235
|
},
|
236
|
+
defaultTextHeight: function() { return textHeight(); },
|
234
237
|
markText: operation(markText),
|
235
238
|
setBookmark: setBookmark,
|
236
239
|
findMarksAt: findMarksAt,
|
@@ -280,7 +283,9 @@ window.CodeMirror = (function() {
|
|
280
283
|
lineCount: function() {return doc.size;},
|
281
284
|
clipPos: clipPos,
|
282
285
|
getCursor: function(start) {
|
283
|
-
if (start == null) start = sel.inverted;
|
286
|
+
if (start == null || start == "head") start = sel.inverted;
|
287
|
+
if (start == "anchor") start = !sel.inverted;
|
288
|
+
if (start == "end") start = false;
|
284
289
|
return copyPos(start ? sel.from : sel.to);
|
285
290
|
},
|
286
291
|
somethingSelected: function() {return !posEq(sel.from, sel.to);},
|
@@ -345,6 +350,11 @@ window.CodeMirror = (function() {
|
|
345
350
|
return {x: scroller.scrollLeft, y: scrollbar.scrollTop,
|
346
351
|
height: scrollbar.scrollHeight, width: scroller.scrollWidth};
|
347
352
|
},
|
353
|
+
scrollIntoView: function(pos) {
|
354
|
+
var coords = localCoords(pos ? clipPos(pos) : sel.inverted ? sel.from : sel.to);
|
355
|
+
scrollIntoView(coords.x, coords.y, coords.x, coords.yBot);
|
356
|
+
},
|
357
|
+
|
348
358
|
setSize: function(width, height) {
|
349
359
|
function interpret(val) {
|
350
360
|
val = String(val);
|
@@ -394,7 +404,7 @@ window.CodeMirror = (function() {
|
|
394
404
|
}
|
395
405
|
|
396
406
|
function onScrollBar(e) {
|
397
|
-
if (scrollbar.scrollTop
|
407
|
+
if (Math.abs(scrollbar.scrollTop - lastScrollTop) > 1) {
|
398
408
|
lastScrollTop = scroller.scrollTop = scrollbar.scrollTop;
|
399
409
|
updateDisplay([]);
|
400
410
|
}
|
@@ -403,7 +413,7 @@ window.CodeMirror = (function() {
|
|
403
413
|
function onScrollMain(e) {
|
404
414
|
if (options.fixedGutter && gutter.style.left != scroller.scrollLeft + "px")
|
405
415
|
gutter.style.left = scroller.scrollLeft + "px";
|
406
|
-
if (scroller.scrollTop
|
416
|
+
if (Math.abs(scroller.scrollTop - lastScrollTop) > 1) {
|
407
417
|
lastScrollTop = scroller.scrollTop;
|
408
418
|
if (scrollbar.scrollTop != lastScrollTop)
|
409
419
|
scrollbar.scrollTop = lastScrollTop;
|
@@ -488,8 +498,12 @@ window.CodeMirror = (function() {
|
|
488
498
|
|
489
499
|
function doSelect(cur) {
|
490
500
|
if (type == "single") {
|
491
|
-
setSelectionUser(start, cur);
|
492
|
-
|
501
|
+
setSelectionUser(clipPos(start), cur);
|
502
|
+
return;
|
503
|
+
}
|
504
|
+
startstart = clipPos(startstart);
|
505
|
+
startend = clipPos(startend);
|
506
|
+
if (type == "double") {
|
493
507
|
var word = findWordAt(cur);
|
494
508
|
if (posLess(cur, startstart)) setSelectionUser(word.from, startend);
|
495
509
|
else setSelectionUser(startstart, word.to);
|
@@ -614,7 +628,6 @@ window.CodeMirror = (function() {
|
|
614
628
|
}, 50);
|
615
629
|
|
616
630
|
var name = keyNames[e_prop(e, "keyCode")], handled = false;
|
617
|
-
var flipCtrlCmd = opera && mac;
|
618
631
|
if (name == null || e.altGraphKey) return false;
|
619
632
|
if (e_prop(e, "altKey")) name = "Alt-" + name;
|
620
633
|
if (e_prop(e, flipCtrlCmd ? "metaKey" : "ctrlKey")) name = "Ctrl-" + name;
|
@@ -636,7 +649,7 @@ window.CodeMirror = (function() {
|
|
636
649
|
if (handled) {
|
637
650
|
e_preventDefault(e);
|
638
651
|
restartBlink();
|
639
|
-
if (
|
652
|
+
if (ie_lt9) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
|
640
653
|
}
|
641
654
|
return handled;
|
642
655
|
}
|
@@ -956,12 +969,13 @@ window.CodeMirror = (function() {
|
|
956
969
|
while (same < l && prevInput[same] == text[same]) ++same;
|
957
970
|
if (same < prevInput.length)
|
958
971
|
sel.from = {line: sel.from.line, ch: sel.from.ch - (prevInput.length - same)};
|
959
|
-
else if (overwrite && posEq(sel.from, sel.to))
|
972
|
+
else if (overwrite && posEq(sel.from, sel.to) && !pasteIncoming)
|
960
973
|
sel.to = {line: sel.to.line, ch: Math.min(getLine(sel.to.line).text.length, sel.to.ch + (text.length - same))};
|
961
974
|
replaceSelection(text.slice(same), "end");
|
962
975
|
if (text.length > 1000) { input.value = prevInput = ""; }
|
963
976
|
else prevInput = text;
|
964
977
|
if (!nestedOperation) endOperation();
|
978
|
+
pasteIncoming = false;
|
965
979
|
return true;
|
966
980
|
}
|
967
981
|
function resetInput(user) {
|
@@ -973,7 +987,8 @@ window.CodeMirror = (function() {
|
|
973
987
|
}
|
974
988
|
|
975
989
|
function focusInput() {
|
976
|
-
if (options.readOnly != "nocursor"
|
990
|
+
if (options.readOnly != "nocursor" && (ie_lt9 || document.activeElement != input))
|
991
|
+
input.focus();
|
977
992
|
}
|
978
993
|
|
979
994
|
function scrollCursorIntoView() {
|
@@ -1238,18 +1253,20 @@ window.CodeMirror = (function() {
|
|
1238
1253
|
var wrapOff = eltOffset(wrapper), lineOff = eltOffset(lineDiv);
|
1239
1254
|
inputDiv.style.top = Math.max(0, Math.min(scroller.offsetHeight, headPos.y + lineOff.top - wrapOff.top)) + "px";
|
1240
1255
|
inputDiv.style.left = Math.max(0, Math.min(scroller.offsetWidth, headPos.x + lineOff.left - wrapOff.left)) + "px";
|
1241
|
-
if (collapsed) {
|
1256
|
+
if (collapsed || options.showCursorWhenSelecting) {
|
1242
1257
|
cursor.style.top = headPos.y + "px";
|
1243
1258
|
cursor.style.left = (options.lineWrapping ? Math.min(headPos.x, lineSpace.offsetWidth) : headPos.x) + "px";
|
1244
1259
|
cursor.style.display = "";
|
1245
|
-
selectionDiv.style.display = "none";
|
1246
1260
|
} else {
|
1261
|
+
cursor.style.display = "none";
|
1262
|
+
}
|
1263
|
+
if (!collapsed) {
|
1247
1264
|
var sameLine = fromPos.y == toPos.y, fragment = document.createDocumentFragment();
|
1248
1265
|
var clientWidth = lineSpace.clientWidth || lineSpace.offsetWidth;
|
1249
1266
|
var clientHeight = lineSpace.clientHeight || lineSpace.offsetHeight;
|
1250
1267
|
var add = function(left, top, right, height) {
|
1251
1268
|
var rstyle = quirksMode ? "width: " + (!right ? clientWidth : clientWidth - right - left) + "px"
|
1252
|
-
: "right: " + right + "px";
|
1269
|
+
: "right: " + (right - 1) + "px";
|
1253
1270
|
fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
|
1254
1271
|
"px; top: " + top + "px; " + rstyle + "; height: " + height + "px"));
|
1255
1272
|
};
|
@@ -1264,8 +1281,9 @@ window.CodeMirror = (function() {
|
|
1264
1281
|
if ((!sameLine || !sel.from.ch) && toPos.y < clientHeight - .5 * th)
|
1265
1282
|
add(0, toPos.y, clientWidth - toPos.x, th);
|
1266
1283
|
removeChildrenAndAdd(selectionDiv, fragment);
|
1267
|
-
cursor.style.display = "none";
|
1268
1284
|
selectionDiv.style.display = "";
|
1285
|
+
} else {
|
1286
|
+
selectionDiv.style.display = "none";
|
1269
1287
|
}
|
1270
1288
|
}
|
1271
1289
|
|
@@ -1418,7 +1436,7 @@ window.CodeMirror = (function() {
|
|
1418
1436
|
var startChar = line.charAt(start);
|
1419
1437
|
var check = isWordChar(startChar) ? isWordChar :
|
1420
1438
|
/\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
|
1421
|
-
function(ch) {return !/\s/.test(ch) &&
|
1439
|
+
function(ch) {return !/\s/.test(ch) && isWordChar(ch);};
|
1422
1440
|
while (start > 0 && check(line.charAt(start - 1))) --start;
|
1423
1441
|
while (end < line.length && check(line.charAt(end))) ++end;
|
1424
1442
|
}
|
@@ -1462,6 +1480,7 @@ window.CodeMirror = (function() {
|
|
1462
1480
|
|
1463
1481
|
if (indentString != curSpaceString)
|
1464
1482
|
replaceRange(indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length});
|
1483
|
+
line.stateAfter = null;
|
1465
1484
|
}
|
1466
1485
|
|
1467
1486
|
function loadMode() {
|
@@ -1507,18 +1526,17 @@ window.CodeMirror = (function() {
|
|
1507
1526
|
|
1508
1527
|
function TextMarker(type, style) { this.lines = []; this.type = type; if (style) this.style = style; }
|
1509
1528
|
TextMarker.prototype.clear = operation(function() {
|
1510
|
-
var min
|
1529
|
+
var min, max;
|
1511
1530
|
for (var i = 0; i < this.lines.length; ++i) {
|
1512
1531
|
var line = this.lines[i];
|
1513
|
-
var span = getMarkedSpanFor(line.markedSpans, this
|
1514
|
-
if (span.from != null
|
1515
|
-
|
1516
|
-
|
1517
|
-
}
|
1532
|
+
var span = getMarkedSpanFor(line.markedSpans, this);
|
1533
|
+
if (span.from != null) min = lineNo(line);
|
1534
|
+
if (span.to != null) max = lineNo(line);
|
1535
|
+
line.markedSpans = removeMarkedSpan(line.markedSpans, span);
|
1518
1536
|
}
|
1519
|
-
if (min !=
|
1520
|
-
changes.push({from: min, to: max + 1});
|
1537
|
+
if (min != null) changes.push({from: min, to: max + 1});
|
1521
1538
|
this.lines.length = 0;
|
1539
|
+
this.explicitlyCleared = true;
|
1522
1540
|
});
|
1523
1541
|
TextMarker.prototype.find = function() {
|
1524
1542
|
var from, to;
|
@@ -1545,7 +1563,7 @@ window.CodeMirror = (function() {
|
|
1545
1563
|
var span = {from: curLine == from.line ? from.ch : null,
|
1546
1564
|
to: curLine == to.line ? to.ch : null,
|
1547
1565
|
marker: marker};
|
1548
|
-
|
1566
|
+
line.markedSpans = (line.markedSpans || []).concat([span]);
|
1549
1567
|
marker.lines.push(line);
|
1550
1568
|
++curLine;
|
1551
1569
|
});
|
@@ -1556,8 +1574,9 @@ window.CodeMirror = (function() {
|
|
1556
1574
|
function setBookmark(pos) {
|
1557
1575
|
pos = clipPos(pos);
|
1558
1576
|
var marker = new TextMarker("bookmark"), line = getLine(pos.line);
|
1577
|
+
history.addChange(pos.line, 1, [newHL(line.text, line.markedSpans)], true);
|
1559
1578
|
var span = {from: pos.ch, to: pos.ch, marker: marker};
|
1560
|
-
|
1579
|
+
line.markedSpans = (line.markedSpans || []).concat([span]);
|
1561
1580
|
marker.lines.push(line);
|
1562
1581
|
return marker;
|
1563
1582
|
}
|
@@ -1646,8 +1665,6 @@ window.CodeMirror = (function() {
|
|
1646
1665
|
|
1647
1666
|
function measureLine(line, ch) {
|
1648
1667
|
if (ch == 0) return {top: 0, left: 0};
|
1649
|
-
var wbr = options.lineWrapping && ch < line.text.length &&
|
1650
|
-
spanAffectsWrapping.test(line.text.slice(ch - 1, ch + 1));
|
1651
1668
|
var pre = lineContent(line, ch);
|
1652
1669
|
removeChildrenAndAdd(measure, pre);
|
1653
1670
|
var anchor = pre.anchor;
|
@@ -1980,6 +1997,7 @@ window.CodeMirror = (function() {
|
|
1980
1997
|
if (extensions.propertyIsEnumerable(ext) &&
|
1981
1998
|
!instance.propertyIsEnumerable(ext))
|
1982
1999
|
instance[ext] = extensions[ext];
|
2000
|
+
for (var i = 0; i < initHooks.length; ++i) initHooks[i](instance);
|
1983
2001
|
return instance;
|
1984
2002
|
} // (end of function CodeMirror)
|
1985
2003
|
|
@@ -2003,6 +2021,7 @@ window.CodeMirror = (function() {
|
|
2003
2021
|
gutter: false,
|
2004
2022
|
fixedGutter: false,
|
2005
2023
|
firstLineNumber: 1,
|
2024
|
+
showCursorWhenSelecting: false,
|
2006
2025
|
readOnly: false,
|
2007
2026
|
dragDrop: true,
|
2008
2027
|
onChange: null,
|
@@ -2054,7 +2073,11 @@ window.CodeMirror = (function() {
|
|
2054
2073
|
var modeObj = mfactory(options, spec);
|
2055
2074
|
if (modeExtensions.hasOwnProperty(spec.name)) {
|
2056
2075
|
var exts = modeExtensions[spec.name];
|
2057
|
-
for (var prop in exts)
|
2076
|
+
for (var prop in exts) {
|
2077
|
+
if (!exts.hasOwnProperty(prop)) continue;
|
2078
|
+
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
|
2079
|
+
modeObj[prop] = exts[prop];
|
2080
|
+
}
|
2058
2081
|
}
|
2059
2082
|
modeObj.name = spec.name;
|
2060
2083
|
return modeObj;
|
@@ -2077,6 +2100,9 @@ window.CodeMirror = (function() {
|
|
2077
2100
|
extensions[name] = func;
|
2078
2101
|
};
|
2079
2102
|
|
2103
|
+
var initHooks = [];
|
2104
|
+
CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
|
2105
|
+
|
2080
2106
|
var modeExtensions = CodeMirror.modeExtensions = {};
|
2081
2107
|
CodeMirror.extendMode = function(mode, properties) {
|
2082
2108
|
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
@@ -2169,7 +2195,7 @@ window.CodeMirror = (function() {
|
|
2169
2195
|
keyMap.emacsy = {
|
2170
2196
|
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
2171
2197
|
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
|
2172
|
-
"Ctrl-V": "
|
2198
|
+
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharRight", "Ctrl-H": "delCharLeft",
|
2173
2199
|
"Alt-D": "delWordRight", "Alt-Backspace": "delWordLeft", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
|
2174
2200
|
};
|
2175
2201
|
|
@@ -2206,6 +2232,7 @@ window.CodeMirror = (function() {
|
|
2206
2232
|
var name = keyNames[e_prop(event, "keyCode")];
|
2207
2233
|
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
|
2208
2234
|
}
|
2235
|
+
CodeMirror.isModifierKey = isModifierKey;
|
2209
2236
|
|
2210
2237
|
CodeMirror.fromTextArea = function(textarea, options) {
|
2211
2238
|
if (!options) options = {};
|
@@ -2226,15 +2253,13 @@ window.CodeMirror = (function() {
|
|
2226
2253
|
if (textarea.form) {
|
2227
2254
|
// Deplorable hack to make the submit method do the right thing.
|
2228
2255
|
var rmSubmit = connect(textarea.form, "submit", save, true);
|
2229
|
-
|
2230
|
-
|
2231
|
-
|
2232
|
-
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
};
|
2237
|
-
}
|
2256
|
+
var form = textarea.form, realSubmit = form.submit;
|
2257
|
+
textarea.form.submit = function wrappedSubmit() {
|
2258
|
+
save();
|
2259
|
+
form.submit = realSubmit;
|
2260
|
+
form.submit();
|
2261
|
+
form.submit = wrappedSubmit;
|
2262
|
+
};
|
2238
2263
|
}
|
2239
2264
|
|
2240
2265
|
textarea.style.display = "none";
|
@@ -2256,18 +2281,24 @@ window.CodeMirror = (function() {
|
|
2256
2281
|
return instance;
|
2257
2282
|
};
|
2258
2283
|
|
2259
|
-
var gecko = /gecko\/\d
|
2284
|
+
var gecko = /gecko\/\d/i.test(navigator.userAgent);
|
2260
2285
|
var ie = /MSIE \d/.test(navigator.userAgent);
|
2261
2286
|
var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
|
2262
2287
|
var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
|
2263
2288
|
var quirksMode = ie && document.documentMode == 5;
|
2264
2289
|
var webkit = /WebKit\//.test(navigator.userAgent);
|
2290
|
+
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
|
2265
2291
|
var chrome = /Chrome\//.test(navigator.userAgent);
|
2266
2292
|
var opera = /Opera\//.test(navigator.userAgent);
|
2267
2293
|
var safari = /Apple Computer/.test(navigator.vendor);
|
2268
2294
|
var khtml = /KHTML\//.test(navigator.userAgent);
|
2269
2295
|
var mac_geLion = /Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);
|
2270
2296
|
|
2297
|
+
var opera_version = opera && navigator.userAgent.match(/Version\/(\d*\.\d*)/);
|
2298
|
+
if (opera_version) opera_version = Number(opera_version[1]);
|
2299
|
+
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
2300
|
+
var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11));
|
2301
|
+
|
2271
2302
|
// Utility functions for working with state. Exported because modes
|
2272
2303
|
// sometimes need to do this.
|
2273
2304
|
function copyState(mode, state) {
|
@@ -2355,16 +2386,20 @@ window.CodeMirror = (function() {
|
|
2355
2386
|
this.from = from; this.to = to; this.marker = marker;
|
2356
2387
|
}
|
2357
2388
|
|
2358
|
-
function getMarkedSpanFor(spans, marker
|
2389
|
+
function getMarkedSpanFor(spans, marker) {
|
2359
2390
|
if (spans) for (var i = 0; i < spans.length; ++i) {
|
2360
2391
|
var span = spans[i];
|
2361
|
-
if (span.marker == marker)
|
2362
|
-
if (del) spans.splice(i, 1);
|
2363
|
-
return span;
|
2364
|
-
}
|
2392
|
+
if (span.marker == marker) return span;
|
2365
2393
|
}
|
2366
2394
|
}
|
2367
2395
|
|
2396
|
+
function removeMarkedSpan(spans, span) {
|
2397
|
+
var r;
|
2398
|
+
for (var i = 0; i < spans.length; ++i)
|
2399
|
+
if (spans[i] != span) (r || (r = [])).push(spans[i]);
|
2400
|
+
return r;
|
2401
|
+
}
|
2402
|
+
|
2368
2403
|
function markedSpansBefore(old, startCh, endCh) {
|
2369
2404
|
if (old) for (var i = 0, nw; i < old.length; ++i) {
|
2370
2405
|
var span = old[i], marker = span.marker;
|
@@ -2448,7 +2483,15 @@ window.CodeMirror = (function() {
|
|
2448
2483
|
// hl stands for history-line, a data structure that can be either a
|
2449
2484
|
// string (line without markers) or a {text, markedSpans} object.
|
2450
2485
|
function hlText(val) { return typeof val == "string" ? val : val.text; }
|
2451
|
-
function hlSpans(val) {
|
2486
|
+
function hlSpans(val) {
|
2487
|
+
if (typeof val == "string") return null;
|
2488
|
+
var spans = val.markedSpans, out = null;
|
2489
|
+
for (var i = 0; i < spans.length; ++i) {
|
2490
|
+
if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
|
2491
|
+
else if (out) out.push(spans[i]);
|
2492
|
+
}
|
2493
|
+
return !out ? spans : out.length ? out : null;
|
2494
|
+
}
|
2452
2495
|
function newHL(text, spans) { return spans ? {text: text, markedSpans: spans} : text; }
|
2453
2496
|
|
2454
2497
|
function detachMarkedSpans(line) {
|
@@ -2584,13 +2627,17 @@ window.CodeMirror = (function() {
|
|
2584
2627
|
span = function(html, text, style) {
|
2585
2628
|
var l = text.length;
|
2586
2629
|
if (wrapAt >= outPos && wrapAt < outPos + l) {
|
2587
|
-
|
2588
|
-
|
2630
|
+
var cut = wrapAt - outPos;
|
2631
|
+
if (cut) {
|
2632
|
+
span_(html, text.slice(0, cut), style);
|
2589
2633
|
// See comment at the definition of spanAffectsWrapping
|
2590
|
-
if (compensateForWrapping)
|
2634
|
+
if (compensateForWrapping) {
|
2635
|
+
var view = text.slice(cut - 1, cut + 1);
|
2636
|
+
if (spanAffectsWrapping.test(view)) html.appendChild(elt("wbr"));
|
2637
|
+
else if (!ie_lt8 && /\w\w/.test(view)) html.appendChild(document.createTextNode("\u200d"));
|
2638
|
+
}
|
2591
2639
|
}
|
2592
2640
|
html.appendChild(anchor);
|
2593
|
-
var cut = wrapAt - outPos;
|
2594
2641
|
span_(anchor, opera ? text.slice(cut, cut + 1) : text.slice(cut), style);
|
2595
2642
|
if (opera) span_(html, text.slice(cut + 1), style);
|
2596
2643
|
wrapAt--;
|
@@ -2820,7 +2867,7 @@ window.CodeMirror = (function() {
|
|
2820
2867
|
if (line.parent == null) return null;
|
2821
2868
|
var cur = line.parent, no = indexOf(cur.lines, line);
|
2822
2869
|
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
2823
|
-
for (var i = 0
|
2870
|
+
for (var i = 0; ; ++i) {
|
2824
2871
|
if (chunk.children[i] == cur) break;
|
2825
2872
|
no += chunk.children[i].chunkSize();
|
2826
2873
|
}
|
@@ -2874,7 +2921,7 @@ window.CodeMirror = (function() {
|
|
2874
2921
|
var time = +new Date, cur = lst(this.done), last = cur && lst(cur);
|
2875
2922
|
var dtime = time - this.time;
|
2876
2923
|
|
2877
|
-
if (
|
2924
|
+
if (cur && !this.closed && this.compound) {
|
2878
2925
|
cur.push({start: start, added: added, old: old});
|
2879
2926
|
} else if (dtime > 400 || !last || this.closed ||
|
2880
2927
|
last.start > start + old.length || last.start + last.added < start) {
|
@@ -3080,8 +3127,10 @@ window.CodeMirror = (function() {
|
|
3080
3127
|
if (collection[i] == elt) return i;
|
3081
3128
|
return -1;
|
3082
3129
|
}
|
3130
|
+
var nonASCIISingleCaseWordChar = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/;
|
3083
3131
|
function isWordChar(ch) {
|
3084
|
-
return /\w/.test(ch) || ch
|
3132
|
+
return /\w/.test(ch) || ch > "\x80" &&
|
3133
|
+
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
|
3085
3134
|
}
|
3086
3135
|
|
3087
3136
|
// See if "".split is the broken IE version, if so, provide an
|
@@ -3137,7 +3186,7 @@ window.CodeMirror = (function() {
|
|
3137
3186
|
for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
|
3138
3187
|
})();
|
3139
3188
|
|
3140
|
-
CodeMirror.version = "2.
|
3189
|
+
CodeMirror.version = "2.37";
|
3141
3190
|
|
3142
3191
|
return CodeMirror;
|
3143
3192
|
})();
|