Update ACE to 17.06.19

Addresses #1727
This commit is contained in:
Dan Stillman 2019-08-28 08:05:48 -04:00
parent f0e9c8bfba
commit 95a9ccae69
6 changed files with 4981 additions and 2636 deletions

File diff suppressed because it is too large Load diff

View file

@ -45,7 +45,6 @@ background-color: white;\
color: black;\
border: 1px solid #cbcbcb;\
border-right: 0 none;\
box-sizing: border-box!important;\
outline: 0;\
padding: 0;\
font-size: inherit;\
@ -54,6 +53,8 @@ line-height: inherit;\
padding: 0 6px;\
min-width: 17em;\
vertical-align: top;\
min-height: 1.8em;\
box-sizing: content-box;\
}\
.ace_searchbtn {\
border: 1px solid #cbcbcb;\
@ -66,7 +67,6 @@ border-left: 1px solid #dcdcdc;\
cursor: pointer;\
margin: 0;\
position: relative;\
box-sizing: content-box!important;\
color: #666;\
}\
.ace_searchbtn:last-child {\
@ -162,39 +162,38 @@ var MAX_COUNT = 999;
dom.importCssString(searchboxCss, "ace_searchbox");
var html = '<div class="ace_search right">\
<span action="hide" class="ace_searchbtn_close"></span>\
<div class="ace_search_form">\
<input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
<span action="findPrev" class="ace_searchbtn prev"></span>\
<span action="findNext" class="ace_searchbtn next"></span>\
<span action="findAll" class="ace_searchbtn" title="Alt-Enter">All</span>\
</div>\
<div class="ace_replace_form">\
<input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
<span action="replaceAndFindNext" class="ace_searchbtn">Replace</span>\
<span action="replaceAll" class="ace_searchbtn">All</span>\
</div>\
<div class="ace_search_options">\
<span action="toggleReplace" class="ace_button" title="Toggel Replace mode"\
style="float:left;margin-top:-2px;padding:0 5px;">+</span>\
<span class="ace_search_counter"></span>\
<span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
<span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
<span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
<span action="searchInSelection" class="ace_button" title="Search In Selection">S</span>\
</div>\
</div>'.replace(/> +/g, ">");
var SearchBox = function(editor, range, showReplaceForm) {
var div = dom.createElement("div");
div.innerHTML = html;
dom.buildDom(["div", {class:"ace_search right"},
["span", {action: "hide", class: "ace_searchbtn_close"}],
["div", {class: "ace_search_form"},
["input", {class: "ace_search_field", placeholder: "Search for", spellcheck: "false"}],
["span", {action: "findPrev", class: "ace_searchbtn prev"}, "\u200b"],
["span", {action: "findNext", class: "ace_searchbtn next"}, "\u200b"],
["span", {action: "findAll", class: "ace_searchbtn", title: "Alt-Enter"}, "All"]
],
["div", {class: "ace_replace_form"},
["input", {class: "ace_search_field", placeholder: "Replace with", spellcheck: "false"}],
["span", {action: "replaceAndFindNext", class: "ace_searchbtn"}, "Replace"],
["span", {action: "replaceAll", class: "ace_searchbtn"}, "All"]
],
["div", {class: "ace_search_options"},
["span", {action: "toggleReplace", class: "ace_button", title: "Toggle Replace mode",
style: "float:left;margin-top:-2px;padding:0 5px;"}, "+"],
["span", {class: "ace_search_counter"}],
["span", {action: "toggleRegexpMode", class: "ace_button", title: "RegExp Search"}, ".*"],
["span", {action: "toggleCaseSensitive", class: "ace_button", title: "CaseSensitive Search"}, "Aa"],
["span", {action: "toggleWholeWords", class: "ace_button", title: "Whole Word Search"}, "\\b"],
["span", {action: "searchInSelection", class: "ace_button", title: "Search In Selection"}, "S"]
]
], div);
this.element = div.firstChild;
this.setSession = this.setSession.bind(this);
this.$init();
this.setEditor(editor);
dom.importCssString(searchboxCss, "ace_searchbox", editor.container);
};
(function() {
@ -205,10 +204,9 @@ var SearchBox = function(editor, range, showReplaceForm) {
};
this.setSession = function(e) {
debugger
this.searchRange = null;
this.$syncOptions(true);
}
};
this.$initElements = function(sb) {
this.searchBox = sb.querySelector(".ace_search_form");
@ -287,6 +285,8 @@ var SearchBox = function(editor, range, showReplaceForm) {
sb.searchInput.focus();
},
"Ctrl-H|Command-Option-F": function(sb) {
if (sb.editor.getReadOnly())
return;
sb.replaceOption.checked = true;
sb.$syncOptions();
sb.replaceInput.focus();
@ -364,7 +364,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.editor.session.removeMarker(this.searchRangeMarker);
this.searchRangeMarker = null;
}
}
};
this.$syncOptions = function(preventScroll) {
dom.setCssClass(this.replaceOption, "checked", this.searchRange);
@ -373,13 +373,15 @@ var SearchBox = function(editor, range, showReplaceForm) {
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
this.replaceBox.style.display = this.replaceOption.checked ? "" : "none";
var readOnly = this.editor.getReadOnly();
this.replaceOption.style.display = readOnly ? "none" : "";
this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none";
this.find(false, false, preventScroll);
};
this.highlight = function(re) {
this.editor.session.highlight(re || this.editor.$search.$options.re);
this.editor.renderer.updateBackMarkers()
this.editor.renderer.updateBackMarkers();
};
this.find = function(skipCurrent, backwards, preventScroll) {
var range = this.editor.find(this.searchInput.value, {
@ -402,7 +404,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
var editor = this.editor;
var regex = editor.$search.$options.re;
var all = 0;
var before = 0
var before = 0;
if (regex) {
var value = this.searchRange
? editor.session.getTextRange(this.searchRange)
@ -420,7 +422,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
if (last <= offset)
before++;
if (all > MAX_COUNT)
break
break;
if (!m[0]) {
regex.lastIndex = last += 1;
if (last >= value.length)
@ -455,7 +457,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.replaceAndFindNext = function() {
if (!this.editor.getReadOnly()) {
this.editor.replace(this.replaceInput.value);
this.findNext()
this.findNext();
}
};
this.replaceAll = function() {
@ -465,7 +467,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.hide = function() {
this.active = false;
this.setSearchRange(null)
this.setSearchRange(null);
this.editor.off("changeSession", this.setSession);
this.element.style.display = "none";
@ -492,7 +494,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
this.isFocused = function() {
var el = document.activeElement;
return el == this.searchInput || el == this.replaceInput;
}
};
}).call(SearchBox.prototype);
exports.SearchBox = SearchBox;
@ -502,8 +504,11 @@ exports.Search = function(editor, isReplace) {
sb.show(editor.session.getTextRange(), isReplace);
};
});
(function() {
window.require(["ace/ext/searchbox"], function() {});
}); (function() {
window.require(["ace/ext/searchbox"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View file

@ -18,7 +18,7 @@ oop.inherits(Occur, Search);
var translatedPos = this.originalToOccurPosition(editor.session, pos);
editor.moveCursorToPosition(translatedPos);
return true;
}
};
this.exit = function(editor, options) {
var pos = options.translatePosition && editor.getCursorPosition();
var translatedPos = pos && this.occurToOriginalPosition(editor.session, pos);
@ -26,14 +26,14 @@ oop.inherits(Occur, Search);
if (translatedPos)
editor.moveCursorToPosition(translatedPos);
return true;
}
};
this.highlight = function(sess, regexp) {
var hl = sess.$occurHighlight = sess.$occurHighlight || sess.addDynamicMarker(
new SearchHighlight(null, "ace_occur-highlight", "text"));
hl.setRegexp(regexp);
sess._emit("changeBackMarker"); // force highlight layer redraw
}
};
this.displayOccurContent = function(editor, options) {
this.$originalSession = editor.session;
@ -47,12 +47,12 @@ oop.inherits(Occur, Search);
occurSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
this.highlight(occurSession, options.re);
occurSession._emit('changeBackMarker');
}
};
this.displayOriginalContent = function(editor) {
editor.setSession(this.$originalSession);
this.$originalSession.$useEmacsStyleLineStart = this.$useEmacsStyleLineStart;
}
};
this.originalToOccurPosition = function(session, pos) {
var lines = session.$occurMatchingLines;
var nullPos = {row: 0, column: 0};
@ -62,13 +62,13 @@ oop.inherits(Occur, Search);
return {row: i, column: pos.column};
}
return nullPos;
}
};
this.occurToOriginalPosition = function(session, pos) {
var lines = session.$occurMatchingLines;
if (!lines || !lines[pos.row])
return pos;
return {row: lines[pos.row].row, column: pos.column};
}
};
this.matchingLines = function(session, options) {
options = oop.mixin({}, options);
@ -82,7 +82,7 @@ oop.inherits(Occur, Search);
lines :
lines.concat({row: row, content: session.getLine(row)});
}, []);
}
};
}).call(Occur.prototype);
@ -92,8 +92,6 @@ dom.importCssString(".ace_occur-highlight {\n\
background-color: rgba(87, 255, 8, 0.25);\n\
position: absolute;\n\
z-index: 4;\n\
-moz-box-sizing: border-box;\n\
-webkit-box-sizing: border-box;\n\
box-sizing: border-box;\n\
box-shadow: 0 0 4px rgb(91, 255, 50);\n\
}\n\
@ -158,13 +156,13 @@ oop.inherits(OccurKeyboardHandler, HashHandler);
this.attach = function(editor) {
HashHandler.call(this, occurCommands, editor.commands.platform);
this.$editor = editor;
}
};
var handleKeyboard$super = this.handleKeyboard;
this.handleKeyboard = function(data, hashId, key, keyCode) {
var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
return (cmd && cmd.command) ? cmd : undefined;
}
};
}).call(OccurKeyboardHandler.prototype);
@ -172,14 +170,14 @@ OccurKeyboardHandler.installIn = function(editor) {
var handler = new this();
editor.keyBinding.addKeyboardHandler(handler);
editor.commands.addCommands(occurCommands);
}
};
OccurKeyboardHandler.uninstallFrom = function(editor) {
editor.commands.removeCommands(occurCommands);
var handler = editor.getKeyboardHandler();
if (handler.isOccurHandler)
editor.keyBinding.removeKeyboardHandler(handler);
}
};
exports.occurStartCommand = occurStartCommand;
@ -393,7 +391,7 @@ function regExpToObject(re) {
return {
expression: string.slice(start+1, flagStart),
flags: string.slice(flagStart+1)
}
};
}
function stringToRegExp(string, flags) {
@ -565,8 +563,6 @@ dom.importCssString && dom.importCssString("\
.ace_marker-layer .ace_isearch-result {\
position: absolute;\
z-index: 6;\
-moz-box-sizing: border-box;\
-webkit-box-sizing: border-box;\
box-sizing: border-box;\
}\
div.ace_isearch-result {\
@ -612,19 +608,6 @@ require("../incremental_search");
var iSearchCommandModule = require("../commands/incremental_search_commands");
var screenToTextBlockCoordinates = function(x, y) {
var canvasPos = this.scroller.getBoundingClientRect();
var col = Math.floor(
(x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
);
var row = Math.floor(
(y + this.scrollTop - canvasPos.top) / this.lineHeight
);
return this.session.screenToDocumentPosition(row, col);
};
var HashHandler = require("./hash_handler").HashHandler;
exports.handler = new HashHandler();
@ -641,8 +624,6 @@ exports.handler.attach = function(editor) {
dom.importCssString('\
.emacs-mode .ace_cursor{\
border: 1px rgba(50,250,50,0.8) solid!important;\
-moz-box-sizing: border-box!important;\
-webkit-box-sizing: border-box!important;\
box-sizing: border-box!important;\
background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\
@ -712,11 +693,11 @@ exports.handler.attach = function(editor) {
replacement : undefined);
}
return lastMark;
}
};
editor.on("click", $resetMarkMode);
editor.on("changeSession", $kbSessionChange);
editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
editor.renderer.$blockCursor = true;
editor.setStyle("emacs-mode");
editor.commands.addCommands(commands);
exports.handler.platform = editor.commands.platform;
@ -726,7 +707,7 @@ exports.handler.attach = function(editor) {
};
exports.handler.detach = function(editor) {
delete editor.renderer.screenToTextCoordinates;
editor.renderer.$blockCursor = false;
editor.session.$selectLongWords = $formerLongWords;
editor.session.$useEmacsStyleLineStart = $formerLineStart;
editor.removeEventListener("click", $resetMarkMode);
@ -809,7 +790,7 @@ exports.handler.getStatusText = function(editor, data) {
if (data.count)
str += data.count;
if (data.keyChain)
str += " " + data.keyChain
str += " " + data.keyChain;
return str;
};
@ -871,7 +852,7 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
data.lastCommand = null;
if (!command.readOnly && editor.emacsMark())
editor.setEmacsMark(null)
editor.setEmacsMark(null);
if (data.count) {
var count = data.count;
@ -1068,7 +1049,7 @@ exports.handler.addCommands({
var range = editor.getSelectionRange();
var line = editor.session.getLine(range.start.row);
range.end.column = line.length;
line = line.substr(range.start.column)
line = line.substr(range.start.column);
var foldLine = editor.session.getFoldLine(range.start.row);
if (foldLine && range.end.row != foldLine.end.row) {
@ -1128,6 +1109,7 @@ exports.handler.addCommands({
editor.$handlesEmacsOnCopy = false;
if (editor.inMultiSelectMode) editor.forEachSelection({exec: deselect});
else deselect();
editor.setEmacsMark(null);
editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse());
}, 0);
},
@ -1178,4 +1160,11 @@ exports.killRing = {
}
};
});
}); (function() {
window.require(["ace/keyboard/emacs"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

File diff suppressed because it is too large Load diff

View file

@ -102,4 +102,11 @@ background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgb
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
});
}); (function() {
window.require(["ace/theme/monokai"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View file

@ -134,7 +134,7 @@ window.define = function(id, deps, factory) {
exports: {},
factory: function() {
var module = this;
var returnExports = factory.apply(this, deps.map(function(dep) {
var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) {
switch (dep) {
// Because "require", "exports" and "module" aren't actual
// dependencies, we must handle them seperately.
@ -217,7 +217,7 @@ window.onmessage = function(e) {
};
})(this);
define("ace/lib/oop",["require","exports","module"], function(require, exports, module) {
define("ace/lib/oop",[], function(require, exports, module) {
"use strict";
exports.inherits = function(ctor, superCtor) {
@ -245,7 +245,7 @@ exports.implement = function(proto, mixin) {
});
define("ace/range",["require","exports","module"], function(require, exports, module) {
define("ace/range",[], function(require, exports, module) {
"use strict";
var comparePoints = function(p1, p2) {
return p1.row - p2.row || p1.column - p2.column;
@ -484,7 +484,7 @@ Range.comparePoints = function(p1, p2) {
exports.Range = Range;
});
define("ace/apply_delta",["require","exports","module"], function(require, exports, module) {
define("ace/apply_delta",[], function(require, exports, module) {
"use strict";
function throwDeltaError(delta, errorText){
@ -549,7 +549,7 @@ exports.applyDelta = function(docLines, delta, doNotValidate) {
};
});
define("ace/lib/event_emitter",["require","exports","module"], function(require, exports, module) {
define("ace/lib/event_emitter",[], function(require, exports, module) {
"use strict";
var EventEmitter = {};
@ -599,10 +599,15 @@ EventEmitter._signal = function(eventName, e) {
EventEmitter.once = function(eventName, callback) {
var _self = this;
callback && this.addEventListener(eventName, function newCallback() {
this.addEventListener(eventName, function newCallback() {
_self.removeEventListener(eventName, newCallback);
callback.apply(null, arguments);
});
if (!callback) {
return new Promise(function(resolve) {
callback = resolve;
});
}
};
@ -630,7 +635,6 @@ EventEmitter.removeDefaultHandler = function(eventName, callback) {
var disabled = handlers._disabled_[eventName];
if (handlers[eventName] == callback) {
var old = handlers[eventName];
if (disabled)
this.setDefaultHandler(eventName, disabled.pop());
} else if (disabled) {
@ -675,7 +679,7 @@ exports.EventEmitter = EventEmitter;
});
define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"], function(require, exports, module) {
define("ace/anchor",[], function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
@ -800,7 +804,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
});
define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"], function(require, exports, module) {
define("ace/document",[], function(require, exports, module) {
"use strict";
var oop = require("./lib/oop");
@ -1091,28 +1095,23 @@ var Document = function(textOrLines) {
return;
}
if (isInsert && delta.lines.length > 20000)
if (isInsert && delta.lines.length > 20000) {
this.$splitAndapplyLargeDelta(delta, 20000);
applyDelta(this.$lines, delta, doNotValidate);
this._signal("change", delta);
}
else {
applyDelta(this.$lines, delta, doNotValidate);
this._signal("change", delta);
}
};
this.$splitAndapplyLargeDelta = function(delta, MAX) {
var lines = delta.lines;
var l = lines.length;
var l = lines.length - MAX + 1;
var row = delta.start.row;
var column = delta.start.column;
var from = 0, to = 0;
do {
from = to;
for (var from = 0, to = 0; from < l; from = to) {
to += MAX - 1;
var chunk = lines.slice(from, to);
if (to > l) {
delta.lines = chunk;
delta.start.row = row + from;
delta.start.column = column;
break;
}
chunk.push("");
this.applyDelta({
start: this.pos(row + from, column),
@ -1120,7 +1119,11 @@ var Document = function(textOrLines) {
action: delta.action,
lines: chunk
}, true);
} while(true);
}
delta.lines = lines.slice(from);
delta.start.row = row + from;
delta.start.column = column;
this.applyDelta(delta, true);
};
this.revertDelta = function(delta) {
this.applyDelta({
@ -1138,7 +1141,7 @@ var Document = function(textOrLines) {
if (index < 0)
return {row: i, column: index + lines[i].length + newlineLength};
}
return {row: l-1, column: lines[l-1].length};
return {row: l-1, column: index + lines[l-1].length + newlineLength};
};
this.positionToIndex = function(pos, startRow) {
var lines = this.$lines || this.getAllLines();
@ -1156,7 +1159,7 @@ var Document = function(textOrLines) {
exports.Document = Document;
});
define("ace/lib/lang",["require","exports","module"], function(require, exports, module) {
define("ace/lib/lang",[], function(require, exports, module) {
"use strict";
exports.last = function(a) {
@ -1258,7 +1261,7 @@ exports.escapeRegExp = function(str) {
};
exports.escapeHTML = function(str) {
return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
};
exports.getMatchOffsets = function(string, regExp) {
@ -1344,7 +1347,7 @@ exports.delayedCall = function(fcn, defaultTimeout) {
};
});
define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"], function(require, exports, module) {
define("ace/worker/mirror",[], function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
@ -1406,7 +1409,7 @@ var Mirror = exports.Mirror = function(sender) {
});
define("ace/mode/javascript/jshint",["require","exports","module"], function(require, exports, module) {
define("ace/mode/javascript/jshint",[], function(require, exports, module) {
module.exports = (function outer (modules, cache, entry) {
var previousRequire = typeof require == "function" && require;
function newRequire(name, jumped){
@ -11683,7 +11686,7 @@ exports.jasmine = {
});
define("ace/mode/javascript_worker",["require","exports","module","ace/lib/oop","ace/worker/mirror","ace/mode/javascript/jshint"], function(require, exports, module) {
define("ace/mode/javascript_worker",[], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
@ -11830,7 +11833,7 @@ oop.inherits(JavaScriptWorker, Mirror);
});
define("ace/lib/es5-shim",["require","exports","module"], function(require, exports, module) {
define("ace/lib/es5-shim",[], function(require, exports, module) {
function Empty() {}