=0; i--) {
- this.revertDelta(deltas[i]);
+ var delta = deltas[i];
+
+ var range = Range.fromPoints(delta.range.start, delta.range.end);
+
+ if (delta.action == "insertLines")
+ this._removeLines(range.start.row, range.end.row - 1);
+ else if (delta.action == "insertText")
+ this.remove(range);
+ else if (delta.action == "removeLines")
+ this._insertLines(range.start.row, delta.lines);
+ else if (delta.action == "removeText")
+ this.insert(range.start, delta.text);
}
};
-
- /**
- * Applies `delta` to the document.
- * @param {Object} delta A delta object (can include "insert" and "remove" actions)
- **/
- this.applyDelta = function(delta, doNotValidate) {
- var isInsert = delta.action == "insert";
- // An empty range is a NOOP.
- if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
- : !Range.comparePoints(delta.start, delta.end)) {
- return;
- }
-
- if (isInsert && delta.lines.length > 20000)
- this.$splitAndapplyLargeDelta(delta, 20000);
-
- // Apply.
- applyDelta(this.$lines, delta, doNotValidate);
- this._signal("change", delta);
- };
-
- this.$splitAndapplyLargeDelta = function(delta, MAX) {
- // Split large insert deltas. This is necessary because:
- // 1. We need to support splicing delta lines into the document via $lines.splice.apply(...)
- // 2. fn.apply() doesn't work for a large number of params. The smallest threshold is on chrome 40 ~42000.
- // we use 20000 to leave some space for actual stack
- //
- // To Do: Ideally we'd be consistent and also split 'delete' deltas. We don't do this now, because delete
- // delta handling is too slow. If we make delete delta handling faster we can split all large deltas
- // as shown in https://gist.github.com/aldendaniels/8367109#file-document-snippet-js
- // If we do this, update validateDelta() to limit the number of lines in a delete delta.
- var lines = delta.lines;
- var l = lines.length;
- var row = delta.start.row;
- var column = delta.start.column;
- var from = 0, to = 0;
- do {
- from = to;
- to += MAX - 1;
- var chunk = lines.slice(from, to);
- if (to > l) {
- // Update remaining delta.
- delta.lines = chunk;
- delta.start.row = row + from;
- delta.start.column = column;
- break;
- }
- chunk.push("");
- this.applyDelta({
- start: this.pos(row + from, column),
- end: this.pos(row + to, column = 0),
- action: delta.action,
- lines: chunk
- }, true);
- } while(true);
- };
-
- /**
- * Reverts `delta` from the document.
- * @param {Object} delta A delta object (can include "insert" and "remove" actions)
- **/
- this.revertDelta = function(delta) {
- this.applyDelta({
- start: this.clonePos(delta.start),
- end: this.clonePos(delta.end),
- action: (delta.action == "insert" ? "remove" : "insert"),
- lines: delta.lines.slice()
- });
- };
-
+
/**
* Converts an index position in a document to a `{row, column}` object.
*
diff --git a/lib/ace/document_test.js b/lib/ace/document_test.js
index ada56cd2..051434b4 100644
--- a/lib/ace/document_test.js
+++ b/lib/ace/document_test.js
@@ -46,7 +46,7 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 0, column: 1}, "juhu");
assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
@@ -63,9 +63,9 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
- doc.insertMergedLines({row: 0, column: 1}, ['', '']);
+ doc.insertNewLine({row: 0, column: 1});
assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
var d = deltas.concat();
@@ -80,9 +80,9 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
- doc.insertFullLines(0, ["aa", "bb"]);
+ doc.insertLines(0, ["aa", "bb"]);
assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
var d = deltas.concat();
@@ -97,9 +97,9 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
- doc.insertFullLines(2, ["aa", "bb"]);
+ doc.insertLines(2, ["aa", "bb"]);
assert.equal(doc.getValue(), ["12", "34", "aa", "bb"].join("\n"));
},
@@ -107,9 +107,9 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
- doc.insertFullLines(1, ["aa", "bb"]);
+ doc.insertLines(1, ["aa", "bb"]);
assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
var d = deltas.concat();
@@ -124,7 +124,7 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 0, column: 0}, "aa\nbb\ncc");
assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
@@ -141,9 +141,9 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
- doc.insert({row: 1, column: 2}, "aa\nbb\ncc");
+ doc.insert({row: 2, column: 0}, "aa\nbb\ncc");
assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
var d = deltas.concat();
@@ -158,7 +158,7 @@ module.exports = {
var doc = new Document(["12", "34"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.insert({row: 0, column: 1}, "aa\nbb\ncc");
assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
@@ -175,7 +175,7 @@ module.exports = {
var doc = new Document(["1234", "5678"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(0, 1, 0, 3));
assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
@@ -192,7 +192,7 @@ module.exports = {
var doc = new Document(["1234", "5678"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(0, 4, 1, 0));
assert.equal(doc.getValue(), ["12345678"].join("\n"));
@@ -209,7 +209,7 @@ module.exports = {
var doc = new Document(["1234", "5678", "abcd"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(0, 2, 2, 2));
assert.equal(doc.getValue(), ["12cd"].join("\n"));
@@ -226,7 +226,7 @@ module.exports = {
var doc = new Document(["1234", "5678", "abcd"]);
var deltas = [];
- doc.on("change", function(e) { deltas.push(e); });
+ doc.on("change", function(e) { deltas.push(e.data); });
doc.remove(new Range(1, 0, 3, 0));
assert.equal(doc.getValue(), ["1234", ""].join("\n"));
@@ -235,7 +235,7 @@ module.exports = {
"test: remove lines should return the removed lines" : function() {
var doc = new Document(["1234", "5678", "abcd"]);
- var removed = doc.removeFullLines(1, 2);
+ var removed = doc.removeLines(1, 2);
assert.equal(removed.join("\n"), ["5678", "abcd"].join("\n"));
},
diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js
index 2aa9b378..3e941375 100644
--- a/lib/ace/edit_session.js
+++ b/lib/ace/edit_session.js
@@ -151,7 +151,7 @@ var EditSession = function(text, mode) {
this.$foldData = [];
this.$foldData.toString = function() {
return this.join("\n");
- };
+ }
this.on("changeFold", this.onChangeFold.bind(this));
this.$onChange = this.onChange.bind(this);
@@ -249,12 +249,13 @@ var EditSession = function(text, mode) {
this.$resetRowCache(fold.start.row);
};
- this.onChange = function(delta) {
+ this.onChange = function(e) {
+ var delta = e.data;
this.$modified = true;
- this.$resetRowCache(delta.start.row);
+ this.$resetRowCache(delta.range.start.row);
- var removedFolds = this.$updateInternalDataOnChange(delta);
+ var removedFolds = this.$updateInternalDataOnChange(e);
if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
this.$deltasDoc.push(delta);
if (removedFolds && removedFolds.length != 0) {
@@ -268,7 +269,7 @@ var EditSession = function(text, mode) {
}
this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta);
- this._signal("change", delta);
+ this._signal("change", e);
};
/**
@@ -678,10 +679,10 @@ var EditSession = function(text, mode) {
};
/**
- * Returns an object containing all of the markers, either front or back.
+ * Returns an array containing the IDs of all the markers, either front or back.
* @param {Boolean} inFront If `true`, indicates you only want front markers; `false` indicates only back markers
*
- * @returns {Object}
+ * @returns {Array}
**/
this.getMarkers = function(inFront) {
return inFront ? this.$frontMarkers : this.$backMarkers;
@@ -1145,19 +1146,6 @@ var EditSession = function(text, mode) {
this.remove = function(range) {
return this.doc.remove(range);
};
-
- /**
- * Removes a range of full lines. This method also triggers the `'change'` event.
- * @param {Number} firstRow The first row to be removed
- * @param {Number} lastRow The last row to be removed
- * @returns {[String]} Returns all the removed lines.
- *
- * @related Document.removeFullLines
- *
- **/
- this.removeFullLines = function(firstRow, lastRow){
- return this.doc.removeFullLines(firstRow, lastRow);
- };
/**
* Reverts previous changes to your document.
@@ -1234,36 +1222,39 @@ var EditSession = function(text, mode) {
this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
function isInsert(delta) {
- return isUndo ? delta.action !== "insert" : delta.action === "insert";
+ var insert =
+ delta.action === "insertText" || delta.action === "insertLines";
+ return isUndo ? !insert : insert;
}
var delta = deltas[0];
var range, point;
var lastDeltaIsInsert = false;
if (isInsert(delta)) {
- range = Range.fromPoints(delta.start, delta.end);
+ range = Range.fromPoints(delta.range.start, delta.range.end);
lastDeltaIsInsert = true;
} else {
- range = Range.fromPoints(delta.start, delta.start);
+ range = Range.fromPoints(delta.range.start, delta.range.start);
lastDeltaIsInsert = false;
}
for (var i = 1; i < deltas.length; i++) {
delta = deltas[i];
if (isInsert(delta)) {
- point = delta.start;
+ point = delta.range.start;
if (range.compare(point.row, point.column) == -1) {
- range.setStart(point);
+ range.setStart(delta.range.start);
}
- point = delta.end;
+ point = delta.range.end;
if (range.compare(point.row, point.column) == 1) {
- range.setEnd(point);
+ range.setEnd(delta.range.end);
}
lastDeltaIsInsert = true;
} else {
- point = delta.start;
+ point = delta.range.start;
if (range.compare(point.row, point.column) == -1) {
- range = Range.fromPoints(delta.start, delta.start);
+ range =
+ Range.fromPoints(delta.range.start, delta.range.start);
}
lastDeltaIsInsert = false;
}
@@ -1377,7 +1368,7 @@ var EditSession = function(text, mode) {
this.indentRows = function(startRow, endRow, indentString) {
indentString = indentString.replace(/\t/g, this.getTabString());
for (var row=startRow; row<=endRow; row++)
- this.doc.insertInLine({row: row, column: 0}, indentString);
+ this.insert({row: row, column:0}, indentString);
};
/**
@@ -1434,11 +1425,11 @@ var EditSession = function(text, mode) {
x.end.row += diff;
return x;
});
-
+
var lines = dir == 0
? this.doc.getLines(firstRow, lastRow)
- : this.doc.removeFullLines(firstRow, lastRow);
- this.doc.insertFullLines(firstRow+diff, lines);
+ : this.doc.removeLines(firstRow, lastRow);
+ this.doc.insertLines(firstRow+diff, lines);
folds.length && this.addFolds(folds);
return diff;
};
@@ -1448,6 +1439,8 @@ var EditSession = function(text, mode) {
* @param {Number} lastRow The final row to move up
* @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
*
+ * @related Document.insertLines
+ *
**/
this.moveLinesUp = function(firstRow, lastRow) {
return this.$moveLines(firstRow, lastRow, -1);
@@ -1458,6 +1451,8 @@ var EditSession = function(text, mode) {
* @param {Number} firstRow The starting row to move down
* @param {Number} lastRow The final row to move down
* @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
+ *
+ * @related Document.insertLines
**/
this.moveLinesDown = function(firstRow, lastRow) {
return this.$moveLines(firstRow, lastRow, 1);
@@ -1661,23 +1656,34 @@ var EditSession = function(text, mode) {
};
};
- this.$updateInternalDataOnChange = function(delta) {
+ this.$updateInternalDataOnChange = function(e) {
var useWrapMode = this.$useWrapMode;
- var action = delta.action;
- var start = delta.start;
- var end = delta.end;
- var firstRow = start.row;
- var lastRow = end.row;
- var len = lastRow - firstRow;
+ var len;
+ var action = e.data.action;
+ var firstRow = e.data.range.start.row;
+ var lastRow = e.data.range.end.row;
+ var start = e.data.range.start;
+ var end = e.data.range.end;
var removedFolds = null;
-
+
+ if (action.indexOf("Lines") != -1) {
+ if (action == "insertLines") {
+ lastRow = firstRow + (e.data.lines.length);
+ } else {
+ lastRow = firstRow;
+ }
+ len = e.data.lines ? e.data.lines.length : lastRow - firstRow;
+ } else {
+ len = lastRow - firstRow;
+ }
+
this.$updating = true;
if (len != 0) {
- if (action === "remove") {
+ if (action.indexOf("remove") != -1) {
this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
var foldLines = this.$foldData;
- removedFolds = this.getFoldsInRange(delta);
+ removedFolds = this.getFoldsInRange(e.data.range);
this.removeFolds(removedFolds);
var foldLine = this.getFoldLine(end.row);
@@ -1742,10 +1748,10 @@ var EditSession = function(text, mode) {
} else {
// Realign folds. E.g. if you add some new chars before a fold, the
// fold should "move" to the right.
- len = Math.abs(delta.start.column - delta.end.column);
- if (action === "remove") {
+ len = Math.abs(e.data.range.start.column - e.data.range.end.column);
+ if (action.indexOf("remove") != -1) {
// Get all the folds in the change range and remove them.
- removedFolds = this.getFoldsInRange(delta);
+ removedFolds = this.getFoldsInRange(e.data.range);
this.removeFolds(removedFolds);
len = -len;
diff --git a/lib/ace/edit_session/folding.js b/lib/ace/edit_session/folding.js
index 77c0f22d..53071dda 100644
--- a/lib/ace/edit_session/folding.js
+++ b/lib/ace/edit_session/folding.js
@@ -829,13 +829,15 @@ function Folding() {
}
};
- this.updateFoldWidgets = function(delta) {
- var firstRow = delta.start.row;
- var len = delta.end.row - firstRow;
+ this.updateFoldWidgets = function(e) {
+ var delta = e.data;
+ var range = delta.range;
+ var firstRow = range.start.row;
+ var len = range.end.row - firstRow;
if (len === 0) {
this.foldWidgets[firstRow] = null;
- } else if (delta.action == 'remove') {
+ } else if (delta.action == "removeText" || delta.action == "removeLines") {
this.foldWidgets.splice(firstRow, len + 1, null);
} else {
var args = Array(len + 1);
diff --git a/lib/ace/edit_session_test.js b/lib/ace/edit_session_test.js
index 0b904b63..5e309cf6 100644
--- a/lib/ace/edit_session_test.js
+++ b/lib/ace/edit_session_test.js
@@ -442,12 +442,12 @@ module.exports = {
session.setTabSize(4);
assert.equal(session.getScreenWidth(), 2);
- session.doc.insertMergedLines({row: 0, column: Infinity}, ['', '']);
- session.doc.insertFullLines(1, ["123"]);
+ session.doc.insertNewLine({row: 0, column: Infinity});
+ session.doc.insertLines(1, ["123"]);
assert.equal(session.getScreenWidth(), 3);
- session.doc.insertMergedLines({row: 0, column: Infinity}, ['', '']);
- session.doc.insertFullLines(1, ["\t\t"]);
+ session.doc.insertNewLine({row: 0, column: Infinity});
+ session.doc.insertLines(1, ["\t\t"]);
assert.equal(session.getScreenWidth(), 8);
@@ -471,9 +471,9 @@ module.exports = {
session.setUseWrapMode(true);
- document.insertFullLines(0, ["a", "b"]);
- document.insertFullLines(2, ["c", "d"]);
- document.removeFullLines(1, 2);
+ document.insertLines(0, ["a", "b"]);
+ document.insertLines(2, ["c", "d"]);
+ document.removeLines(1, 2);
},
"test wrapMode init has to create wrapData array": function() {
diff --git a/lib/ace/editor.js b/lib/ace/editor.js
index 5da8a961..f00f74f6 100644
--- a/lib/ace/editor.js
+++ b/lib/ace/editor.js
@@ -692,15 +692,20 @@ var Editor = function(renderer, session) {
*
*
**/
- this.onDocumentChange = function(delta) {
- // Rerender and emit "change" event.
- var wrap = this.session.$useWrapMode;
- var lastRow = (delta.start.row == delta.end.row ? delta.end.row : Infinity);
- this.renderer.updateLines(delta.start.row, lastRow, wrap);
+ this.onDocumentChange = function(e) {
+ var delta = e.data;
+ var range = delta.range;
+ var lastRow;
- this._signal("change", delta);
-
- // Update cursor because tab characters can influence the cursor position.
+ if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
+ lastRow = range.end.row;
+ else
+ lastRow = Infinity;
+ this.renderer.updateLines(range.start.row, lastRow, this.session.$useWrapMode);
+
+ this._signal("change", e);
+
+ // update cursor because tab characters can influence the cursor position
this.$cursorChange();
this.$updateHighlightActiveLine();
};
@@ -915,16 +920,14 @@ var Editor = function(renderer, session) {
*
*
**/
- this.onPaste = function(text, event) {
- var e = {text: text, event: event};
- this.commands.exec("paste", this, e);
- };
-
- this.$handlePaste = function(e) {
- if (typeof e == "string")
- e = {text: e};
+ this.onPaste = function(text) {
+ // todo this should change when paste becomes a command
+ if (this.$readOnly)
+ return;
+
+ var e = {text: text};
this._signal("paste", e);
- var text = e.text;
+ text = e.text;
if (!this.inMultiSelectMode || this.inVirtualSelectionMode) {
this.insert(text);
} else {
@@ -942,6 +945,7 @@ var Editor = function(renderer, session) {
this.session.insert(range.start, lines[i]);
}
}
+ this.renderer.scrollCursorIntoView();
};
this.execCommand = function(command, args) {
@@ -1629,7 +1633,15 @@ var Editor = function(renderer, session) {
**/
this.removeLines = function() {
var rows = this.$getSelectedRows();
- this.session.removeFullLines(rows.first, rows.last);
+ var range;
+ if (rows.first === 0 || rows.last+1 < this.session.getLength())
+ range = new Range(rows.first, 0, rows.last+1, 0);
+ else
+ range = new Range(
+ rows.first-1, this.session.getLine(rows.first-1).length,
+ rows.last, this.session.getLine(rows.last).length
+ );
+ this.session.remove(range);
this.clearSelection();
};
diff --git a/lib/ace/ext/chromevox.js b/lib/ace/ext/chromevox.js
index 52a180d4..9f7a7996 100644
--- a/lib/ace/ext/chromevox.js
+++ b/lib/ace/ext/chromevox.js
@@ -578,14 +578,15 @@ var onSelectionChange = function(evt) {
* and deleting text.
* @param {!Event} evt The event.
*/
-var onChange = function(delta) {
+var onChange = function(evt) {
+ var data = evt.data;
switch (data.action) {
- case 'remove':
+ case 'removeText':
cvox.Api.speak(data.text, 0, DELETED_PROP);
/* Let the future cursor change event know it's from text change. */
changed = true;
break;
- case 'insert':
+ case 'insertText':
cvox.Api.speak(data.text, 0);
/* Let the future cursor change event know it's from text change. */
changed = true;
diff --git a/lib/ace/ext/elastic_tabstops_lite.js b/lib/ace/ext/elastic_tabstops_lite.js
index 0f89423a..9901c5df 100644
--- a/lib/ace/ext/elastic_tabstops_lite.js
+++ b/lib/ace/ext/elastic_tabstops_lite.js
@@ -44,12 +44,13 @@ var ElasticTabstopsLite = function(editor) {
this.onExec = function() {
recordChanges = true;
};
- this.onChange = function(delta) {
+ this.onChange = function(e) {
+ var range = e.data.range
if (recordChanges) {
- if (changedRows.indexOf(delta.start.row) == -1)
- changedRows.push(delta.start.row);
- if (delta.end.row != delta.start.row)
- changedRows.push(delta.end.row);
+ if (changedRows.indexOf(range.start.row) == -1)
+ changedRows.push(range.start.row);
+ if (range.end.row != range.start.row)
+ changedRows.push(range.end.row);
}
};
};
diff --git a/lib/ace/ext/modelist.js b/lib/ace/ext/modelist.js
index 675a4b85..7a5a1e9c 100644
--- a/lib/ace/ext/modelist.js
+++ b/lib/ace/ext/modelist.js
@@ -117,13 +117,12 @@ var supportedModes = {
MUSHCode: ["mc|mush"],
MySQL: ["mysql"],
Nix: ["nix"],
- Nim: ["nim"],
ObjectiveC: ["m|mm"],
OCaml: ["ml|mli"],
Pascal: ["pas|p"],
Perl: ["pl|pm"],
pgSQL: ["pgsql"],
- PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp"],
+ PHP: ["php|phtml"],
Powershell: ["ps1"],
Praat: ["praat|praatscript|psc|proc"],
Prolog: ["plg|prolog"],
diff --git a/lib/ace/ext/static_highlight.js b/lib/ace/ext/static_highlight.js
index 2acb3ac5..b2287f15 100644
--- a/lib/ace/ext/static_highlight.js
+++ b/lib/ace/ext/static_highlight.js
@@ -37,10 +37,6 @@ var baseStyles = require("../requirejs/text!./static.css");
var config = require("../config");
var dom = require("../lib/dom");
-var SimpleTextLayer = function() {
- this.config = {};
-};
-SimpleTextLayer.prototype = TextLayer.prototype;
var highlight = function(el, opts, callback) {
var m = el.className.match(/lang-(\w+)/);
@@ -153,8 +149,12 @@ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
session.setUseWorker(false);
session.setMode(mode);
- var textLayer = new SimpleTextLayer();
+ var textLayer = new TextLayer(document.createElement("div"));
textLayer.setSession(session);
+ textLayer.config = {
+ characterWidth: 10,
+ lineHeight: 20
+ };
session.setValue(input);
diff --git a/lib/ace/ext/themelist.js b/lib/ace/ext/themelist.js
index 0df76b02..2350a2e2 100644
--- a/lib/ace/ext/themelist.js
+++ b/lib/ace/ext/themelist.js
@@ -73,7 +73,6 @@ var themeData = [
["Solarized Dark" ,"solarized_dark" , "dark"],
["Terminal" ,"terminal" , "dark"],
["Tomorrow Night" ,"tomorrow_night" , "dark"],
- ["The Night After Tomorrow" ,"the_night_after_tomorrow" , "dark"],
["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"],
["Tomorrow Night Bright","tomorrow_night_bright" , "dark"],
["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"],
diff --git a/lib/ace/keyboard/textinput.js b/lib/ace/keyboard/textinput.js
index 4a2bb72c..0bd57eed 100644
--- a/lib/ace/keyboard/textinput.js
+++ b/lib/ace/keyboard/textinput.js
@@ -306,7 +306,7 @@ var TextInput = function(parentNode, host) {
var data = handleClipboardData(e);
if (typeof data == "string") {
if (data)
- host.onPaste(data, e);
+ host.onPaste(data);
if (useragent.isIE)
setTimeout(resetSelection);
event.preventDefault(e);
diff --git a/lib/ace/keyboard/vim.js b/lib/ace/keyboard/vim.js
index 17c26c16..fc41bb90 100644
--- a/lib/ace/keyboard/vim.js
+++ b/lib/ace/keyboard/vim.js
@@ -178,6 +178,13 @@ define(function(require, exports, module) {
return this.ace.inVirtualSelectionMode && this.ace.selection.index;
};
this.onChange = function(delta) {
+ var oldDelta = delta.data;
+ delta = {
+ start: oldDelta.range.start,
+ end: oldDelta.range.end,
+ action: oldDelta.action,
+ lines: oldDelta.lines || [oldDelta.text]
+ };// v1.2 api compatibility
if (delta.action[0] == 'i') {
var change = { text: delta.lines };
var curOp = this.curOp = this.curOp || {};
@@ -571,6 +578,7 @@ define(function(require, exports, module) {
highlight.session = null;
};
highlight.updateOnChange = function(delta) {
+ delta = delta.data.range;// v1.2 api compatibility
var row = delta.start.row;
if (row == delta.end.row) highlight.cache[row] = undefined;
else highlight.cache.splice(row, highlight.cache.length);
diff --git a/lib/ace/layer/gutter.js b/lib/ace/layer/gutter.js
index dc1055c2..13ee8a25 100644
--- a/lib/ace/layer/gutter.js
+++ b/lib/ace/layer/gutter.js
@@ -100,14 +100,16 @@ var Gutter = function(parentEl) {
}
};
- this.$updateAnnotations = function (delta) {
+ this.$updateAnnotations = function (e) {
if (!this.$annotations.length)
return;
- var firstRow = delta.start.row;
- var len = delta.end.row - firstRow;
+ var delta = e.data;
+ var range = delta.range;
+ var firstRow = range.start.row;
+ var len = range.end.row - firstRow;
if (len === 0) {
// do nothing
- } else if (delta.action == 'remove') {
+ } else if (delta.action == "removeText" || delta.action == "removeLines") {
this.$annotations.splice(firstRow, len + 1, null);
} else {
var args = new Array(len + 1);
diff --git a/lib/ace/layer/marker.js b/lib/ace/layer/marker.js
index 9818d225..26f38447 100644
--- a/lib/ace/layer/marker.js
+++ b/lib/ace/layer/marker.js
@@ -90,7 +90,7 @@ var Marker = function(parentEl) {
else
this.drawMultiLineMarker(html, range, marker.clazz, config);
} else {
- this.drawSingleLineMarker(html, range, marker.clazz + " ace_start" + " ace_br15", config);
+ this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
}
}
this.element.innerHTML = html.join("");
@@ -100,30 +100,29 @@ var Marker = function(parentEl) {
return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
};
- function getBorderClass(tl, tr, br, bl) {
- return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0);
- }
// Draws a marker, which spans a range of text on multiple lines
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {
+ // selection start
+ var row = range.start.row;
var session = this.session;
- var start = range.start.row;
- var end = range.end.row;
- var row = start;
- var prev = 0;
- var curr = 0;
- var next = session.getScreenLastRowColumn(row);
- var lineRange = new Range(row, range.start.column, row, curr);
- for (; row <= end; row++) {
- lineRange.start.row = lineRange.end.row = row;
- lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row);
- lineRange.end.column = next;
- prev = curr;
- curr = next;
- next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column;
- this.drawSingleLineMarker(stringBuilder, lineRange,
- clazz + (row == start ? " ace_start" : "") + " ace_br"
- + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end),
- layerConfig, row == end ? 0 : 1, extraStyle);
+
+ var lineRange = new Range(
+ row, range.start.column,
+ row, session.getScreenLastRowColumn(row)
+ );
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, extraStyle);
+
+ // selection end
+ row = range.end.row;
+ lineRange = new Range(row, session.getRowWrapIndent(row), row, range.end.column);
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, extraStyle);
+
+ for (row = range.start.row + 1; row < range.end.row; row++) {
+ lineRange.start.row = row;
+ lineRange.start.column = session.getRowWrapIndent(row);
+ lineRange.end.row = row;
+ lineRange.end.column = session.getScreenLastRowColumn(row);
+ this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, extraStyle);
}
};
@@ -137,7 +136,7 @@ var Marker = function(parentEl) {
extraStyle = extraStyle || "";
stringBuilder.push(
- ""
- + lang.stringRepeat(this.TAB_CHAR, i)
+ + this.TAB_CHAR
+ + lang.stringRepeat(" ", i - 1)
+ "");
} else {
tabStr.push(lang.stringRepeat(" ", i));
@@ -144,7 +145,7 @@ var Text = function(parentEl) {
spaceClass = " ace_invisible_space";
tabClass = " ace_invisible_tab";
var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
- var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize);
+ var tabContent = this.TAB_CHAR + lang.stringRepeat(" ", this.tabSize - 1);
} else{
var spaceContent = lang.stringRepeat(" ", this.tabSize);
var tabContent = spaceContent;
diff --git a/lib/ace/layer/text_test.js b/lib/ace/layer/text_test.js
index 3946ec66..e3403ca4 100644
--- a/lib/ace/layer/text_test.js
+++ b/lib/ace/layer/text_test.js
@@ -91,7 +91,7 @@ module.exports = {
var EOL = "" + textLayer.EOL_CHAR + "";
var SPACE = function(i) {return Array(i+1).join(" ")}
var DOT = function(i) {return Array(i+1).join(textLayer.SPACE_CHAR)}
- var TAB = function(i) {return Array(i+1).join(textLayer.TAB_CHAR)}
+ var TAB = function(i) {return textLayer.TAB_CHAR + SPACE(i-1)}
function testRender(results) {
for (var i = results.length; i--; ) {
var stringBuilder = [];
diff --git a/lib/ace/lib/dom.js b/lib/ace/lib/dom.js
index 2cbfe23e..ef2f7caa 100644
--- a/lib/ace/lib/dom.js
+++ b/lib/ace/lib/dom.js
@@ -91,11 +91,6 @@ exports.toggleCssClass = function(el, name) {
return add;
};
-if (typeof document == "undefined") {
- exports.importCssString = function() {};
- return;
-}
-
/*
* Add or remove a CSS class from the list of classes on the given node
* depending on the value of include
@@ -178,6 +173,9 @@ exports.getInnerHeight = function(element) {
};
+if (typeof document == "undefined")
+ return;
+
if (window.pageYOffset !== undefined) {
exports.getPageScrollTop = function() {
return window.pageYOffset;
diff --git a/lib/ace/line_widgets.js b/lib/ace/line_widgets.js
index ba87d857..d4080b53 100644
--- a/lib/ace/line_widgets.js
+++ b/lib/ace/line_widgets.js
@@ -113,16 +113,18 @@ function LineWidgets(session) {
});
};
- this.updateOnChange = function(delta) {
+ this.updateOnChange = function(e) {
var lineWidgets = this.session.lineWidgets;
if (!lineWidgets) return;
-
- var startRow = delta.start.row;
- var len = delta.end.row - startRow;
+
+ var delta = e.data;
+ var range = delta.range;
+ var startRow = range.start.row;
+ var len = range.end.row - startRow;
if (len === 0) {
// return
- } else if (delta.action == 'remove') {
+ } else if (delta.action == "removeText" || delta.action == "removeLines") {
var removed = lineWidgets.splice(startRow + 1, len);
removed.forEach(function(w) {
w && this.removeLineWidget(w);
diff --git a/lib/ace/mode/_test/tokens_gherkin.json b/lib/ace/mode/_test/tokens_gherkin.json
index 173d9798..d16ffc6c 100644
--- a/lib/ace/mode/_test/tokens_gherkin.json
+++ b/lib/ace/mode/_test/tokens_gherkin.json
@@ -56,34 +56,34 @@
],[
"start",
["text"," "],
- ["comment","|"],
- ["string"," start "],
- ["comment","|"],
- ["string"," eat "],
- ["comment","|"],
- ["string"," left "],
+ ["comment","| "],
+ ["string","start "],
+ ["comment","| "],
+ ["string","eat "],
+ ["comment","| "],
+ ["string","left "],
["comment","|"]
],[
"start",
["text"," "],
- ["comment","|"],
- ["string"," 12 "],
- ["comment","|"],
- ["string"," 5 "],
- ["comment","|"],
- ["string"," 7 "],
+ ["comment","| "],
+ ["string"," 12 "],
+ ["comment","| "],
+ ["string"," 5 "],
+ ["comment","| "],
+ ["string"," 7 "],
["comment","|"]
],[
"start",
["text"," "],
- ["comment","|"],
- ["string"," 20 "],
- ["comment","|"],
- ["string"," 5 "],
- ["comment","|"],
- ["string"," 15 "],
- ["comment","|"],
- ["string"," "]
+ ["comment","| "],
+ ["string"," 20 "],
+ ["comment","| "],
+ ["string"," 5 "],
+ ["comment","| "],
+ ["string"," 15 "],
+ ["comment","| "],
+ ["string"," "]
],[
"start"
],[
diff --git a/lib/ace/mode/behaviour/behaviour_test.js b/lib/ace/mode/behaviour/behaviour_test.js
index 245edf99..9dc27bf8 100644
--- a/lib/ace/mode/behaviour/behaviour_test.js
+++ b/lib/ace/mode/behaviour/behaviour_test.js
@@ -144,16 +144,6 @@ module.exports = {
exec("selectleft", 1);
exec("insertstring", 1, '"');
assert.equal(editor.getValue(), '("foo")');
-
- editor.setValue("", 1);
- exec("selectleft", 1);
- exec("insertstring", 1, '"');
- assert.equal(editor.getValue(), '""');
- exec("insertstring", 1, '\\');
- exec("insertstring", 1, 'n');
- exec("insertstring", 1, '"');
- assert.equal(editor.getValue(), '"\\n"');
-
},
"test: xml": function() {
editor = new Editor(new MockRenderer());
diff --git a/lib/ace/mode/behaviour/cstyle.js b/lib/ace/mode/behaviour/cstyle.js
index dd1b0d14..a1dce91e 100644
--- a/lib/ace/mode/behaviour/cstyle.js
+++ b/lib/ace/mode/behaviour/cstyle.js
@@ -269,8 +269,8 @@ var CstyleBehaviour = function() {
if (leftChar == "\\" && token && /escape/.test(token.type))
return null;
- var stringBefore = token && /string|escape/.test(token.type);
- var stringAfter = !rightToken || /string|escape/.test(rightToken.type);
+ var stringBefore = token && /string/.test(token.type);
+ var stringAfter = !rightToken || /string/.test(rightToken.type);
var pair;
if (rightChar == quote) {
diff --git a/lib/ace/mode/gherkin_highlight_rules.js b/lib/ace/mode/gherkin_highlight_rules.js
index 04ce877c..d54db204 100644
--- a/lib/ace/mode/gherkin_highlight_rules.js
+++ b/lib/ace/mode/gherkin_highlight_rules.js
@@ -36,18 +36,18 @@ var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]
var GherkinHighlightRules = function() {
- // need to include constant ints
+ // need to include constant ints
this.$rules = {
- start : [{
+ start : [{
token: 'constant.numeric',
regex: "(?:(?:[1-9]\\d*)|(?:0))"
- }, {
- token : "comment",
- regex : "#.*$"
- }, {
- token : "keyword",
- regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
- }, {
+ }, {
+ token : "comment",
+ regex : "#.*$"
+ }, {
+ token : "keyword",
+ regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
+ }, {
token : "string", // multi line """ string start
regex : '"{3}',
next : "qqstring3"
@@ -56,22 +56,22 @@ var GherkinHighlightRules = function() {
regex : '"',
next : "qqstring"
}, {
- token : "comment",
- regex : "@[A-Za-z0-9]+",
- next : "start"
+ token : "comment",
+ regex : "@[A-Za-z0-9]+",
+ next : "start"
}, {
- token : "comment",
- regex : "<.+>"
+ token : "comment",
+ regex : "<.+>"
}, {
- token : "comment",
- regex : "\\|(?=.)",
- next : "table-item"
+ token : "comment",
+ regex : "\\| ",
+ next : "table-item"
}, {
- token : "comment",
- regex : "\\|$",
- next : "start"
+ token : "comment",
+ regex : "\\|$",
+ next : "start"
}],
- "qqstring3" : [ {
+ "qqstring3" : [ {
token : "constant.language.escape",
regex : stringEscape
}, {
@@ -81,7 +81,7 @@ var GherkinHighlightRules = function() {
}, {
defaultToken : "string"
}],
- "qqstring" : [{
+ "qqstring" : [{
token : "constant.language.escape",
regex : stringEscape
}, {
@@ -96,19 +96,15 @@ var GherkinHighlightRules = function() {
defaultToken: "string"
}],
"table-item" : [{
- token : "comment",
- regex : /$/,
- next : "start"
- }, {
- token : "comment",
- regex : /\|/
- }, {
token : "string",
- regex : /\\./
- }, {
- defaultToken : "string"
- }]
+ regex : "[A-Za-z0-9 ]*",
+ next : "start"
+ }],
};
+
+
+ //new TextHighlightRules().getRules();
+
}
oop.inherits(GherkinHighlightRules, TextHighlightRules);
diff --git a/lib/ace/mode/handlebars.js b/lib/ace/mode/handlebars.js
index 164ad43f..3f2e7179 100644
--- a/lib/ace/mode/handlebars.js
+++ b/lib/ace/mode/handlebars.js
@@ -13,6 +13,7 @@ var Mode = function() {
HtmlMode.call(this);
this.HighlightRules = HandlebarsHighlightRules;
this.$behaviour = new HtmlBehaviour();
+
this.foldingRules = new HtmlFoldMode();
};
@@ -20,7 +21,7 @@ var Mode = function() {
oop.inherits(Mode, HtmlMode);
(function() {
- this.blockComment = {start: "{{!--", end: "--}}"};
+ this.blockComment = {start: "{!--", end: "--}"};
this.$id = "ace/mode/handlebars";
}).call(Mode.prototype);
diff --git a/lib/ace/mode/less_highlight_rules.js b/lib/ace/mode/less_highlight_rules.js
index a0162765..d39bdeae 100644
--- a/lib/ace/mode/less_highlight_rules.js
+++ b/lib/ace/mode/less_highlight_rules.js
@@ -231,7 +231,7 @@ var LessHighlightRules = function() {
regex: "\\.[a-z0-9-_]+"
}, {
token: "variable.language",
- regex: ":[a-z_][a-z0-9-_]*"
+ regex: ":[a-z0-9-_]+"
}, {
token: "constant",
regex: "[a-z0-9-_]+"
diff --git a/lib/ace/mode/nim.js b/lib/ace/mode/nim.js
deleted file mode 100644
index cbf48ef2..00000000
--- a/lib/ace/mode/nim.js
+++ /dev/null
@@ -1,113 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define(function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var TextMode = require("./text").Mode;
-var NimHighlightRules = require("./nim_highlight_rules").NimHighlightRules;
-var NimFoldMode = require("./folding/pythonic").FoldMode;
-var Range = require("../range").Range;
-
-var Mode = function() {
- this.HighlightRules = NimHighlightRules;
- this.foldingRules = new NimFoldMode("\\:|=");
-};
-oop.inherits(Mode, TextMode);
-
-(function() {
-
- this.lineCommentStart = "#";
-
- this.getNextLineIndent = function(state, line, tab) {
- var indent = this.$getIndent(line);
-
- var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
- var tokens = tokenizedLine.tokens;
-
- if (tokens.length && tokens[tokens.length-1].type == "comment") {
- return indent;
- }
-
- if (state == "start") {
- var match = line.match(/^.*[\{\(\[\:=]\s*$/);
- if (match) {
- indent += tab;
- }
- }
-
- return indent;
- };
-
- var outdents = {
- "discard": 1,
- "return": 1,
- "raise": 1,
- "break": 1,
- "continue": 1
- };
-
- this.checkOutdent = function(state, line, input) {
- if (input !== "\r\n" && input !== "\r" && input !== "\n")
- return false;
-
- var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
-
- if (!tokens)
- return false;
-
- // ignore trailing comments
- do {
- var last = tokens.pop();
- } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
-
- if (!last)
- return false;
-
- return (last.type == "keyword" && outdents[last.value]);
- };
-
- this.autoOutdent = function(state, doc, row) {
- // outdenting in python is slightly different because it always applies
- // to the next line and only of a new line is inserted
-
- row += 1;
- var indent = this.$getIndent(doc.getLine(row));
- var tab = doc.getTabString();
- if (indent.slice(-tab.length) == tab)
- doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
- };
-
- this.$id = "ace/mode/nim";
-}).call(Mode.prototype);
-
-exports.Mode = Mode;
-});
diff --git a/lib/ace/mode/nim_highlight_rules.js b/lib/ace/mode/nim_highlight_rules.js
deleted file mode 100644
index e762a636..00000000
--- a/lib/ace/mode/nim_highlight_rules.js
+++ /dev/null
@@ -1,238 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-/*
- * TODO: nim delimiters
- */
-
-define(function(require, exports, module) {
-"use strict";
-
-var oop = require("../lib/oop");
-var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
-var num_suffix = "(\'[Ff]32|\'[Ff]64|\'[IiUu]8|\'[IiUu]16|\'[IiUu]32|\'[IiUu]64)";
-
-var NimHighlightRules = function() {
-
- var keywords = (
- "addr|and|as|asm|atomic|bind|block|break|case|cast|const|continue|" +
- "converter|defer|discard|distinct|div|do|elif|else|end|enum|except|" +
- "export|finally|for|from|func|generic|if|import|in|include|interface|" +
- "is|isnot|iterator|let|macro|method|mixin|mod|nil|not|notin|object|of|" +
- "or|out|proc|ptr|raise|ref|return|shl|shr|static|template|try|tuple|" +
- "type|using|var|when|while|with|without|xor|yield"
- );
-
- var builtinConstants = (
- "true|false|nil|NotImplemented|Ellipsis"
- );
-
- var storageType = (
- "string|seq|array|expr|stmt|typed|untyped|any|auto|bool|cdouble|cfloat|"+
- "cchar|clongdouble|clong|clonglong|cshort|csize|cstring|cstringarray|"+
- "culong|culonglong|cushort|guarded|natural|openarray|ordinal|pointer|"+
- "range|set|shared|static|typedesc|varargs|void"
- );
-
- var builtinFunctions = (
- "defined|declared|declaredInScope|echo|$"
- );
-
- //var futureReserved = "";
- var keywordMapper = this.createKeywordMapper({
- "invalid.deprecated": "debugger",
- "support.function": builtinFunctions,
- //"invalid.illegal": futureReserved,
- "constant.language": builtinConstants,
- "storage.type" : storageType,
- "keyword": keywords
- }, "identifier");
-
- var strPre = "(?:r|R)?";
-
- var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
- var octInteger = "(?:0[o]?[0-7]+)";
- var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
- var binInteger = "(?:0[bB][01]+)";
- var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
-
- var exponent = "(?:[eE][+-]?\\d+)";
- var fraction = "(?:\\.\\d+)";
- var intPart = "(?:\\d+)";
- var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
- var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
- var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
-
- var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
-
- this.$rules = {
- "start" : [ {
- token : "comment",
- regex : "#.*$"
- }, {
- token : "keyword",
- regex : "(proc|method|temdplate|macro|macromethod|converter|func|iterator) ",
- next : "qproc_name"
- }, {
- token : "storage.type",
- regex : "(c|cu|u)?int(8|16|32|64)?",
- }, {
- token : "storage.type",
- regex : "(c|cu|u|cs)?char",
- }, {
- token : "storage.type",
- regex : "float(32|64)?",
- }, {
- token : "docstring",
- regex : "##.*$"
- }, {
- token : "string", // multi line """ string start
- regex : strPre + '"{3}',
- next : "qqstring3"
- }, {
- token : "string", // " string
- regex : strPre + '"(?=.)',
- next : "qqstring"
- }, {
- token : "string", // multi line ''' string start
- regex : strPre + "'{3}",
- next : "qstring3"
- }, {
- token : "backtick", // ` string
- regex : strPre + "`(?=.)",
- next : "qxstring"
- }, {
- token : "string", // ' string
- regex : strPre + "'(?=.)",
- next : "qstring"
- }, {
- token : "constant.numeric", // imaginary
- regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
- }, {
- token : "constant.numeric", // float
- regex : floatNumber
- }, {
- token : "constant.numeric", // long integer
- regex : integer + "[lL]\\b"
- }, {
- token : "constant.numeric", // integer
- regex : integer + "\\b"
- }, {
- token : keywordMapper,
- regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
- }, {
- token : "keyword.operator",
- regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
- }, {
- token : "paren.lparen",
- regex : "[\\[\\(\\{]"
- }, {
- token : "paren.rparen",
- regex : "[\\]\\)\\}]"
- }, {
- token : "text",
- regex : "\\s+"
- } ],
- "qqstring3" : [ {
- token : "constant.language.escape",
- regex : stringEscape
- }, {
- token : "string", // multi line """ string end
- regex : '"{3}',
- next : "start"
- }, {
- defaultToken : "string"
- } ],
- "qstring3" : [ {
- token : "constant.language.escape",
- regex : stringEscape
- }, {
- token : "string", // multi line ''' string end
- regex : "'{3}",
- next : "start"
- }, {
- defaultToken : "string"
- } ],
- "qqstring" : [{
- token : "constant.language.escape",
- regex : stringEscape
- }, {
- token : "string",
- regex : "\\\\$",
- next : "qqstring"
- }, {
- token : "string",
- regex : '"|$',
- next : "start"
- }, {
- defaultToken: "string"
- }],
- "qstring" : [{
- token : "constant.language.escape",
- regex : stringEscape
- }, {
- token : "string",
- regex : "\\\\$",
- next : "qstring"
- }, {
- token : "string",
- regex : "'|$",
- next : "start"
- }, {
- defaultToken: "string"
- }],
- "qxstring" : [{
- token : "constant.language.escape",
- regex : stringEscape
- }, {
- token : "backtick",
- regex : "\\\\$",
- next : "qxstring"
- }, {
- token : "backtick",
- regex : "`|$",
- next : "start"
- }, {
- defaultToken: "backtick"
- }],
- "qproc_name":[{
- token : "proc_name",
- regex : "\\w+",
- },{
- token : "start_bracket",
- regex : "(\\(|=|$)",
- next : "start"
- }],
- };
-};
-
-oop.inherits(NimHighlightRules, TextHighlightRules);
-
-exports.NimHighlightRules = NimHighlightRules;
-});
diff --git a/lib/ace/mode/scheme.js b/lib/ace/mode/scheme.js
index 2360b3da..aa462a10 100644
--- a/lib/ace/mode/scheme.js
+++ b/lib/ace/mode/scheme.js
@@ -39,92 +39,15 @@ define(function(require, exports, module) {
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
-var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
var Mode = function() {
this.HighlightRules = SchemeHighlightRules;
- this.$outdent = new MatchingParensOutdent();
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = ";";
- this.minorIndentFunctions = ["define", "lambda", "define-macro", "define-syntax", "syntax-rules", "define-record-type", "define-structure"];
-
- this.$toIndent = function(str) {
- return str.split('').map(function(ch) {
- if (/\s/.exec(ch)) {
- return ch;
- } else {
- return ' ';
- }
- }).join('');
- };
-
- this.$calculateIndent = function(line, tab) {
- var baseIndent = this.$getIndent(line);
- var delta = 0;
- var isParen, ch;
- // Walk back from end of line, find matching braces
- for (var i = line.length - 1; i >= 0; i--) {
- ch = line[i];
- if (ch === '(') {
- delta--;
- isParen = true;
- } else if (ch === '(' || ch === '[' || ch === '{') {
- delta--;
- isParen = false;
- } else if (ch === ')' || ch === ']' || ch === '}') {
- delta++;
- }
- if (delta < 0) {
- break;
- }
- }
- if (delta < 0 && isParen) {
- // Were more brackets opened than closed and was a ( left open?
- i += 1;
- var iBefore = i;
- var fn = '';
- while (true) {
- ch = line[i];
- if (ch === ' ' || ch === '\t') {
- if(this.minorIndentFunctions.indexOf(fn) !== -1) {
- return this.$toIndent(line.substring(0, iBefore - 1) + tab);
- } else {
- return this.$toIndent(line.substring(0, i + 1));
- }
- } else if (ch === undefined) {
- return this.$toIndent(line.substring(0, iBefore - 1) + tab);
- }
- fn += line[i];
- i++;
- }
- } else if(delta < 0 && !isParen) {
- // Were more brackets openend than closed and was it not a (?
- return this.$toIndent(line.substring(0, i+1));
- } else if(delta > 0) {
- // Mere more brackets closed than opened? Outdent.
- baseIndent = baseIndent.substring(0, baseIndent.length - tab.length);
- return baseIndent;
- } else {
- // Were they nicely matched? Just indent like line before.
- return baseIndent;
- }
- };
-
- this.getNextLineIndent = function(state, line, tab) {
- return this.$calculateIndent(line, tab);
- };
-
- this.checkOutdent = function(state, line, input) {
- return this.$outdent.checkOutdent(line, input);
- };
-
- this.autoOutdent = function(state, doc, row) {
- this.$outdent.autoOutdent(doc, row);
- };
this.$id = "ace/mode/scheme";
}).call(Mode.prototype);
diff --git a/lib/ace/mode/toml_highlight_rules.js b/lib/ace/mode/toml_highlight_rules.js
index 1a7871ab..686ffae2 100644
--- a/lib/ace/mode/toml_highlight_rules.js
+++ b/lib/ace/mode/toml_highlight_rules.js
@@ -57,10 +57,6 @@ var TomlHighlightRules = function() {
regex : '"(?=.)',
next : "qqstring"
},
- {
- token: ["variable.keygroup.toml"],
- regex: "(?:^\\s*)(\\[\\[([^\\]]+)\\]\\])"
- },
{
token: ["variable.keygroup.toml"],
regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
@@ -104,4 +100,4 @@ var TomlHighlightRules = function() {
oop.inherits(TomlHighlightRules, TextHighlightRules);
exports.TomlHighlightRules = TomlHighlightRules;
-});
+});
\ No newline at end of file
diff --git a/lib/ace/mouse/multi_select_handler.js b/lib/ace/mouse/multi_select_handler.js
index 649043fa..45704b39 100644
--- a/lib/ace/mouse/multi_select_handler.js
+++ b/lib/ace/mouse/multi_select_handler.js
@@ -83,7 +83,7 @@ function onMouseDown(e) {
var selectionMode;
if (editor.$mouseHandler.$enableJumpToDef) {
if (ctrl && alt || accel && alt)
- selectionMode = shift ? "block" : "add";
+ selectionMode = "add";
else if (alt && editor.$blockSelectEnabled)
selectionMode = "block";
} else {
@@ -117,7 +117,7 @@ function onMouseDown(e) {
if (shift) {
oldRange = null;
- range = selection.ranges[0] || range;
+ range = selection.ranges[0];
editor.removeSelectionMarker(range);
}
editor.once("mouseup", function() {
diff --git a/lib/ace/multi_select.js b/lib/ace/multi_select.js
index 1d0b69e7..85611a33 100644
--- a/lib/ace/multi_select.js
+++ b/lib/ace/multi_select.js
@@ -754,9 +754,9 @@ var Editor = require("./editor").Editor;
if (fr < 0) fr = 0;
if (lr >= max) lr = max - 1;
}
- var lines = this.session.removeFullLines(fr, lr);
+ var lines = this.session.doc.removeLines(fr, lr);
lines = this.$reAlignText(lines, guessRange);
- this.session.insert({row: fr, column: 0}, lines.join("\n") + "\n");
+ this.session.doc.insert({row: fr, column: 0}, lines.join("\n") + "\n");
if (!guessRange) {
range.start.column = 0;
range.end.column = lines[lines.length - 1].length;
diff --git a/lib/ace/multi_select_test.js b/lib/ace/multi_select_test.js
index 7fd504fb..f63038d6 100644
--- a/lib/ace/multi_select_test.js
+++ b/lib/ace/multi_select_test.js
@@ -30,7 +30,6 @@
if (typeof process !== "undefined") {
require("amd-loader");
- require("./test/mockdom");
}
define(function(require, exports, module) {
@@ -42,7 +41,6 @@ var Range = require("./range").Range;
var Editor = require("./editor").Editor;
var EditSession = require("./edit_session").EditSession;
var MockRenderer = require("./test/mockrenderer").MockRenderer;
-var UndoManager = require("./undomanager").UndoManager;
var editor;
var exec = function(name, times, args) {
@@ -261,20 +259,6 @@ module.exports = {
selection.fromJSON(after);
assert.ok(!selection.isEqual(before));
assert.ok(selection.isEqual(after));
- },
-
- "test multiselect align": function() {
- var doc = new EditSession(["l1", "l2", "l3"]);
- doc.setUndoManager(new UndoManager());
- editor = new Editor(new MockRenderer(), doc);
- var selection = editor.selection;
- selection.addRange(new Range(1,0,1,0))
- selection.addRange(new Range(2,2,2,2))
- editor.execCommand("alignCursors");
- assert.equal(' l1\n l2\nl3', editor.getValue());
- doc.markUndoGroup();
- editor.execCommand("undo");
- assert.equal('l1\nl2\nl3', editor.getValue());
}
};
diff --git a/lib/ace/placeholder.js b/lib/ace/placeholder.js
index 0e299594..582e2c2b 100644
--- a/lib/ace/placeholder.js
+++ b/lib/ace/placeholder.js
@@ -150,27 +150,28 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
* Emitted when the place holder updates.
*
**/
- this.onUpdate = function(delta) {
- var range = delta;
+ this.onUpdate = function(event) {
+ var delta = event.data;
+ var range = delta.range;
if(range.start.row !== range.end.row) return;
if(range.start.row !== this.pos.row) return;
if (this.$updating) return;
this.$updating = true;
- var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column;
+ var lengthDiff = delta.action === "insertText" ? range.end.column - range.start.column : range.start.column - range.end.column;
if(range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) {
var distanceFromStart = range.start.column - this.pos.column;
this.length += lengthDiff;
if(!this.session.$fromUndo) {
- if(delta.action === 'insert') {
+ if(delta.action === "insertText") {
for (var i = this.others.length - 1; i >= 0; i--) {
var otherPos = this.others[i];
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
if(otherPos.row === range.start.row && range.start.column < otherPos.column)
newPos.column += lengthDiff;
- this.doc.insertMergedLines(newPos, delta.lines);
+ this.doc.insert(newPos, delta.text);
}
- } else if(delta.action === 'remove') {
+ } else if(delta.action === "removeText") {
for (var i = this.others.length - 1; i >= 0; i--) {
var otherPos = this.others[i];
var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
@@ -180,7 +181,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
}
}
// Special case: insert in beginning
- if(range.start.column === this.pos.column && delta.action === 'insert') {
+ if(range.start.column === this.pos.column && delta.action === "insertText") {
setTimeout(function() {
this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff);
for (var i = 0; i < this.others.length; i++) {
@@ -192,7 +193,7 @@ var PlaceHolder = function(session, length, pos, others, mainClass, othersClass)
}
}.bind(this), 0);
}
- else if(range.start.column === this.pos.column && delta.action === 'remove') {
+ else if(range.start.column === this.pos.column && delta.action === "removeText") {
setTimeout(function() {
for (var i = 0; i < this.others.length; i++) {
var other = this.others[i];
diff --git a/lib/ace/range_list.js b/lib/ace/range_list.js
index 326bc41b..0cbcc394 100644
--- a/lib/ace/range_list.js
+++ b/lib/ace/range_list.js
@@ -180,13 +180,14 @@ var RangeList = function() {
this.session = null;
};
- this.$onChange = function(delta) {
- if (delta.action == "insert"){
- var start = delta.start;
- var end = delta.end;
+ this.$onChange = function(e) {
+ var changeRange = e.data.range;
+ if (e.data.action[0] == "i"){
+ var start = changeRange.start;
+ var end = changeRange.end;
} else {
- var end = delta.start;
- var start = delta.end;
+ var end = changeRange.start;
+ var start = changeRange.end;
}
var startRow = start.row;
var endRow = end.row;
diff --git a/lib/ace/snippets.js b/lib/ace/snippets.js
index 699cd6e9..10c34bf0 100644
--- a/lib/ace/snippets.js
+++ b/lib/ace/snippets.js
@@ -667,11 +667,11 @@ var TabstopManager = function(editor) {
this.editor = null;
};
- this.onChange = function(delta) {
- var changeRange = delta;
- var isRemove = delta.action[0] == "r";
- var start = delta.start;
- var end = delta.end;
+ this.onChange = function(e) {
+ var changeRange = e.data.range;
+ var isRemove = e.data.action[0] == "r";
+ var start = changeRange.start;
+ var end = changeRange.end;
var startRow = start.row;
var endRow = end.row;
var lineDif = endRow - startRow;
diff --git a/lib/ace/snippets/mask.js b/lib/ace/snippets/mask.js
deleted file mode 100644
index 7fbca678..00000000
--- a/lib/ace/snippets/mask.js
+++ /dev/null
@@ -1,7 +0,0 @@
-define(function(require, exports, module) {
-"use strict";
-
-exports.snippetText = require("../requirejs/text!./mask.snippets");
-exports.scope = "mask";
-
-});
diff --git a/lib/ace/snippets/mask.snippets b/lib/ace/snippets/mask.snippets
deleted file mode 100644
index e69de29b..00000000
diff --git a/lib/ace/snippets/nim.js b/lib/ace/snippets/nim.js
deleted file mode 100644
index 6e6d02bb..00000000
--- a/lib/ace/snippets/nim.js
+++ /dev/null
@@ -1,7 +0,0 @@
-define(function(require, exports, module) {
-"use strict";
-
-exports.snippetText = require("../requirejs/text!./nim.snippets");
-exports.scope = "nim";
-
-});
diff --git a/lib/ace/snippets/nim.snippets b/lib/ace/snippets/nim.snippets
deleted file mode 100644
index a8a20a00..00000000
--- a/lib/ace/snippets/nim.snippets
+++ /dev/null
@@ -1,130 +0,0 @@
-snippet #!
- #!/usr/bin/env nim
-snippet imp
- import ${1:module}
-snippet from
- from ${1:package} import ${2:module}
-# Module Docstring
-snippet docs
- ## File: ${1:FILENAME:file_name}
- ## Author: ${2:author}
- ## Description: ${3}
-snippet wh
- while ${1:condition}:
- ${2:# TODO: write code...}
-# dowh - does the same as do...while in other languages
-snippet dowh
- while true:
- ${1:# TODO: write code...}
- if ${2:condition}:
- break
-snippet with
- with ${1:expr} as ${2:var}:
- ${3:# TODO: write code...}
-# New Function
-snippet proc
- proc ${1:fname}(${2:`indent('.') ? 'self' : ''`}): ${3: return type} =
- ##${4:docstring for $1}
- ${5:# TODO: write code...}
-snippet deff
- def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
- ${3:# TODO: write code...}
-# New Method
-snippet defs
- def ${1:mname}(self, ${2:arg}):
- ${3:# TODO: write code...}
-# New Property
-snippet property
- def ${1:foo}():
- doc = "${2:The $1 property.}"
- def fget(self):
- ${3:return self._$1}
- def fset(self, value):
- ${4:self._$1 = value}
-# Ifs
-snippet if
- if ${1:condition}:
- ${2:# TODO: write code...}
-snippet el
- else:
- ${1:# TODO: write code...}
-snippet ei
- elif ${1:condition}:
- ${2:# TODO: write code...}
-# For
-snippet for
- for ${1:item} in ${2:items}:
- ${3:# TODO: write code...}
-# Encodes
-snippet cutf8
- # -*- coding: utf-8 -*-
-snippet clatin1
- # -*- coding: latin-1 -*-
-snippet cascii
- # -*- coding: ascii -*-
-# Lambda
-snippet ld
- ${1:var} = lambda ${2:vars} : ${3:action}
-snippet .
- self.
-snippet try Try/Except
- try:
- ${1:# TODO: write code...}
- except ${2:Exception}, ${3:e}:
- ${4:raise $3}
-snippet try Try/Except/Else
- try:
- ${1:# TODO: write code...}
- except ${2:Exception}, ${3:e}:
- ${4:raise $3}
- else:
- ${5:# TODO: write code...}
-snippet try Try/Except/Finally
- try:
- ${1:# TODO: write code...}
- except ${2:Exception}, ${3:e}:
- ${4:raise $3}
- finally:
- ${5:# TODO: write code...}
-snippet try Try/Except/Else/Finally
- try:
- ${1:# TODO: write code...}
- except ${2:Exception}, ${3:e}:
- ${4:raise $3}
- else:
- ${5:# TODO: write code...}
- finally:
- ${6:# TODO: write code...}
-# if __name__ == '__main__':
-snippet ifmain
- if isMainModule:
- ${1:main()}
-snippet "
- ## ${1:doc}
-# test function/method
-snippet test
- def test_${1:description}(${2:self}):
- ${3:# TODO: write code...}
-# test case
-snippet testcase
- class ${1:ExampleCase}(unittest.TestCase):
-
- def test_${2:description}(self):
- ${3:# TODO: write code...}
-#getopt
-snippet getopt
- try:
- # Short option syntax: "hv:"
- # Long option syntax: "help" or "verbose="
- opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}])
-
- except getopt.GetoptError, err:
- # Print debug info
- print str(err)
- ${3:error_action}
-
- for option, argument in opts:
- if option in ("-h", "--help"):
- ${4}
- elif option in ("-v", "--verbose"):
- verbose = argument
diff --git a/lib/ace/theme/clouds.css b/lib/ace/theme/clouds.css
index c11308d4..e3884e02 100644
--- a/lib/ace/theme/clouds.css
+++ b/lib/ace/theme/clouds.css
@@ -23,6 +23,7 @@
.ace-clouds.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF;
+ border-radius: 2px
}
.ace-clouds .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/clouds_midnight.css b/lib/ace/theme/clouds_midnight.css
index 08ee089d..3b932996 100644
--- a/lib/ace/theme/clouds_midnight.css
+++ b/lib/ace/theme/clouds_midnight.css
@@ -23,6 +23,7 @@
.ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #191919;
+ border-radius: 2px
}
.ace-clouds-midnight .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/cobalt.css b/lib/ace/theme/cobalt.css
index b883ba97..73140082 100644
--- a/lib/ace/theme/cobalt.css
+++ b/lib/ace/theme/cobalt.css
@@ -23,6 +23,7 @@
.ace-cobalt.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #002240;
+ border-radius: 2px
}
.ace-cobalt .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/dawn.css b/lib/ace/theme/dawn.css
index 3c2884e1..719f4877 100644
--- a/lib/ace/theme/dawn.css
+++ b/lib/ace/theme/dawn.css
@@ -23,6 +23,7 @@
.ace-dawn.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #F9F9F9;
+ border-radius: 2px
}
.ace-dawn .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/idle_fingers.css b/lib/ace/theme/idle_fingers.css
index b5e1bff2..f507ec10 100644
--- a/lib/ace/theme/idle_fingers.css
+++ b/lib/ace/theme/idle_fingers.css
@@ -23,6 +23,7 @@
.ace-idle-fingers.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #323232;
+ border-radius: 2px
}
.ace-idle-fingers .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/katzenmilch.css b/lib/ace/theme/katzenmilch.css
index bf1569fb..0b5a7a23 100644
--- a/lib/ace/theme/katzenmilch.css
+++ b/lib/ace/theme/katzenmilch.css
@@ -31,6 +31,7 @@
.ace-katzenmilch.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #f3f2f3;
+ border-radius: 2px
}
.ace-katzenmilch .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/kr_theme.css b/lib/ace/theme/kr_theme.css
index e232de47..339786ad 100644
--- a/lib/ace/theme/kr_theme.css
+++ b/lib/ace/theme/kr_theme.css
@@ -23,6 +23,7 @@
.ace-kr-theme.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #0B0A09;
+ border-radius: 2px
}
.ace-kr-theme .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/merbivore.css b/lib/ace/theme/merbivore.css
index 9be25c66..a84ec3a6 100644
--- a/lib/ace/theme/merbivore.css
+++ b/lib/ace/theme/merbivore.css
@@ -23,6 +23,7 @@
.ace-merbivore.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #161616;
+ border-radius: 2px
}
.ace-merbivore .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/merbivore_soft.css b/lib/ace/theme/merbivore_soft.css
index 0d615376..f0ad0bac 100644
--- a/lib/ace/theme/merbivore_soft.css
+++ b/lib/ace/theme/merbivore_soft.css
@@ -23,6 +23,7 @@
.ace-merbivore-soft.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #1C1C1C;
+ border-radius: 2px
}
.ace-merbivore-soft .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/mono_industrial.css b/lib/ace/theme/mono_industrial.css
index 6630e4a2..7e40a3b9 100644
--- a/lib/ace/theme/mono_industrial.css
+++ b/lib/ace/theme/mono_industrial.css
@@ -23,6 +23,7 @@
.ace-mono-industrial.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #222C28;
+ border-radius: 2px
}
.ace-mono-industrial .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/monokai.css b/lib/ace/theme/monokai.css
index bcc26ef4..a3a063df 100644
--- a/lib/ace/theme/monokai.css
+++ b/lib/ace/theme/monokai.css
@@ -23,6 +23,7 @@
.ace-monokai.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #272822;
+ border-radius: 2px
}
.ace-monokai .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/pastel_on_dark.css b/lib/ace/theme/pastel_on_dark.css
index 0b637174..8cab16a1 100644
--- a/lib/ace/theme/pastel_on_dark.css
+++ b/lib/ace/theme/pastel_on_dark.css
@@ -23,6 +23,7 @@
.ace-pastel-on-dark.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #2C2828;
+ border-radius: 2px
}
.ace-pastel-on-dark .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/solarized_dark.css b/lib/ace/theme/solarized_dark.css
index 09740e69..ea8ec8aa 100644
--- a/lib/ace/theme/solarized_dark.css
+++ b/lib/ace/theme/solarized_dark.css
@@ -30,6 +30,7 @@
.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #002B36;
+ border-radius: 2px
}
.ace-solarized-dark .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/solarized_light.css b/lib/ace/theme/solarized_light.css
index 65399fda..64c4bac9 100644
--- a/lib/ace/theme/solarized_light.css
+++ b/lib/ace/theme/solarized_light.css
@@ -23,6 +23,7 @@
.ace-solarized-light.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FDF6E3;
+ border-radius: 2px
}
.ace-solarized-light .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/terminal.css b/lib/ace/theme/terminal.css
index f23a9ad6..3636a03d 100644
--- a/lib/ace/theme/terminal.css
+++ b/lib/ace/theme/terminal.css
@@ -23,6 +23,7 @@
.ace-terminal-theme.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px black;
+ border-radius: 2px
}
.ace-terminal-theme .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/textmate.css b/lib/ace/theme/textmate.css
index 18e2b4ee..6cb159ba 100644
--- a/lib/ace/theme/textmate.css
+++ b/lib/ace/theme/textmate.css
@@ -122,6 +122,7 @@
}
.ace-tm.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px white;
+ border-radius: 2px;
}
.ace-tm .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
diff --git a/lib/ace/theme/the_night_after_tomorrow.css b/lib/ace/theme/the_night_after_tomorrow.css
deleted file mode 100644
index 48d2602c..00000000
--- a/lib/ace/theme/the_night_after_tomorrow.css
+++ /dev/null
@@ -1,139 +0,0 @@
-.ace-tomorrow-night .ace_gutter {
- background: #25282c;
- color: #C5C8C6
-}
-
-.ace-tomorrow-night .ace_print-margin {
- width: 1px;
- background: #25282c
-}
-
-.ace-tomorrow-night {
- background-color: #1D1F21;
- color: #C5C8C6
-}
-
-.ace-tomorrow-night .ace_cursor {
- color: #FFFFFF
-}
-
-.ace-tomorrow-night .ace_marker-layer .ace_selection {
- background: #373B41
-}
-
-.ace-tomorrow-night.ace_multiselect .ace_selection.ace_start {
- box-shadow: 0 0 3px 0px #1D1F21;
- border-radius: 2px
-}
-
-.ace-tomorrow-night .ace_marker-layer .ace_step {
- background: rgb(102, 82, 0)
-}
-
-.ace-tomorrow-night .ace_marker-layer .ace_bracket {
- margin: -1px 0 0 -1px;
- border: 1px solid #4B4E55
-}
-
-.ace-tomorrow-night .ace_marker-layer .ace_active-line {
- background: #282A2E
-}
-
-.ace-tomorrow-night .ace_gutter-active-line {
- background-color: #282A2E
-}
-
-.ace-tomorrow-night .ace_marker-layer .ace_selected-word {
- border: 1px solid #373B41
-}
-
-.ace-tomorrow-night .ace_invisible {
- color: #4B4E55
-}
-
-.ace-tomorrow-night .ace_keyword,
-.ace-tomorrow-night .ace_meta,
-.ace-tomorrow-night .ace_support.ace_type {
- color: #C4A400
-}
-
-.ace-tomorrow-night .ace_storage,
-.ace-tomorrow-night .ace_storage.ace_type {
- color: #327FD7
-}
-
-.ace-tomorrow-night .ace_keyword.ace_operator {
- color: #8ABEB7
-}
-
-.ace-tomorrow-night .ace_constant.ace_language{
- color: #934B9F
-}
-
-.ace-tomorrow-night .ace_constant.ace_character,
-.ace-tomorrow-night .ace_constant.ace_numeric,
-.ace-tomorrow-night .ace_keyword.ace_other.ace_unit,
-.ace-tomorrow-night .ace_support.ace_constant,
-.ace-tomorrow-night .ace_variable.ace_parameter {
- color: #37BC9B
-}
-
-.ace-tomorrow-night .ace_constant.ace_other {
- color: #CED1CF
-}
-
-.ace-tomorrow-night .ace_invalid {
- color: #CED2CF;
- background-color: #DF5F5F
-}
-
-.ace-tomorrow-night .ace_invalid.ace_deprecated {
- color: #CED2CF;
- background-color: #B798BF
-}
-
-.ace-tomorrow-night .ace_fold {
- background-color: #62A5D6;
- border-color: #C5C8C6
-}
-
-.ace-tomorrow-night .ace_entity.ace_name.ace_function,
-.ace-tomorrow-night .ace_support.ace_function,
-.ace-tomorrow-night .ace_variable {
- color: #62A5D6
-}
-
-.ace-tomorrow-night .ace_support.ace_class,
-.ace-tomorrow-night .ace_support.ace_type {
- color: #F0C674
-}
-
-.ace-tomorrow-night .ace_heading,
-.ace-tomorrow-night .ace_markup.ace_heading,
-.ace-tomorrow-night .ace_string {
- color: #CD0000
-}
-
-.ace-tomorrow-night .ace_proc_name {
- color: #04939A
-}
-
-.ace-tomorrow-night .ace_backtick {
- color: #1DAA49
-}
-
-.ace-tomorrow-night .ace_entity.ace_name.ace_tag,
-.ace-tomorrow-night .ace_entity.ace_other.ace_attribute-name,
-.ace-tomorrow-night .ace_meta.ace_tag,
-.ace-tomorrow-night .ace_string.ace_regexp,
-.ace-tomorrow-night .ace_variable {
- color: #FFFFFF
-}
-
-.ace-tomorrow-night .ace_comment {
- color: #3465A4
-}
-
-.ace-tomorrow-night .ace_indent-guide {
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y
-}
diff --git a/lib/ace/theme/the_night_after_tomorrow.js b/lib/ace/theme/the_night_after_tomorrow.js
deleted file mode 100644
index 3108e2a9..00000000
--- a/lib/ace/theme/the_night_after_tomorrow.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Distributed under the BSD license:
- *
- * Copyright (c) 2010, Ajax.org B.V.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of Ajax.org B.V. nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ***** END LICENSE BLOCK ***** */
-
-define(function(require, exports, module) {
-
-exports.isDark = true;
-exports.cssClass = "ace-tomorrow-night";
-exports.cssText = require("../requirejs/text!./the_night_after_tomorrow.css");
-
-var dom = require("../lib/dom");
-dom.importCssString(exports.cssText, exports.cssClass);
-});
diff --git a/lib/ace/theme/tomorrow.css b/lib/ace/theme/tomorrow.css
index 77407e66..20975004 100644
--- a/lib/ace/theme/tomorrow.css
+++ b/lib/ace/theme/tomorrow.css
@@ -23,6 +23,7 @@
.ace-tomorrow.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF;
+ border-radius: 2px
}
.ace-tomorrow .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/tomorrow_night.css b/lib/ace/theme/tomorrow_night.css
index e98a6580..aafceab6 100644
--- a/lib/ace/theme/tomorrow_night.css
+++ b/lib/ace/theme/tomorrow_night.css
@@ -23,6 +23,7 @@
.ace-tomorrow-night.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #1D1F21;
+ border-radius: 2px
}
.ace-tomorrow-night .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/tomorrow_night_blue.css b/lib/ace/theme/tomorrow_night_blue.css
index 907eef35..e717be0a 100644
--- a/lib/ace/theme/tomorrow_night_blue.css
+++ b/lib/ace/theme/tomorrow_night_blue.css
@@ -24,6 +24,7 @@
.ace-tomorrow-night-blue.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #002451;
+ border-radius: 2px
}
.ace-tomorrow-night-blue .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/tomorrow_night_bright.css b/lib/ace/theme/tomorrow_night_bright.css
index c0c33739..5c896fb9 100644
--- a/lib/ace/theme/tomorrow_night_bright.css
+++ b/lib/ace/theme/tomorrow_night_bright.css
@@ -23,6 +23,7 @@
.ace-tomorrow-night-bright.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #000000;
+ border-radius: 2px
}
.ace-tomorrow-night-bright .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/tomorrow_night_eighties.css b/lib/ace/theme/tomorrow_night_eighties.css
index 69277fb1..85d7b089 100644
--- a/lib/ace/theme/tomorrow_night_eighties.css
+++ b/lib/ace/theme/tomorrow_night_eighties.css
@@ -24,6 +24,7 @@
.ace-tomorrow-night-eighties.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #2D2D2D;
+ border-radius: 2px
}
.ace-tomorrow-night-eighties .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/twilight.css b/lib/ace/theme/twilight.css
index ae353dae..0ca694fb 100644
--- a/lib/ace/theme/twilight.css
+++ b/lib/ace/theme/twilight.css
@@ -23,6 +23,7 @@
.ace-twilight.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #141414;
+ border-radius: 2px
}
.ace-twilight .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/vibrant_ink.css b/lib/ace/theme/vibrant_ink.css
index a3a89402..e2901156 100644
--- a/lib/ace/theme/vibrant_ink.css
+++ b/lib/ace/theme/vibrant_ink.css
@@ -23,6 +23,7 @@
.ace-vibrant-ink.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #0F0F0F;
+ border-radius: 2px
}
.ace-vibrant-ink .ace_marker-layer .ace_step {
diff --git a/lib/ace/theme/xcode.css b/lib/ace/theme/xcode.css
index a22bd169..56eb9a89 100644
--- a/lib/ace/theme/xcode.css
+++ b/lib/ace/theme/xcode.css
@@ -25,6 +25,7 @@
.ace-xcode.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #FFFFFF;
+ border-radius: 2px
}
.ace-xcode .ace_marker-layer .ace_step {
diff --git a/lib/ace/undomanager.js b/lib/ace/undomanager.js
index 6da50a8b..4411ae8b 100644
--- a/lib/ace/undomanager.js
+++ b/lib/ace/undomanager.js
@@ -61,19 +61,15 @@ var UndoManager = function() {
*
**/
this.execute = function(options) {
- // Normalize deltas for storage.
- // var deltaSets = this.$serializeDeltas(options.args[0]);
- var deltaSets = options.args[0];
- // Add deltas to undo stack.
+ var deltas = options.args[0];
this.$doc = options.args[1];
if (options.merge && this.hasUndo()){
this.dirtyCounter--;
- deltaSets = this.$undoStack.pop().concat(deltaSets);
+ deltas = this.$undoStack.pop().concat(deltas);
}
- this.$undoStack.push(deltaSets);
-
- // Reset redo stack.
+ this.$undoStack.push(deltas);
this.$redoStack = [];
+
if (this.dirtyCounter < 0) {
// The user has made a change after undoing past the last clean state.
// We can never get back to a clean state now until markClean() is called.
@@ -90,11 +86,12 @@ var UndoManager = function() {
* @returns {Range} The range of the undo.
**/
this.undo = function(dontSelect) {
- var deltaSets = this.$undoStack.pop();
+ var deltas = this.$undoStack.pop();
var undoSelectionRange = null;
- if (deltaSets) {
- undoSelectionRange = this.$doc.undoChanges(this.$deserializeDeltas(deltaSets), dontSelect);
- this.$redoStack.push(deltaSets);
+ if (deltas) {
+ undoSelectionRange =
+ this.$doc.undoChanges(deltas, dontSelect);
+ this.$redoStack.push(deltas);
this.dirtyCounter--;
}
@@ -108,14 +105,15 @@ var UndoManager = function() {
*
**/
this.redo = function(dontSelect) {
- var deltaSets = this.$redoStack.pop();
+ var deltas = this.$redoStack.pop();
var redoSelectionRange = null;
- if (deltaSets) {
+ if (deltas) {
redoSelectionRange =
- this.$doc.redoChanges(this.$deserializeDeltas(deltaSets), dontSelect);
- this.$undoStack.push(deltaSets);
+ this.$doc.redoChanges(deltas, dontSelect);
+ this.$undoStack.push(deltas);
this.dirtyCounter++;
}
+
return redoSelectionRange;
};
@@ -163,52 +161,7 @@ var UndoManager = function() {
this.isClean = function() {
return this.dirtyCounter === 0;
};
-
- // Serializes deltaSets to reduce memory usage.
- this.$serializeDeltas = function(deltaSets) {
- return cloneDeltaSetsObj(deltaSets, $serializeDelta);
- };
-
- // Deserializes deltaSets to allow application to the document.
- this.$deserializeDeltas = function(deltaSets) {
- return cloneDeltaSetsObj(deltaSets, $deserializeDelta);
- };
-
- function $serializeDelta(delta){
- return {
- action: delta.action,
- start: delta.start,
- end: delta.end,
- lines: delta.lines.length == 1 ? null : delta.lines,
- text: delta.lines.length == 1 ? delta.lines[0] : null,
- };
- }
-
- function $deserializeDelta(delta) {
- return {
- action: delta.action,
- start: delta.start,
- end: delta.end,
- lines: delta.lines || [delta.text]
- };
- }
-
- function cloneDeltaSetsObj(deltaSets_old, fnGetModifiedDelta) {
- var deltaSets_new = new Array(deltaSets_old.length);
- for (var i = 0; i < deltaSets_old.length; i++) {
- var deltaSet_old = deltaSets_old[i];
- var deltaSet_new = { group: deltaSet_old.group, deltas: new Array(deltaSet_old.length)};
-
- for (var j = 0; j < deltaSet_old.deltas.length; j++) {
- var delta_old = deltaSet_old.deltas[j];
- deltaSet_new.deltas[j] = fnGetModifiedDelta(delta_old);
- }
-
- deltaSets_new[i] = deltaSet_new;
- }
- return deltaSets_new;
- }
-
+
}).call(UndoManager.prototype);
exports.UndoManager = UndoManager;
diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js
index 45226a1d..5696745c 100644
--- a/lib/ace/virtual_renderer.js
+++ b/lib/ace/virtual_renderer.js
@@ -615,7 +615,7 @@ var VirtualRenderer = function(container, theme) {
* @returns {DOMElement}
**/
this.getMouseEventTarget = function() {
- return this.scroller;
+ return this.content;
};
/**
@@ -919,8 +919,6 @@ var VirtualRenderer = function(container, theme) {
(this.$minLines||1) * this.lineHeight,
Math.min(maxHeight, height)
) + this.scrollMargin.v + (this.$extraHeight || 0);
- if (this.$horizScroll)
- desiredHeight += this.scrollBarH.getHeight();
var vScroll = height > maxHeight;
if (desiredHeight != this.desiredHeight ||
@@ -941,6 +939,9 @@ var VirtualRenderer = function(container, theme) {
};
this.$computeLayerConfig = function() {
+ if (this.$maxLines && this.lineHeight > 1)
+ this.$autosize();
+
var session = this.session;
var size = this.$size;
@@ -948,6 +949,9 @@ var VirtualRenderer = function(container, theme) {
var screenLines = this.session.getScreenLength();
var maxHeight = screenLines * this.lineHeight;
+ var offset = this.scrollTop % this.lineHeight;
+ var minHeight = size.scrollerHeight + this.lineHeight;
+
var longestLine = this.$getLongestLine();
var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible ||
@@ -958,27 +962,20 @@ var VirtualRenderer = function(container, theme) {
this.$horizScroll = horizScroll;
this.scrollBarH.setVisible(horizScroll);
}
- // autoresize only after updating hscroll to include scrollbar height in desired height
- if (this.$maxLines && this.lineHeight > 1)
- this.$autosize();
-
- var offset = this.scrollTop % this.lineHeight;
- var minHeight = size.scrollerHeight + this.lineHeight;
var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd
? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
: 0;
maxHeight += scrollPastEnd;
- var sm = this.scrollMargin;
- this.session.setScrollTop(Math.max(-sm.top,
- Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom)));
+ this.session.setScrollTop(Math.max(-this.scrollMargin.top,
+ Math.min(this.scrollTop, maxHeight - size.scrollerHeight + this.scrollMargin.bottom)));
- this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft,
- longestLine + 2 * this.$padding - size.scrollerWidth + sm.right)));
+ this.session.setScrollLeft(Math.max(-this.scrollMargin.left, Math.min(this.scrollLeft,
+ longestLine + 2 * this.$padding - size.scrollerWidth + this.scrollMargin.right)));
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
- size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top);
+ size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop);
var vScrollChanged = this.$vScroll !== vScroll;
if (vScrollChanged) {
this.$vScroll = vScroll;
diff --git a/lib/ace/virtual_renderer_test.js b/lib/ace/virtual_renderer_test.js
index 9b1ed866..e8a8fcbd 100644
--- a/lib/ace/virtual_renderer_test.js
+++ b/lib/ace/virtual_renderer_test.js
@@ -36,40 +36,26 @@ if (typeof process !== "undefined") {
define(function(require, exports, module) {
"use strict";
-var Editor = require("./edit_session").Editor;
var EditSession = require("./edit_session").EditSession;
var VirtualRenderer = require("./virtual_renderer").VirtualRenderer;
var assert = require("./test/assertions");
-var editor = null;
module.exports = {
- setUp: function() {
- if (editor)
- editor.destroy()
+ "test: screen2text the column should be rounded to the next character edge" : function() {
var el = document.createElement("div");
+
if (!el.getBoundingClientRect) {
console.log("Skipping test: This test only runs in the browser");
return;
}
+
el.style.left = "20px";
el.style.top = "30px";
el.style.width = "300px";
el.style.height = "100px";
document.body.appendChild(el);
- var renderer = new VirtualRenderer(el);
- var editor = new Editor(renderer);
- editor.on("destroy", function() {
- document.body.removeChild(el);
- });
- },
- tearDown: function() {
- editor && editor.destroy();
- editor = null;
- },
- "test: screen2text the column should be rounded to the next character edge" : function(done) {
- if (!editor) return done();
- var renderer = editor.renderer;
+ var renderer = new VirtualRenderer(el);
renderer.setPadding(0);
renderer.setSession(new EditSession("1234"));
@@ -87,23 +73,7 @@ module.exports = {
testPixelToText(10, 0, 0, 1);
testPixelToText(14, 0, 0, 1);
testPixelToText(15, 0, 0, 2);
- done();
- },
-
- "test scrollmargin + autosize": function(done) {
- if (!editor) return done();
- editor.setOptions({
- maxLines: 100,
- useWrapMode: true
- });
- editor.renderer.setScrollMargin(10, 10);
- editor.setValue("\n\n");
- editor.setValue("\n\n\n\n");
- editor.renderer.once("afterRender", function() {
- setTimeout(function() {
- done();
- }, 0);
- });
+ document.body.removeChild(el);
}
// change tab size after setDocument (for text layer)
diff --git a/lib/ace/worker/mirror.js b/lib/ace/worker/mirror.js
index ef6e2aa3..7a3318fb 100644
--- a/lib/ace/worker/mirror.js
+++ b/lib/ace/worker/mirror.js
@@ -1,7 +1,6 @@
define(function(require, exports, module) {
"use strict";
-var Range = require("../range").Range;
var Document = require("../document").Document;
var lang = require("../lib/lang");
@@ -13,19 +12,7 @@ var Mirror = exports.Mirror = function(sender) {
var _self = this;
sender.on("change", function(e) {
- var data = e.data;
- if (data[0].start) {
- doc.applyDeltas(data);
- } else {
- for (var i = 0; i < data.length; i += 2) {
- if (Array.isArray(data[i+1])) {
- var d = {action: "insert", start: data[i], lines: data[i+1]};
- } else {
- var d = {action: "remove", start: data[i], end: data[i+1]};
- }
- doc.applyDelta(d, true);
- }
- }
+ doc.applyDeltas(e.data);
if (_self.$timeout)
return deferredUpdate.schedule(_self.$timeout);
_self.onUpdate();
diff --git a/lib/ace/worker/worker.js b/lib/ace/worker/worker.js
index 28fc0fe2..928000dd 100644
--- a/lib/ace/worker/worker.js
+++ b/lib/ace/worker/worker.js
@@ -1,9 +1,8 @@
"no use strict";
;(function(window) {
-if (typeof window.window != "undefined" && window.document)
- return;
-if (window.require && window.define)
+if (typeof window.window != "undefined" && window.document) {
return;
+}
window.console = function() {
var msgs = Array.prototype.slice.call(arguments, 0);
@@ -20,7 +19,6 @@ window.ace = window;
window.onerror = function(message, file, line, col, err) {
postMessage({type: "error", data: {
message: message,
- data: err.data,
file: file,
line: line,
col: col,
@@ -39,7 +37,7 @@ window.normalizeModule = function(parentId, moduleName) {
var base = parentId.split("/").slice(0, -1).join("/");
moduleName = (base ? base + "/" : "") + moduleName;
- while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
+ while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
var previous = moduleName;
moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
}
@@ -48,7 +46,7 @@ window.normalizeModule = function(parentId, moduleName) {
return moduleName;
};
-window.require = function require(parentId, id) {
+window.require = function(parentId, id) {
if (!id) {
id = parentId;
parentId = null;
@@ -66,36 +64,17 @@ window.require = function require(parentId, id) {
}
return module.exports;
}
-
+
+ var chunks = id.split("/");
if (!window.require.tlns)
return console.log("unable to load " + id);
-
- var path = resolveModuleId(id, window.require.tlns);
- if (path.slice(-3) != ".js") path += ".js";
+ chunks[0] = window.require.tlns[chunks[0]] || chunks[0];
+ var path = chunks.join("/") + ".js";
window.require.id = id;
- window.require.modules[id] = {}; // prevent infinite loop on broken modules
importScripts(path);
return window.require(parentId, id);
};
-function resolveModuleId(id, paths) {
- var testPath = id, tail = "";
- while (testPath) {
- var alias = paths[testPath];
- if (typeof alias == "string") {
- return alias + tail;
- } else if (alias) {
- return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
- } else if (alias === false) {
- return "";
- }
- var i = testPath.lastIndexOf("/");
- if (i === -1) break;
- tail = testPath.substr(i) + tail;
- testPath = testPath.slice(0, i);
- }
- return id;
-}
window.require.modules = {};
window.require.tlns = {};
@@ -121,9 +100,9 @@ window.define = function(id, deps, factory) {
}
if (!deps.length)
- // If there is no dependencies, we inject "require", "exports" and
- // "module" as dependencies, to provide CommonJS compatibility.
- deps = ["require", "exports", "module"];
+ // If there is no dependencies, we inject 'require', 'exports' and
+ // 'module' as dependencies, to provide CommonJS compatibility.
+ deps = ['require', 'exports', 'module'];
var req = function(childId) {
return window.require(id, childId);
@@ -134,16 +113,16 @@ window.define = function(id, deps, factory) {
factory: function() {
var module = this;
var returnExports = factory.apply(this, deps.map(function(dep) {
- switch (dep) {
- // Because "require", "exports" and "module" aren't actual
- // dependencies, we must handle them seperately.
- case "require": return req;
- case "exports": return module.exports;
- case "module": return module;
- // But for all other dependencies, we can just go ahead and
- // require them.
- default: return req(dep);
- }
+ switch(dep) {
+ // Because 'require', 'exports' and 'module' aren't actual
+ // dependencies, we must handle them seperately.
+ case 'require': return req;
+ case 'exports': return module.exports;
+ case 'module': return module;
+ // But for all other dependencies, we can just go ahead and
+ // require them.
+ default: return req(dep);
+ }
}));
if (returnExports)
module.exports = returnExports;
@@ -152,10 +131,9 @@ window.define = function(id, deps, factory) {
};
};
window.define.amd = {};
-require.tlns = {};
+
window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
- for (var i in topLevelNamespaces)
- require.tlns[i] = topLevelNamespaces[i];
+ require.tlns = topLevelNamespaces;
};
window.initSender = function initSender() {
@@ -195,23 +173,21 @@ var sender = window.sender = null;
window.onmessage = function(e) {
var msg = e.data;
- if (msg.event && sender) {
- sender._signal(msg.event, msg.data);
- }
- else if (msg.command) {
+ if (msg.command) {
if (main[msg.command])
main[msg.command].apply(main, msg.args);
- else if (window[msg.command])
- window[msg.command].apply(window, msg.args);
else
throw new Error("Unknown command:" + msg.command);
}
- else if (msg.init) {
- window.initBaseUrls(msg.tlns);
+ else if (msg.init) {
+ initBaseUrls(msg.tlns);
require("ace/lib/es5-shim");
- sender = window.sender = window.initSender();
+ sender = window.sender = initSender();
var clazz = require(msg.module)[msg.classname];
main = window.main = new clazz(sender);
+ }
+ else if (msg.event && sender) {
+ sender._signal(msg.event, msg.data);
}
};
})(this);
\ No newline at end of file
diff --git a/lib/ace/worker/worker_client.js b/lib/ace/worker/worker_client.js
index ba4f20a0..ad445287 100644
--- a/lib/ace/worker/worker_client.js
+++ b/lib/ace/worker/worker_client.js
@@ -162,22 +162,19 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
doc.on("change", this.changeListener);
};
- this.changeListener = function(delta) {
+ this.changeListener = function(e) {
if (!this.deltaQueue) {
- this.deltaQueue = [];
+ this.deltaQueue = [e.data];
setTimeout(this.$sendDeltaQueue, 0);
- }
- if (delta.action == "insert")
- this.deltaQueue.push(delta.start, delta.lines);
- else
- this.deltaQueue.push(delta.start, delta.end);
+ } else
+ this.deltaQueue.push(e.data);
};
this.$sendDeltaQueue = function() {
var q = this.deltaQueue;
if (!q) return;
this.deltaQueue = null;
- if (q.length > 50 && q.length > this.$doc.getLength() >> 1) {
+ if (q.length > 20 && q.length > this.$doc.getLength() >> 1) {
this.call("setValue", [this.$doc.getValue()]);
} else
this.emit("change", {data: q});
diff --git a/static.js b/static.js
index 3b75c2b6..a711715e 100755
--- a/static.js
+++ b/static.js
@@ -21,7 +21,7 @@ http.createServer(function(req, res) {
if (req.method == "PUT") {
if (!allowSave)
return error(res, 404, "Saving not allowed pass --allow-save to enable");
- return save(req, res, filename);
+ save(req, res, filename);
}
fs.exists(filename, function(exists) {
@@ -86,7 +86,6 @@ function save(req, res, filePath) {
}
res.statusCode = 200;
res.end("OK");
- console.log("saved ", filePath);
});
}
diff --git a/tool/lib.js b/tool/lib.js
index 3d57b6e0..8809595c 100644
--- a/tool/lib.js
+++ b/tool/lib.js
@@ -14,16 +14,8 @@ exports.parsePlist = function(xmlOrJSON, callback) {
});
} else {
try {
- xmlOrJSON = xmlOrJSON.replace(
- /("(?:\\.|[^"])*")|(?:,\s*)+([\]\}])|(\w+)\s*:|([\]\}]\s*[\[\{])|(\/\/.*|\/\*(?:[^\*]|\*(?=[^\/]))*?\*\/)/g,
- function(_, str, extraComma, noQuote, missingComma, comment) {
- if (comment)
- return "";
- if (missingComma)
- return missingComma[0] + "," + missingComma.slice(1);
- return str || extraComma || '"' + noQuote + '":';
- });
- json = JSON.parse(xmlOrJSON);
+ xmlOrJSON = xmlOrJSON.replace(/^\s*\/\/.*/gm, "");
+ json = JSON.parse(xmlOrJSON)
} catch(e) {
json = cson.parse(xmlOrJSON);
}
@@ -32,101 +24,10 @@ exports.parsePlist = function(xmlOrJSON, callback) {
return json;
};
-
exports.formatJSON = function(object, initialIndent) {
- return JSON.stringify(object, null, 4).replace(/^/gm, initialIndent||"");
+ return util.inspect(object, false, 40).replace(/^/gm, initialIndent||"");
};
-exports.formatJS = function(object, initialIndent) {
- return formatJS(object, 4, initialIndent);
-};
-
-function formatJS(object, indent, initialIndent) {
- if (typeof indent == "number")
- indent = Array(indent + 1).join(" ");
-
- function $format(buffer, totalIndent, state, o) {
- if (typeof o != "object" || !o) {
- if (typeof o == "string")
- buffer.push(JSON.stringify(o));
- else
- buffer.push("" + o);
- }
- else if (Array.isArray(o)) {
- buffer.push("[")
-
- var len = totalIndent.length
- var oneLine = true;
- for (var i = 0; i < o.length; i++) {
- if (typeof o[i] == "string") {
- len += o[i].length + 2
- } else if (!o[i]) {
- len += (o[i] + "").length
- } else {
- oneLine = false;
- break;
- }
- len += 2;
- if (len > 60) {
- oneLine = false;
- break;
- }
- }
-
- for (var i = 0; i < o.length; i++) {
- if (o[i] && typeof o[i] == "object") {
- $format(buffer, totalIndent, state, o[i]);
- if (i < o.length - 1)
- buffer.push(", ");
- } else {
- if (oneLine)
- i && buffer.push(" ");
- else
- buffer.push("\n", totalIndent + indent)
- $format(buffer, totalIndent + indent, state, o[i]);
- if (i < o.length - 1)
- buffer.push(",");
- }
-
- }
- if (!oneLine && buffer[buffer.length - 1] != "}")
- buffer.push("\n" + totalIndent)
- buffer.push("]")
- }
- else {
- var keys = Object.keys(o);
- buffer.push("{", "\n");
- for (var i = 0; i < keys.length; i++) {
- buffer.push(totalIndent + indent);
- if (/^\w+$/.test(keys[i]))
- buffer.push(keys[i]);
- else
- buffer.push(JSON.stringify(keys[i]));
- buffer.push(": ")
-
- if (keys[i] == "regex" && typeof o[keys[i]] == "string") {
- try {
- var re = new RegExp(o[keys[i]]);
- buffer.push("/" + re.source.replace(/\\.|\//g, function(f) {
- return f.length == 1 ? "\\" + f : f;
- }) + "/");
- } catch(e) {
- $format(buffer, totalIndent + indent, state, o[keys[i]]);
- }
- } else {
- $format(buffer, totalIndent + indent, state, o[keys[i]]);
- }
-
- if (i < keys.length - 1)
- buffer.push(",", "\n");
- }
- buffer.push("\n", totalIndent, "}");
- }
- }
- var buffer = [];
- $format(buffer, initialIndent || "", {}, object);
- return buffer.join("");
-}
exports.fillTemplate = function(template, replacements) {
return template.replace(/%(.+?)%/g, function(str, m) {
diff --git a/tool/mode_creator.js b/tool/mode_creator.js
index 44aa67d0..7a2aea59 100644
--- a/tool/mode_creator.js
+++ b/tool/mode_creator.js
@@ -126,8 +126,8 @@ function handleSaveResult(err, editor) {
return log(
"Write access to this file is disabled.\n"+
"To enable saving your changes to disk, clone the Ace repository\n"+
- "and run the included web server with the --allow-save option\n"+
- "`node static.js --allow-save` or `static.py --puttable=*`"
+ "and run the included web server with the --allow-write option\n"+
+ "`node static.js --allow-write` or `static.py --puttable=*`"
);
}
editor.session.getUndoManager().markClean();
diff --git a/tool/tmlanguage.js b/tool/tmlanguage.js
index b5d8b851..0e458330 100644
--- a/tool/tmlanguage.js
+++ b/tool/tmlanguage.js
@@ -662,10 +662,10 @@ function convertTmLanguage(name, langStr) {
var languageHighlightRules = lib.fillTemplate(modeHighlightTemplate, {
language: languageNameSanitized,
- languageTokens: lib.formatJS(patterns, " ").trim(),
+ languageTokens: lib.formatJSON(patterns, " ").trim(),
uuid: language.uuid,
name: name,
- metaData: lib.formatJS(language, "").trim()
+ metaData: lib.formatJSON(language, " ").trim()
});
if (devMode) {