codemirror-rails 3.21 → 3.22
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.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +89 -43
- data/vendor/assets/javascripts/codemirror/addons/comment/continuecomment.js +16 -3
- data/vendor/assets/javascripts/codemirror/addons/dialog/dialog.js +1 -0
- data/vendor/assets/javascripts/codemirror/addons/display/rulers.js +47 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closetag.js +1 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +6 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/markdown-fold.js +34 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/anyword-hint.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +0 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +25 -18
- data/vendor/assets/javascripts/codemirror/addons/lint/yaml-lint.js +14 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/scroll/scrollpastend.js +2 -0
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +9 -3
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +126 -54
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +6 -5
- data/vendor/assets/javascripts/codemirror/modes/css.js +19 -9
- data/vendor/assets/javascripts/codemirror/modes/gas.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +4 -1
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +11 -3
- data/vendor/assets/javascripts/codemirror/modes/julia.js +47 -23
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +5 -3
- data/vendor/assets/javascripts/codemirror/modes/octave.js +6 -4
- data/vendor/assets/javascripts/codemirror/modes/puppet.js +204 -0
- data/vendor/assets/javascripts/codemirror/modes/python.js +4 -0
- data/vendor/assets/javascripts/codemirror/modes/rst.js +520 -517
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/solr.js +89 -0
- data/vendor/assets/javascripts/codemirror/modes/sql.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/xml.js +2 -1
- data/vendor/assets/stylesheets/codemirror.css +12 -11
- data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +44 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +1 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4503a996155c96877d36e19f5e461db92383dbf4
|
4
|
+
data.tar.gz: 5abe2e7b9dc2f39f4ec1185d220e3dc8ab9a8eb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22aef71a6f3827e6f71a38213649a0ad7d081d2b5fc8831ccfadf726246f2d5d59435823dbc6b2119685c98e4d859381a7429debbae6622f3cf655cbc404e4d4
|
7
|
+
data.tar.gz: 12642596e377573cdcad5b977aa648310069efd0c2278e192aff0758bce6ce9e2d2f81f295a9d942148028eb392c1594f684f685aeb151bb15b52ee1d54c3dc2
|
@@ -1,3 +1,5 @@
|
|
1
|
+
// CodeMirror version 3.22
|
2
|
+
//
|
1
3
|
// CodeMirror is the only global var we claim
|
2
4
|
window.CodeMirror = (function() {
|
3
5
|
"use strict";
|
@@ -13,6 +15,7 @@ window.CodeMirror = (function() {
|
|
13
15
|
var old_ie = /MSIE \d/.test(navigator.userAgent);
|
14
16
|
var ie_lt8 = old_ie && (document.documentMode == null || document.documentMode < 8);
|
15
17
|
var ie_lt9 = old_ie && (document.documentMode == null || document.documentMode < 9);
|
18
|
+
var ie_lt10 = old_ie && (document.documentMode == null || document.documentMode < 10);
|
16
19
|
var ie_gt10 = /Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent);
|
17
20
|
var ie = old_ie || ie_gt10;
|
18
21
|
var webkit = /WebKit\//.test(navigator.userAgent);
|
@@ -36,7 +39,7 @@ window.CodeMirror = (function() {
|
|
36
39
|
if (opera_version && opera_version >= 15) { opera = false; webkit = true; }
|
37
40
|
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
38
41
|
var flipCtrlCmd = mac && (qtwebkit || opera && (opera_version == null || opera_version < 12.11));
|
39
|
-
var captureMiddleClick = gecko || (
|
42
|
+
var captureMiddleClick = gecko || (ie && !ie_lt9);
|
40
43
|
|
41
44
|
// Optimize some code when these features are not used
|
42
45
|
var sawReadOnlySpans = false, sawCollapsedSpans = false;
|
@@ -99,7 +102,7 @@ window.CodeMirror = (function() {
|
|
99
102
|
function makeDisplay(place, docStart) {
|
100
103
|
var d = {};
|
101
104
|
|
102
|
-
var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none
|
105
|
+
var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none");
|
103
106
|
if (webkit) input.style.width = "1000px";
|
104
107
|
else input.setAttribute("wrap", "off");
|
105
108
|
// if border: 0; -- iOS fails to open keyboard (issue #1287)
|
@@ -171,7 +174,7 @@ window.CodeMirror = (function() {
|
|
171
174
|
// Self-resetting timeout for the poller
|
172
175
|
d.poll = new Delayed();
|
173
176
|
|
174
|
-
d.cachedCharWidth = d.cachedTextHeight = null;
|
177
|
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
175
178
|
d.measureLineCache = [];
|
176
179
|
d.measureLineCachePos = 0;
|
177
180
|
|
@@ -337,8 +340,9 @@ window.CodeMirror = (function() {
|
|
337
340
|
if (needsV) {
|
338
341
|
d.scrollbarV.style.display = "block";
|
339
342
|
d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
|
343
|
+
// A bug in IE8 can cause this value to be negative, so guard it.
|
340
344
|
d.scrollbarV.firstChild.style.height =
|
341
|
-
(scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
|
345
|
+
Math.max(0, scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
|
342
346
|
} else {
|
343
347
|
d.scrollbarV.style.display = "";
|
344
348
|
d.scrollbarV.firstChild.style.height = "0";
|
@@ -818,12 +822,12 @@ window.CodeMirror = (function() {
|
|
818
822
|
function updateSelectionRange(cm) {
|
819
823
|
var display = cm.display, doc = cm.doc, sel = cm.doc.sel;
|
820
824
|
var fragment = document.createDocumentFragment();
|
821
|
-
var
|
825
|
+
var padding = paddingH(cm.display), leftSide = padding.left, rightSide = display.lineSpace.offsetWidth - padding.right;
|
822
826
|
|
823
827
|
function add(left, top, width, bottom) {
|
824
828
|
if (top < 0) top = 0;
|
825
829
|
fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
|
826
|
-
"px; top: " + top + "px; width: " + (width == null ?
|
830
|
+
"px; top: " + top + "px; width: " + (width == null ? rightSide - left : width) +
|
827
831
|
"px; height: " + (bottom - top) + "px"));
|
828
832
|
}
|
829
833
|
|
@@ -846,18 +850,18 @@ window.CodeMirror = (function() {
|
|
846
850
|
left = leftPos.left;
|
847
851
|
right = rightPos.right;
|
848
852
|
}
|
849
|
-
if (fromArg == null && from == 0) left =
|
853
|
+
if (fromArg == null && from == 0) left = leftSide;
|
850
854
|
if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
|
851
855
|
add(left, leftPos.top, null, leftPos.bottom);
|
852
|
-
left =
|
856
|
+
left = leftSide;
|
853
857
|
if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
|
854
858
|
}
|
855
|
-
if (toArg == null && to == lineLen) right =
|
859
|
+
if (toArg == null && to == lineLen) right = rightSide;
|
856
860
|
if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
|
857
861
|
start = leftPos;
|
858
862
|
if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
|
859
863
|
end = rightPos;
|
860
|
-
if (left <
|
864
|
+
if (left < leftSide + 1) left = leftSide;
|
861
865
|
add(left, rightPos.top, right - left, rightPos.bottom);
|
862
866
|
});
|
863
867
|
return {start: start, end: end};
|
@@ -873,13 +877,13 @@ window.CodeMirror = (function() {
|
|
873
877
|
if (singleVLine) {
|
874
878
|
if (leftEnd.top < rightStart.top - 2) {
|
875
879
|
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
|
876
|
-
add(
|
880
|
+
add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
|
877
881
|
} else {
|
878
882
|
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
|
879
883
|
}
|
880
884
|
}
|
881
885
|
if (leftEnd.bottom < rightStart.top)
|
882
|
-
add(
|
886
|
+
add(leftSide, leftEnd.bottom, null, rightStart.top);
|
883
887
|
}
|
884
888
|
|
885
889
|
removeChildrenAndAdd(display.selectionDiv, fragment);
|
@@ -982,9 +986,12 @@ window.CodeMirror = (function() {
|
|
982
986
|
|
983
987
|
function paddingTop(display) {return display.lineSpace.offsetTop;}
|
984
988
|
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight;}
|
985
|
-
function
|
986
|
-
|
987
|
-
|
989
|
+
function paddingH(display) {
|
990
|
+
if (display.cachedPaddingH) return display.cachedPaddingH;
|
991
|
+
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
|
992
|
+
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
|
993
|
+
return display.cachedPaddingH = {left: parseInt(style.paddingLeft),
|
994
|
+
right: parseInt(style.paddingRight)};
|
988
995
|
}
|
989
996
|
|
990
997
|
function measureChar(cm, line, ch, data, bias) {
|
@@ -1158,7 +1165,7 @@ window.CodeMirror = (function() {
|
|
1158
1165
|
|
1159
1166
|
function clearCaches(cm) {
|
1160
1167
|
cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;
|
1161
|
-
cm.display.cachedCharWidth = cm.display.cachedTextHeight = null;
|
1168
|
+
cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
|
1162
1169
|
if (!cm.options.lineWrapping) cm.display.maxLineChanged = true;
|
1163
1170
|
cm.display.lineNumChars = null;
|
1164
1171
|
}
|
@@ -1374,7 +1381,7 @@ window.CodeMirror = (function() {
|
|
1374
1381
|
if (op.updateMaxLine) computeMaxLength(cm);
|
1375
1382
|
if (display.maxLineChanged && !cm.options.lineWrapping && display.maxLine) {
|
1376
1383
|
var width = measureLineWidth(cm, display.maxLine);
|
1377
|
-
display.sizer.style.minWidth = Math.max(0, width + 3
|
1384
|
+
display.sizer.style.minWidth = Math.max(0, width + 3) + "px";
|
1378
1385
|
display.maxLineChanged = false;
|
1379
1386
|
var maxScrollLeft = Math.max(0, display.sizer.offsetLeft + display.sizer.offsetWidth - display.scroller.clientWidth);
|
1380
1387
|
if (maxScrollLeft < doc.scrollLeft && !op.updateScrollPos)
|
@@ -1556,6 +1563,10 @@ window.CodeMirror = (function() {
|
|
1556
1563
|
cm.display.input.focus();
|
1557
1564
|
}
|
1558
1565
|
|
1566
|
+
function ensureFocus(cm) {
|
1567
|
+
if (!cm.state.focused) { focusInput(cm); onFocus(cm); }
|
1568
|
+
}
|
1569
|
+
|
1559
1570
|
function isReadOnly(cm) {
|
1560
1571
|
return cm.options.readOnly || cm.doc.cantEdit;
|
1561
1572
|
}
|
@@ -1612,7 +1623,7 @@ window.CodeMirror = (function() {
|
|
1612
1623
|
if (resizeTimer == null) resizeTimer = setTimeout(function() {
|
1613
1624
|
resizeTimer = null;
|
1614
1625
|
// Might be a text scaling operation, clear size caches.
|
1615
|
-
d.cachedCharWidth = d.cachedTextHeight = knownScrollbarWidth = null;
|
1626
|
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = knownScrollbarWidth = null;
|
1616
1627
|
clearCaches(cm);
|
1617
1628
|
runInOp(cm, bind(regChange, cm));
|
1618
1629
|
}, 100);
|
@@ -1628,10 +1639,7 @@ window.CodeMirror = (function() {
|
|
1628
1639
|
}
|
1629
1640
|
setTimeout(unregister, 5000);
|
1630
1641
|
|
1631
|
-
on(d.input, "keyup", operation(cm,
|
1632
|
-
if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
|
1633
|
-
if (e.keyCode == 16) cm.doc.sel.shift = false;
|
1634
|
-
}));
|
1642
|
+
on(d.input, "keyup", operation(cm, onKeyUp));
|
1635
1643
|
on(d.input, "input", function() {
|
1636
1644
|
if (ie && !ie_lt9 && cm.display.inputHasSelection) cm.display.inputHasSelection = null;
|
1637
1645
|
fastPoll(cm);
|
@@ -1725,6 +1733,7 @@ window.CodeMirror = (function() {
|
|
1725
1733
|
}
|
1726
1734
|
if (clickInGutter(cm, e)) return;
|
1727
1735
|
var start = posFromMouse(cm, e);
|
1736
|
+
window.focus();
|
1728
1737
|
|
1729
1738
|
switch (e_button(e)) {
|
1730
1739
|
case 3:
|
@@ -1742,7 +1751,7 @@ window.CodeMirror = (function() {
|
|
1742
1751
|
// selection.
|
1743
1752
|
if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
|
1744
1753
|
|
1745
|
-
|
1754
|
+
setTimeout(bind(ensureFocus, cm), 0);
|
1746
1755
|
|
1747
1756
|
var now = +new Date, type = "single";
|
1748
1757
|
if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
|
@@ -1822,7 +1831,7 @@ window.CodeMirror = (function() {
|
|
1822
1831
|
var cur = posFromMouse(cm, e, true);
|
1823
1832
|
if (!cur) return;
|
1824
1833
|
if (!posEq(cur, last)) {
|
1825
|
-
|
1834
|
+
ensureFocus(cm);
|
1826
1835
|
last = cur;
|
1827
1836
|
doSelect(cur);
|
1828
1837
|
var visible = visibleLines(display, doc);
|
@@ -1847,7 +1856,7 @@ window.CodeMirror = (function() {
|
|
1847
1856
|
}
|
1848
1857
|
|
1849
1858
|
var move = operation(cm, function(e) {
|
1850
|
-
if (
|
1859
|
+
if ((ie && !ie_lt10) ? !e.buttons : !e_button(e)) done(e);
|
1851
1860
|
else extend(e);
|
1852
1861
|
});
|
1853
1862
|
var up = operation(cm, done);
|
@@ -1992,7 +2001,7 @@ window.CodeMirror = (function() {
|
|
1992
2001
|
// know one. These don't have to be accurate -- the result of them
|
1993
2002
|
// being wrong would just be a slight flicker on the first wheel
|
1994
2003
|
// scroll (if it is large enough).
|
1995
|
-
if (
|
2004
|
+
if (ie) wheelPixelsPerUnit = -.53;
|
1996
2005
|
else if (gecko) wheelPixelsPerUnit = 15;
|
1997
2006
|
else if (chrome) wheelPixelsPerUnit = -.7;
|
1998
2007
|
else if (safari) wheelPixelsPerUnit = -1/3;
|
@@ -2141,10 +2150,16 @@ window.CodeMirror = (function() {
|
|
2141
2150
|
return handled;
|
2142
2151
|
}
|
2143
2152
|
|
2153
|
+
function onKeyUp(e) {
|
2154
|
+
var cm = this;
|
2155
|
+
if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
|
2156
|
+
if (e.keyCode == 16) cm.doc.sel.shift = false;
|
2157
|
+
}
|
2158
|
+
|
2144
2159
|
var lastStoppedKey = null;
|
2145
2160
|
function onKeyDown(e) {
|
2146
2161
|
var cm = this;
|
2147
|
-
|
2162
|
+
ensureFocus(cm);
|
2148
2163
|
if (signalDOMEvent(cm, e) || cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
|
2149
2164
|
if (old_ie && e.keyCode == 27) e.returnValue = false;
|
2150
2165
|
var code = e.keyCode;
|
@@ -2237,7 +2252,7 @@ window.CodeMirror = (function() {
|
|
2237
2252
|
|
2238
2253
|
// Try to detect the user choosing select-all
|
2239
2254
|
if (display.input.selectionStart != null) {
|
2240
|
-
if (!
|
2255
|
+
if (!ie || ie_lt9) prepareSelectAllHack();
|
2241
2256
|
clearTimeout(detectingSelectAll);
|
2242
2257
|
var i = 0, poll = function(){
|
2243
2258
|
if (display.prevInput == "\u200b" && display.input.selectionStart == 0)
|
@@ -2249,7 +2264,7 @@ window.CodeMirror = (function() {
|
|
2249
2264
|
}
|
2250
2265
|
}
|
2251
2266
|
|
2252
|
-
if (
|
2267
|
+
if (ie && !ie_lt9) prepareSelectAllHack();
|
2253
2268
|
if (captureMiddleClick) {
|
2254
2269
|
e_stop(e);
|
2255
2270
|
var mouseup = function() {
|
@@ -2746,15 +2761,16 @@ window.CodeMirror = (function() {
|
|
2746
2761
|
// API UTILITIES
|
2747
2762
|
|
2748
2763
|
function indentLine(cm, n, how, aggressive) {
|
2749
|
-
var doc = cm.doc;
|
2764
|
+
var doc = cm.doc, state;
|
2750
2765
|
if (how == null) how = "add";
|
2751
2766
|
if (how == "smart") {
|
2752
2767
|
if (!cm.doc.mode.indent) how = "prev";
|
2753
|
-
else
|
2768
|
+
else state = getStateBefore(cm, n);
|
2754
2769
|
}
|
2755
2770
|
|
2756
2771
|
var tabSize = cm.options.tabSize;
|
2757
2772
|
var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
|
2773
|
+
if (line.stateAfter) line.stateAfter = null;
|
2758
2774
|
var curSpaceString = line.text.match(/^\s*/)[0], indentation;
|
2759
2775
|
if (!aggressive && !/\S/.test(line.text)) {
|
2760
2776
|
indentation = 0;
|
@@ -2829,13 +2845,15 @@ window.CodeMirror = (function() {
|
|
2829
2845
|
if (dir < 0 && !moveOnce(!first)) break;
|
2830
2846
|
var cur = lineObj.text.charAt(ch) || "\n";
|
2831
2847
|
var type = isWordChar(cur) ? "w"
|
2832
|
-
:
|
2833
|
-
: /\s/.test(cur) ? null
|
2848
|
+
: group && cur == "\n" ? "n"
|
2849
|
+
: !group || /\s/.test(cur) ? null
|
2834
2850
|
: "p";
|
2851
|
+
if (group && !first && !type) type = "s";
|
2835
2852
|
if (sawType && sawType != type) {
|
2836
2853
|
if (dir < 0) {dir = 1; moveOnce();}
|
2837
2854
|
break;
|
2838
2855
|
}
|
2856
|
+
|
2839
2857
|
if (type) sawType = type;
|
2840
2858
|
if (dir > 0 && !moveOnce(!first)) break;
|
2841
2859
|
}
|
@@ -3156,6 +3174,8 @@ window.CodeMirror = (function() {
|
|
3156
3174
|
},
|
3157
3175
|
|
3158
3176
|
triggerOnKeyDown: operation(null, onKeyDown),
|
3177
|
+
triggerOnKeyPress: operation(null, onKeyPress),
|
3178
|
+
triggerOnKeyUp: operation(null, onKeyUp),
|
3159
3179
|
|
3160
3180
|
execCommand: function(cmd) {
|
3161
3181
|
if (commands.hasOwnProperty(cmd))
|
@@ -3222,8 +3242,10 @@ window.CodeMirror = (function() {
|
|
3222
3242
|
this.display.cursor.className += " CodeMirror-overwrite";
|
3223
3243
|
else
|
3224
3244
|
this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", "");
|
3245
|
+
|
3246
|
+
signal(this, "overwriteToggle", this, this.state.overwrite);
|
3225
3247
|
},
|
3226
|
-
hasFocus: function() { return this.
|
3248
|
+
hasFocus: function() { return document.activeElement == this.display.input; },
|
3227
3249
|
|
3228
3250
|
scrollTo: operation(null, function(x, y) {
|
3229
3251
|
updateScrollPos(this, x, y);
|
@@ -3264,16 +3286,19 @@ window.CodeMirror = (function() {
|
|
3264
3286
|
if (this.options.lineWrapping)
|
3265
3287
|
this.display.measureLineCache.length = this.display.measureLineCachePos = 0;
|
3266
3288
|
this.curOp.forceUpdate = true;
|
3289
|
+
signal(this, "refresh", this);
|
3267
3290
|
}),
|
3268
3291
|
|
3269
3292
|
operation: function(f){return runInOp(this, f);},
|
3270
3293
|
|
3271
3294
|
refresh: operation(null, function() {
|
3272
|
-
var
|
3295
|
+
var oldHeight = this.display.cachedTextHeight;
|
3273
3296
|
clearCaches(this);
|
3274
3297
|
updateScrollPos(this, this.doc.scrollLeft, this.doc.scrollTop);
|
3275
3298
|
regChange(this);
|
3276
|
-
if (
|
3299
|
+
if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)
|
3300
|
+
estimateLineHeights(this);
|
3301
|
+
signal(this, "refresh", this);
|
3277
3302
|
}),
|
3278
3303
|
|
3279
3304
|
swapDoc: operation(null, function(doc) {
|
@@ -3424,6 +3449,7 @@ window.CodeMirror = (function() {
|
|
3424
3449
|
spec = mimeModes[spec];
|
3425
3450
|
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
3426
3451
|
var found = mimeModes[spec.name];
|
3452
|
+
if (typeof found == "string") found = {name: found};
|
3427
3453
|
spec = createObj(found, spec);
|
3428
3454
|
spec.name = found.name;
|
3429
3455
|
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
@@ -3536,7 +3562,7 @@ window.CodeMirror = (function() {
|
|
3536
3562
|
},
|
3537
3563
|
deleteLine: function(cm) {
|
3538
3564
|
var l = cm.getCursor().line;
|
3539
|
-
cm.replaceRange("", Pos(l, 0), Pos(l), "+delete");
|
3565
|
+
cm.replaceRange("", Pos(l, 0), Pos(l + 1, 0), "+delete");
|
3540
3566
|
},
|
3541
3567
|
delLineLeft: function(cm) {
|
3542
3568
|
var cur = cm.getCursor();
|
@@ -3627,7 +3653,7 @@ window.CodeMirror = (function() {
|
|
3627
3653
|
// default. Unknown commands are simply ignored.
|
3628
3654
|
keyMap.pcDefault = {
|
3629
3655
|
"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
|
3630
|
-
"Ctrl-Home": "goDocStart", "
|
3656
|
+
"Ctrl-Home": "goDocStart", "Ctrl-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
|
3631
3657
|
"Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
3632
3658
|
"Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
|
3633
3659
|
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
@@ -4344,6 +4370,7 @@ window.CodeMirror = (function() {
|
|
4344
4370
|
var aboveVisible = heightAtLine(cm, line) < cm.doc.scrollTop;
|
4345
4371
|
updateLineHeight(line, line.height + widgetHeight(widget));
|
4346
4372
|
if (aboveVisible) addToScrollPos(cm, 0, widget.height);
|
4373
|
+
cm.curOp.forceUpdate = true;
|
4347
4374
|
}
|
4348
4375
|
return true;
|
4349
4376
|
});
|
@@ -4475,7 +4502,7 @@ window.CodeMirror = (function() {
|
|
4475
4502
|
function interpretTokenStyle(style, builder) {
|
4476
4503
|
if (!style) return null;
|
4477
4504
|
for (;;) {
|
4478
|
-
var lineClass = style.match(/(?:^|\s)line-(background-)?(\S+)/);
|
4505
|
+
var lineClass = style.match(/(?:^|\s+)line-(background-)?(\S+)/);
|
4479
4506
|
if (!lineClass) break;
|
4480
4507
|
style = style.slice(0, lineClass.index) + style.slice(lineClass.index + lineClass[0].length);
|
4481
4508
|
var prop = lineClass[1] ? "bgClass" : "textClass";
|
@@ -4484,9 +4511,10 @@ window.CodeMirror = (function() {
|
|
4484
4511
|
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(builder[prop]))
|
4485
4512
|
builder[prop] += " " + lineClass[2];
|
4486
4513
|
}
|
4514
|
+
if (/^\s*$/.test(style)) return null;
|
4487
4515
|
var cache = builder.cm.options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
|
4488
4516
|
return cache[style] ||
|
4489
|
-
(cache[style] =
|
4517
|
+
(cache[style] = style.replace(/\S+/g, "cm-$&"));
|
4490
4518
|
}
|
4491
4519
|
|
4492
4520
|
function buildLineContent(cm, realLine, measure, copyWidgets) {
|
@@ -4503,7 +4531,7 @@ window.CodeMirror = (function() {
|
|
4503
4531
|
builder.measure = line == realLine && measure;
|
4504
4532
|
builder.pos = 0;
|
4505
4533
|
builder.addToken = builder.measure ? buildTokenMeasure : buildToken;
|
4506
|
-
if ((
|
4534
|
+
if ((ie || webkit) && cm.getOption("lineWrapping"))
|
4507
4535
|
builder.addToken = buildTokenSplitSpaces(builder.addToken);
|
4508
4536
|
var next = insertLineContent(line, builder, getLineStyles(cm, line));
|
4509
4537
|
if (measure && line == realLine && !builder.measuredSomething) {
|
@@ -5046,6 +5074,22 @@ window.CodeMirror = (function() {
|
|
5046
5074
|
}
|
5047
5075
|
return markers;
|
5048
5076
|
},
|
5077
|
+
findMarks: function(from, to) {
|
5078
|
+
from = clipPos(this, from); to = clipPos(this, to);
|
5079
|
+
var found = [], lineNo = from.line;
|
5080
|
+
this.iter(from.line, to.line + 1, function(line) {
|
5081
|
+
var spans = line.markedSpans;
|
5082
|
+
if (spans) for (var i = 0; i < spans.length; i++) {
|
5083
|
+
var span = spans[i];
|
5084
|
+
if (!(lineNo == from.line && from.ch > span.to ||
|
5085
|
+
span.from == null && lineNo != from.line||
|
5086
|
+
lineNo == to.line && span.from > to.ch))
|
5087
|
+
found.push(span.marker.parent || span.marker);
|
5088
|
+
}
|
5089
|
+
++lineNo;
|
5090
|
+
});
|
5091
|
+
return found;
|
5092
|
+
},
|
5049
5093
|
getAllMarks: function() {
|
5050
5094
|
var markers = [];
|
5051
5095
|
this.iter(function(line) {
|
@@ -5319,6 +5363,8 @@ window.CodeMirror = (function() {
|
|
5319
5363
|
hist.lastTime = time;
|
5320
5364
|
hist.lastOp = opId;
|
5321
5365
|
hist.lastOrigin = change.origin;
|
5366
|
+
|
5367
|
+
if (!last) signal(doc, "historyAdded");
|
5322
5368
|
}
|
5323
5369
|
|
5324
5370
|
function removeClearedSpans(spans) {
|
@@ -5600,7 +5646,7 @@ window.CodeMirror = (function() {
|
|
5600
5646
|
return function(){return f.apply(null, args);};
|
5601
5647
|
}
|
5602
5648
|
|
5603
|
-
var nonASCIISingleCaseWordChar = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
5649
|
+
var nonASCIISingleCaseWordChar = /[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
5604
5650
|
function isWordChar(ch) {
|
5605
5651
|
return /\w/.test(ch) || ch > "\x80" &&
|
5606
5652
|
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
|
@@ -6041,7 +6087,7 @@ window.CodeMirror = (function() {
|
|
6041
6087
|
|
6042
6088
|
// THE END
|
6043
6089
|
|
6044
|
-
CodeMirror.version = "3.
|
6090
|
+
CodeMirror.version = "3.22.0";
|
6045
6091
|
|
6046
6092
|
return CodeMirror;
|
6047
6093
|
})();
|
@@ -1,5 +1,6 @@
|
|
1
1
|
(function() {
|
2
2
|
var modes = ["clike", "css", "javascript"];
|
3
|
+
|
3
4
|
for (var i = 0; i < modes.length; ++i)
|
4
5
|
CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "});
|
5
6
|
|
@@ -12,7 +13,7 @@
|
|
12
13
|
if (mode.blockCommentStart && mode.blockCommentContinue) {
|
13
14
|
var end = token.string.indexOf(mode.blockCommentEnd);
|
14
15
|
var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found;
|
15
|
-
if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) {
|
16
|
+
if (end != -1 && end == token.string.length - mode.blockCommentEnd.length && pos.ch >= end) {
|
16
17
|
// Comment ended, don't continue it
|
17
18
|
} else if (token.string.indexOf(mode.blockCommentStart) == 0) {
|
18
19
|
insert = full.slice(0, token.start);
|
@@ -27,7 +28,7 @@
|
|
27
28
|
}
|
28
29
|
if (insert != null) insert += mode.blockCommentContinue;
|
29
30
|
}
|
30
|
-
if (insert == null && mode.lineComment) {
|
31
|
+
if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) {
|
31
32
|
var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
|
32
33
|
if (found > -1) {
|
33
34
|
insert = line.slice(0, found);
|
@@ -42,12 +43,24 @@
|
|
42
43
|
return CodeMirror.Pass;
|
43
44
|
}
|
44
45
|
|
46
|
+
function continueLineCommentEnabled(cm) {
|
47
|
+
var opt = cm.getOption("continueComments");
|
48
|
+
if (opt && typeof opt == "object")
|
49
|
+
return opt.continueLineComment !== false;
|
50
|
+
return true;
|
51
|
+
}
|
52
|
+
|
45
53
|
CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
|
46
54
|
if (prev && prev != CodeMirror.Init)
|
47
55
|
cm.removeKeyMap("continueComment");
|
48
56
|
if (val) {
|
57
|
+
var key = "Enter";
|
58
|
+
if (typeof val == "string")
|
59
|
+
key = val;
|
60
|
+
else if (typeof val == "object" && val.key)
|
61
|
+
key = val.key;
|
49
62
|
var map = {name: "continueComment"};
|
50
|
-
map[
|
63
|
+
map[key] = continueComment;
|
51
64
|
cm.addKeyMap(map);
|
52
65
|
}
|
53
66
|
});
|