codemirror 3.19 and directory cleanup
This commit is contained in:
+1
-1
@@ -74,7 +74,6 @@
|
||||
.cm-s-default .cm-string {color: #a11;}
|
||||
.cm-s-default .cm-string-2 {color: #f50;}
|
||||
.cm-s-default .cm-meta {color: #555;}
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-s-default .cm-qualifier {color: #555;}
|
||||
.cm-s-default .cm-builtin {color: #30a;}
|
||||
.cm-s-default .cm-bracket {color: #997;}
|
||||
@@ -91,6 +90,7 @@
|
||||
.cm-em {font-style: italic;}
|
||||
.cm-link {text-decoration: underline;}
|
||||
|
||||
.cm-s-default .cm-error {color: #f00;}
|
||||
.cm-invalidchar {color: #f00;}
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
||||
|
||||
+43
-20
@@ -1,4 +1,4 @@
|
||||
// CodeMirror version 3.18
|
||||
// CodeMirror version 3.19
|
||||
//
|
||||
// CodeMirror is the only global var we claim
|
||||
window.CodeMirror = (function() {
|
||||
@@ -355,8 +355,10 @@ window.CodeMirror = (function() {
|
||||
d.gutterFiller.style.width = d.gutters.offsetWidth + "px";
|
||||
} else d.gutterFiller.style.display = "";
|
||||
|
||||
if (mac_geLion && scrollbarWidth(d.measure) === 0)
|
||||
if (mac_geLion && scrollbarWidth(d.measure) === 0) {
|
||||
d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
|
||||
d.scrollbarV.style.pointerEvents = d.scrollbarH.style.pointerEvents = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function visibleLines(display, doc, viewPort) {
|
||||
@@ -937,8 +939,9 @@ window.CodeMirror = (function() {
|
||||
// smallest indentation, which tends to need the least context to
|
||||
// parse correctly.
|
||||
function findStartLine(cm, n, precise) {
|
||||
var minindent, minline, doc = cm.doc, maxScan = cm.doc.mode.innerMode ? 1000 : 100;
|
||||
for (var search = n, lim = n - maxScan; search > lim; --search) {
|
||||
var minindent, minline, doc = cm.doc;
|
||||
var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
|
||||
for (var search = n; search > lim; --search) {
|
||||
if (search <= doc.first) return doc.first;
|
||||
var line = getLine(doc, search - 1);
|
||||
if (line.stateAfter && (!precise || search <= doc.frontier)) return search;
|
||||
@@ -963,6 +966,7 @@ window.CodeMirror = (function() {
|
||||
line.stateAfter = save ? copyState(doc.mode, state) : null;
|
||||
++pos;
|
||||
});
|
||||
if (precise) doc.frontier = pos;
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -1385,7 +1389,8 @@ window.CodeMirror = (function() {
|
||||
display.scroller.scrollLeft = display.scrollbarH.scrollLeft = doc.scrollLeft = newScrollPos.scrollLeft;
|
||||
alignHorizontally(cm);
|
||||
if (op.scrollToPos)
|
||||
scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos), op.scrollToPosMargin);
|
||||
scrollPosIntoView(cm, clipPos(cm.doc, op.scrollToPos.from),
|
||||
clipPos(cm.doc, op.scrollToPos.to), op.scrollToPos.margin);
|
||||
} else if (newScrollPos) {
|
||||
scrollCursorIntoView(cm);
|
||||
}
|
||||
@@ -2181,7 +2186,11 @@ window.CodeMirror = (function() {
|
||||
|
||||
var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
|
||||
if (!pos || opera) return; // Opera is difficult.
|
||||
if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
|
||||
|
||||
// Reset the current text selection only if the click is done outside of the selection
|
||||
// and 'resetSelectionOnContextMenu' option is true.
|
||||
var reset = cm.options.resetSelectionOnContextMenu;
|
||||
if (reset && (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to)))
|
||||
operation(cm, setSelection)(cm.doc, pos, pos);
|
||||
|
||||
var oldCSS = display.input.style.cssText;
|
||||
@@ -2632,7 +2641,7 @@ window.CodeMirror = (function() {
|
||||
// SCROLLING
|
||||
|
||||
function scrollCursorIntoView(cm) {
|
||||
var coords = scrollPosIntoView(cm, cm.doc.sel.head, cm.options.cursorScrollMargin);
|
||||
var coords = scrollPosIntoView(cm, cm.doc.sel.head, null, cm.options.cursorScrollMargin);
|
||||
if (!cm.state.focused) return;
|
||||
var display = cm.display, box = getRect(display.sizer), doScroll = null;
|
||||
if (coords.top + box.top < 0) doScroll = true;
|
||||
@@ -2649,11 +2658,15 @@ window.CodeMirror = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
function scrollPosIntoView(cm, pos, margin) {
|
||||
function scrollPosIntoView(cm, pos, end, margin) {
|
||||
if (margin == null) margin = 0;
|
||||
for (;;) {
|
||||
var changed = false, coords = cursorCoords(cm, pos);
|
||||
var scrollPos = calculateScrollPos(cm, coords.left, coords.top - margin, coords.left, coords.bottom + margin);
|
||||
var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
|
||||
var scrollPos = calculateScrollPos(cm, Math.min(coords.left, endCoords.left),
|
||||
Math.min(coords.top, endCoords.top) - margin,
|
||||
Math.max(coords.left, endCoords.left),
|
||||
Math.max(coords.bottom, endCoords.bottom) + margin);
|
||||
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
|
||||
if (scrollPos.scrollTop != null) {
|
||||
setScrollTop(cm, scrollPos.scrollTop);
|
||||
@@ -3171,17 +3184,23 @@ window.CodeMirror = (function() {
|
||||
clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co};
|
||||
},
|
||||
|
||||
scrollIntoView: operation(null, function(pos, margin) {
|
||||
if (typeof pos == "number") pos = Pos(pos, 0);
|
||||
scrollIntoView: operation(null, function(range, margin) {
|
||||
if (range == null) range = {from: this.doc.sel.head, to: null};
|
||||
else if (typeof range == "number") range = {from: Pos(range, 0), to: null};
|
||||
else if (range.from == null) range = {from: range, to: null};
|
||||
if (!range.to) range.to = range.from;
|
||||
if (!margin) margin = 0;
|
||||
var coords = pos;
|
||||
|
||||
if (!pos || pos.line != null) {
|
||||
this.curOp.scrollToPos = pos ? clipPos(this.doc, pos) : this.doc.sel.head;
|
||||
this.curOp.scrollToPosMargin = margin;
|
||||
coords = cursorCoords(this, this.curOp.scrollToPos);
|
||||
var coords = range;
|
||||
if (range.from.line != null) {
|
||||
this.curOp.scrollToPos = {from: range.from, to: range.to, margin: margin};
|
||||
coords = {from: cursorCoords(this, range.from),
|
||||
to: cursorCoords(this, range.to)};
|
||||
}
|
||||
var sPos = calculateScrollPos(this, coords.left, coords.top - margin, coords.right, coords.bottom + margin);
|
||||
var sPos = calculateScrollPos(this, Math.min(coords.from.left, coords.to.left),
|
||||
Math.min(coords.from.top, coords.to.top) - margin,
|
||||
Math.max(coords.from.right, coords.to.right),
|
||||
Math.max(coords.from.bottom, coords.to.bottom) + margin);
|
||||
updateScrollPos(this, sPos.scrollLeft, sPos.scrollTop);
|
||||
}),
|
||||
|
||||
@@ -3213,6 +3232,7 @@ window.CodeMirror = (function() {
|
||||
clearCaches(this);
|
||||
resetInput(this, true);
|
||||
updateScrollPos(this, doc.scrollLeft, doc.scrollTop);
|
||||
signalLater(this, "swapDoc", this, old);
|
||||
return old;
|
||||
}),
|
||||
|
||||
@@ -3287,6 +3307,8 @@ window.CodeMirror = (function() {
|
||||
option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
|
||||
option("showCursorWhenSelecting", false, updateSelection, true);
|
||||
|
||||
option("resetSelectionOnContextMenu", true);
|
||||
|
||||
option("readOnly", false, function(cm, val) {
|
||||
if (val == "nocursor") {onBlur(cm); cm.display.input.blur();}
|
||||
else if (!val) resetInput(cm, true);
|
||||
@@ -3523,7 +3545,8 @@ window.CodeMirror = (function() {
|
||||
keyMap.basic = {
|
||||
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
||||
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
||||
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
||||
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
|
||||
"Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
||||
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
|
||||
};
|
||||
// Note that the save and find-related commands aren't defined by
|
||||
@@ -4463,7 +4486,7 @@ window.CodeMirror = (function() {
|
||||
return out;
|
||||
}
|
||||
return function(builder, text, style, startStyle, endStyle, title) {
|
||||
return inner(builder, text.replace(/ {3,}/, split), style, startStyle, endStyle, title);
|
||||
return inner(builder, text.replace(/ {3,}/g, split), style, startStyle, endStyle, title);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5881,7 +5904,7 @@ window.CodeMirror = (function() {
|
||||
|
||||
// THE END
|
||||
|
||||
CodeMirror.version = "3.18.0";
|
||||
CodeMirror.version = "3.19.0";
|
||||
|
||||
return CodeMirror;
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user