use APF style class declaration
This commit is contained in:
parent
7344f24d71
commit
2b736e7c8e
20 changed files with 1945 additions and 1867 deletions
|
|
@ -41,23 +41,26 @@ ace.BackgroundTokenizer = function(tokenizer) {
|
||||||
|
|
||||||
this.$initEvents();
|
this.$initEvents();
|
||||||
};
|
};
|
||||||
ace.mixin(ace.BackgroundTokenizer.prototype, ace.MEventEmitter);
|
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.setTokenizer = function(tokenizer) {
|
(function(){
|
||||||
|
|
||||||
|
ace.mixin(this, ace.MEventEmitter);
|
||||||
|
|
||||||
|
this.setTokenizer = function(tokenizer) {
|
||||||
this.tokenizer = tokenizer;
|
this.tokenizer = tokenizer;
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
|
|
||||||
this.start(0);
|
this.start(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.setLines = function(textLines) {
|
this.setLines = function(textLines) {
|
||||||
this.textLines = textLines;
|
this.textLines = textLines;
|
||||||
this.lines = [];
|
this.lines = [];
|
||||||
|
|
||||||
this.stop();
|
this.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.fireUpdateEvent = function(firstRow, lastRow) {
|
this.fireUpdateEvent = function(firstRow, lastRow) {
|
||||||
var data = {
|
var data = {
|
||||||
first: firstRow,
|
first: firstRow,
|
||||||
last: lastRow
|
last: lastRow
|
||||||
|
|
@ -65,7 +68,7 @@ ace.BackgroundTokenizer.prototype.fireUpdateEvent = function(firstRow, lastRow)
|
||||||
this.$dispatchEvent("update", {data: data});
|
this.$dispatchEvent("update", {data: data});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.start = function(startRow) {
|
this.start = function(startRow) {
|
||||||
this.currentLine = Math.min(startRow || 0, this.currentLine,
|
this.currentLine = Math.min(startRow || 0, this.currentLine,
|
||||||
this.textLines.length);
|
this.textLines.length);
|
||||||
|
|
||||||
|
|
@ -78,19 +81,19 @@ ace.BackgroundTokenizer.prototype.start = function(startRow) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.stop = function() {
|
this.stop = function() {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.getTokens = function(row) {
|
this.getTokens = function(row) {
|
||||||
return this._tokenizeRow(row).tokens;
|
return this._tokenizeRow(row).tokens;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype.getState = function(row) {
|
this.getState = function(row) {
|
||||||
return this._tokenizeRow(row).state;
|
return this._tokenizeRow(row).state;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.BackgroundTokenizer.prototype._tokenizeRow = function(row) {
|
this._tokenizeRow = function(row) {
|
||||||
if (!this.lines[row]) {
|
if (!this.lines[row]) {
|
||||||
var state = "start";
|
var state = "start";
|
||||||
if (row > 0 && this.lines[row - 1]) {
|
if (row > 0 && this.lines[row - 1]) {
|
||||||
|
|
@ -100,3 +103,5 @@ ace.BackgroundTokenizer.prototype._tokenizeRow = function(row) {
|
||||||
}
|
}
|
||||||
return this.lines[row];
|
return this.lines[row];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.BackgroundTokenizer.prototype);
|
||||||
|
|
@ -13,21 +13,23 @@ ace.Document = function(text, mode) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
ace.mixin(ace.Document.prototype, ace.MEventEmitter);
|
ace.mixin(ace.Document.prototype, ace.MEventEmitter);
|
||||||
|
|
||||||
ace.Document.prototype._split = function(text) {
|
this._split = function(text) {
|
||||||
return text.split(/\r\n|\r|\n/);
|
return text.split(/\r\n|\r|\n/);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.toString = function() {
|
this.toString = function() {
|
||||||
return this.lines.join("\n");
|
return this.lines.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getSelection = function() {
|
this.getSelection = function() {
|
||||||
return this.selection;
|
return this.selection;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.fireChangeEvent = function(firstRow, lastRow) {
|
this.fireChangeEvent = function(firstRow, lastRow) {
|
||||||
var data = {
|
var data = {
|
||||||
firstRow: firstRow,
|
firstRow: firstRow,
|
||||||
lastRow: lastRow
|
lastRow: lastRow
|
||||||
|
|
@ -35,64 +37,64 @@ ace.Document.prototype.fireChangeEvent = function(firstRow, lastRow) {
|
||||||
this.$dispatchEvent("change", { data: data});
|
this.$dispatchEvent("change", { data: data});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getTabString = function() {
|
this.getTabString = function() {
|
||||||
if (this.getUseSoftTabs()) {
|
if (this.getUseSoftTabs()) {
|
||||||
return new Array(this.getTabSize()+1).join(" ");
|
return new Array(this.getTabSize()+1).join(" ");
|
||||||
}
|
}
|
||||||
return "\t";
|
return "\t";
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._useSoftTabs = true;
|
this._useSoftTabs = false;
|
||||||
ace.Document.prototype.setUseSoftTabs = function(useSoftTabs) {
|
this.setUseSoftTabs = function(useSoftTabs) {
|
||||||
if (this._useSoftTabs === useSoftTabs) return;
|
if (this._useSoftTabs === useSoftTabs) return;
|
||||||
|
|
||||||
this._useSoftTabs = useSoftTabs;
|
this._useSoftTabs = useSoftTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getUseSoftTabs = function() {
|
this.getUseSoftTabs = function() {
|
||||||
return this._useSoftTabs;
|
return this._useSoftTabs;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._tabSize = 4;
|
this._tabSize = 4;
|
||||||
ace.Document.prototype.setTabSize = function(tabSize) {
|
this.setTabSize = function(tabSize) {
|
||||||
if (this._tabSize === tabSize) return;
|
if (this._tabSize === tabSize) return;
|
||||||
|
|
||||||
this._tabSize = tabSize;
|
this._tabSize = tabSize;
|
||||||
this.$dispatchEvent("changeTabSize");
|
this.$dispatchEvent("changeTabSize");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getTabSize = function() {
|
this.getTabSize = function() {
|
||||||
return this._tabSize;
|
return this._tabSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._mode = null;
|
this._mode = null;
|
||||||
ace.Document.prototype.setMode = function(mode) {
|
this.setMode = function(mode) {
|
||||||
if (this._mode === mode) return;
|
if (this._mode === mode) return;
|
||||||
|
|
||||||
this._mode = mode;
|
this._mode = mode;
|
||||||
this.$dispatchEvent("changeMode");
|
this.$dispatchEvent("changeMode");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getMode = function() {
|
this.getMode = function() {
|
||||||
if (!this._mode) {
|
if (!this._mode) {
|
||||||
this._mode = new ace.mode.Text();
|
this._mode = new ace.mode.Text();
|
||||||
}
|
}
|
||||||
return this._mode;
|
return this._mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._scrollTop = 0;
|
this._scrollTop = 0;
|
||||||
ace.Document.prototype.setScrollTopRow = function(scrollTopRow) {
|
this.setScrollTopRow = function(scrollTopRow) {
|
||||||
if (this._scrollTop === scrollTopRow) return;
|
if (this._scrollTop === scrollTopRow) return;
|
||||||
|
|
||||||
this._scrollTop = scrollTopRow;
|
this._scrollTop = scrollTopRow;
|
||||||
this.$dispatchEvent("changeScrollTop");
|
this.$dispatchEvent("changeScrollTop");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getScrollTopRow = function() {
|
this.getScrollTopRow = function() {
|
||||||
return this._scrollTop;
|
return this._scrollTop;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getWidth = function() {
|
this.getWidth = function() {
|
||||||
if (this.modified) {
|
if (this.modified) {
|
||||||
this.modified = false;
|
this.modified = false;
|
||||||
|
|
||||||
|
|
@ -106,15 +108,15 @@ ace.Document.prototype.getWidth = function() {
|
||||||
return this.width;
|
return this.width;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getLine = function(row) {
|
this.getLine = function(row) {
|
||||||
return this.lines[row] || "";
|
return this.lines[row] || "";
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getLength = function() {
|
this.getLength = function() {
|
||||||
return this.lines.length;
|
return this.lines.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getTextRange = function(range) {
|
this.getTextRange = function(range) {
|
||||||
if (range.start.row == range.end.row) {
|
if (range.start.row == range.end.row) {
|
||||||
return this.lines[range.start.row].substring(range.start.column,
|
return this.lines[range.start.row].substring(range.start.column,
|
||||||
range.end.column);
|
range.end.column);
|
||||||
|
|
@ -128,11 +130,11 @@ ace.Document.prototype.getTextRange = function(range) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.getLines = function(firstRow, lastRow) {
|
this.getLines = function(firstRow, lastRow) {
|
||||||
return this.lines.slice(firstRow, lastRow+1);
|
return this.lines.slice(firstRow, lastRow+1);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.findMatchingBracket = function(position) {
|
this.findMatchingBracket = function(position) {
|
||||||
if (position.column == 0) return null;
|
if (position.column == 0) return null;
|
||||||
|
|
||||||
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
|
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
|
||||||
|
|
@ -150,7 +152,7 @@ ace.Document.prototype.findMatchingBracket = function(position) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._brackets = {
|
this._brackets = {
|
||||||
")": "(",
|
")": "(",
|
||||||
"(": ")",
|
"(": ")",
|
||||||
"]": "[",
|
"]": "[",
|
||||||
|
|
@ -159,7 +161,7 @@ ace.Document.prototype._brackets = {
|
||||||
"}": "{"
|
"}": "{"
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._findOpeningBracket = function(bracket, position) {
|
this._findOpeningBracket = function(bracket, position) {
|
||||||
var openBracket = this._brackets[bracket];
|
var openBracket = this._brackets[bracket];
|
||||||
|
|
||||||
var column = position.column - 2;
|
var column = position.column - 2;
|
||||||
|
|
@ -191,7 +193,7 @@ ace.Document.prototype._findOpeningBracket = function(bracket, position) {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._findClosingBracket = function(bracket, position) {
|
this._findClosingBracket = function(bracket, position) {
|
||||||
var closingBracket = this._brackets[bracket];
|
var closingBracket = this._brackets[bracket];
|
||||||
|
|
||||||
var column = position.column;
|
var column = position.column;
|
||||||
|
|
@ -224,20 +226,20 @@ ace.Document.prototype._findClosingBracket = function(bracket, position) {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.insert = function(position, text) {
|
this.insert = function(position, text) {
|
||||||
var end = this._insert(position, text);
|
var end = this._insert(position, text);
|
||||||
this.fireChangeEvent(position.row, position.row == end.row ? position.row
|
this.fireChangeEvent(position.row, position.row == end.row ? position.row
|
||||||
: undefined);
|
: undefined);
|
||||||
return end;
|
return end;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._insertLines = function(row, lines) {
|
this._insertLines = function(row, lines) {
|
||||||
var args = [row, 0];
|
var args = [row, 0];
|
||||||
args.push.apply(args, lines);
|
args.push.apply(args, lines);
|
||||||
this.lines.splice.apply(this.lines, args);
|
this.lines.splice.apply(this.lines, args);
|
||||||
},
|
},
|
||||||
|
|
||||||
ace.Document.prototype._insert = function(position, text) {
|
this._insert = function(position, text) {
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
|
|
||||||
var newLines = this._split(text);
|
var newLines = this._split(text);
|
||||||
|
|
@ -281,11 +283,11 @@ ace.Document.prototype._insert = function(position, text) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._isNewLine = function(text) {
|
this._isNewLine = function(text) {
|
||||||
return (text == "\r\n" || text == "\r" || text == "\n");
|
return (text == "\r\n" || text == "\r" || text == "\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.remove = function(range) {
|
this.remove = function(range) {
|
||||||
this._remove(range);
|
this._remove(range);
|
||||||
|
|
||||||
this.fireChangeEvent(range.start.row,
|
this.fireChangeEvent(range.start.row,
|
||||||
|
|
@ -294,7 +296,7 @@ ace.Document.prototype.remove = function(range) {
|
||||||
return range.start;
|
return range.start;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._remove = function(range) {
|
this._remove = function(range) {
|
||||||
this.modified = true;
|
this.modified = true;
|
||||||
|
|
||||||
var firstRow = range.start.row;
|
var firstRow = range.start.row;
|
||||||
|
|
@ -308,7 +310,7 @@ ace.Document.prototype._remove = function(range) {
|
||||||
return range.start;
|
return range.start;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.replace = function(range, text) {
|
this.replace = function(range, text) {
|
||||||
this._remove(range);
|
this._remove(range);
|
||||||
if (text) {
|
if (text) {
|
||||||
var end = this._insert(range.start, text);
|
var end = this._insert(range.start, text);
|
||||||
|
|
@ -325,7 +327,7 @@ ace.Document.prototype.replace = function(range, text) {
|
||||||
return end;
|
return end;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.indentRows = function(range, indentString) {
|
this.indentRows = function(range, indentString) {
|
||||||
for (var i=range.start.row; i<= range.end.row; i++) {
|
for (var i=range.start.row; i<= range.end.row; i++) {
|
||||||
this.lines[i] = indentString + this.getLine(i);
|
this.lines[i] = indentString + this.getLine(i);
|
||||||
}
|
}
|
||||||
|
|
@ -333,7 +335,7 @@ ace.Document.prototype.indentRows = function(range, indentString) {
|
||||||
return indentString.length;
|
return indentString.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.outdentRows = function(range, indentString) {
|
this.outdentRows = function(range, indentString) {
|
||||||
outdentLength = indentString.length;
|
outdentLength = indentString.length;
|
||||||
|
|
||||||
for (var i=range.start.row; i<= range.end.row; i++) {
|
for (var i=range.start.row; i<= range.end.row; i++) {
|
||||||
|
|
@ -350,7 +352,7 @@ ace.Document.prototype.outdentRows = function(range, indentString) {
|
||||||
return -outdentLength;
|
return -outdentLength;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.moveLinesUp = function(firstRow, lastRow) {
|
this.moveLinesUp = function(firstRow, lastRow) {
|
||||||
if (firstRow <= 0) return 0;
|
if (firstRow <= 0) return 0;
|
||||||
|
|
||||||
var removed = this.lines.splice(firstRow, lastRow-firstRow+1);
|
var removed = this.lines.splice(firstRow, lastRow-firstRow+1);
|
||||||
|
|
@ -360,7 +362,7 @@ ace.Document.prototype.moveLinesUp = function(firstRow, lastRow) {
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.moveLinesDown = function(firstRow, lastRow) {
|
this.moveLinesDown = function(firstRow, lastRow) {
|
||||||
if (lastRow >= this.lines.length-1) return 0;
|
if (lastRow >= this.lines.length-1) return 0;
|
||||||
|
|
||||||
var removed = this.lines.splice(firstRow, lastRow-firstRow+1);
|
var removed = this.lines.splice(firstRow, lastRow-firstRow+1);
|
||||||
|
|
@ -370,7 +372,7 @@ ace.Document.prototype.moveLinesDown = function(firstRow, lastRow) {
|
||||||
return 1;
|
return 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype.duplicateLines = function(firstRow, lastRow) {
|
this.duplicateLines = function(firstRow, lastRow) {
|
||||||
var firstRow = this._clipRowToDocument(firstRow);
|
var firstRow = this._clipRowToDocument(firstRow);
|
||||||
var lastRow = this._clipRowToDocument(lastRow);
|
var lastRow = this._clipRowToDocument(lastRow);
|
||||||
|
|
||||||
|
|
@ -383,7 +385,8 @@ ace.Document.prototype.duplicateLines = function(firstRow, lastRow) {
|
||||||
return addedRows;
|
return addedRows;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Document.prototype._clipRowToDocument = function(row) {
|
this._clipRowToDocument = function(row) {
|
||||||
return Math.max(0, Math.min(row, this.lines.length-1));
|
return Math.max(0, Math.min(row, this.lines.length-1));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.Document.prototype);
|
||||||
|
|
|
||||||
140
src/Editor.js
140
src/Editor.js
|
|
@ -26,8 +26,9 @@ ace.Editor = function(renderer, doc) {
|
||||||
this.setDocument(doc || new ace.Document(""));
|
this.setDocument(doc || new ace.Document(""));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
ace.Editor.prototype.setDocument = function(doc) {
|
this.setDocument = function(doc) {
|
||||||
if (this.doc == doc) return;
|
if (this.doc == doc) return;
|
||||||
|
|
||||||
if (this.doc) {
|
if (this.doc) {
|
||||||
|
|
@ -71,19 +72,19 @@ ace.Editor.prototype.setDocument = function(doc) {
|
||||||
this.renderer.scrollToRow(doc.getScrollTopRow());
|
this.renderer.scrollToRow(doc.getScrollTopRow());
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getDocument = function() {
|
this.getDocument = function() {
|
||||||
return this.doc;
|
return this.doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getSelection = function() {
|
this.getSelection = function() {
|
||||||
return this.selection;
|
return this.selection;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.resize = function() {
|
this.resize = function() {
|
||||||
this.renderer.onResize();
|
this.renderer.onResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype._highlightBrackets = function() {
|
this._highlightBrackets = function() {
|
||||||
if (this._bracketHighlight) {
|
if (this._bracketHighlight) {
|
||||||
this.renderer.removeMarker(this._bracketHighlight);
|
this.renderer.removeMarker(this._bracketHighlight);
|
||||||
this._bracketHighlight = null;
|
this._bracketHighlight = null;
|
||||||
|
|
@ -113,36 +114,36 @@ ace.Editor.prototype._highlightBrackets = function() {
|
||||||
}, 10);
|
}, 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.focus = function() {
|
this.focus = function() {
|
||||||
this.textInput.focus();
|
this.textInput.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.blur = function() {
|
this.blur = function() {
|
||||||
this.textInput.blur();
|
this.textInput.blur();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onFocus = function() {
|
this.onFocus = function() {
|
||||||
this.renderer.showCursor();
|
this.renderer.showCursor();
|
||||||
this.renderer.visualizeFocus();
|
this.renderer.visualizeFocus();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onBlur = function() {
|
this.onBlur = function() {
|
||||||
this.renderer.hideCursor();
|
this.renderer.hideCursor();
|
||||||
this.renderer.visualizeBlur();
|
this.renderer.visualizeBlur();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onDocumentChange = function(e) {
|
this.onDocumentChange = function(e) {
|
||||||
var data = e.data;
|
var data = e.data;
|
||||||
this.bgTokenizer.start(data.firstRow);
|
this.bgTokenizer.start(data.firstRow);
|
||||||
this.renderer.updateLines(data.firstRow, data.lastRow);
|
this.renderer.updateLines(data.firstRow, data.lastRow);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onTokenizerUpdate = function(e) {
|
this.onTokenizerUpdate = function(e) {
|
||||||
var rows = e.data;
|
var rows = e.data;
|
||||||
this.renderer.updateLines(rows.first, rows.last);
|
this.renderer.updateLines(rows.first, rows.last);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onCursorChange = function() {
|
this.onCursorChange = function() {
|
||||||
this._highlightBrackets();
|
this._highlightBrackets();
|
||||||
this.renderer.updateCursor(this.getCursorPosition());
|
this.renderer.updateCursor(this.getCursorPosition());
|
||||||
|
|
||||||
|
|
@ -152,7 +153,7 @@ ace.Editor.prototype.onCursorChange = function() {
|
||||||
this._updateHighlightActiveLine();
|
this._updateHighlightActiveLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype._updateHighlightActiveLine = function() {
|
this._updateHighlightActiveLine = function() {
|
||||||
if (this._highlightLineMarker) {
|
if (this._highlightLineMarker) {
|
||||||
this.renderer.removeMarker(this._highlightLineMarker);
|
this.renderer.removeMarker(this._highlightLineMarker);
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +175,7 @@ ace.Editor.prototype._updateHighlightActiveLine = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onSelectionChange = function() {
|
this.onSelectionChange = function() {
|
||||||
if (this._selectionMarker) {
|
if (this._selectionMarker) {
|
||||||
this.renderer.removeMarker(this._selectionMarker);
|
this.renderer.removeMarker(this._selectionMarker);
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +190,7 @@ ace.Editor.prototype.onSelectionChange = function() {
|
||||||
this.onCursorChange();
|
this.onCursorChange();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onDocumentModeChange = function() {
|
this.onDocumentModeChange = function() {
|
||||||
var mode = this.doc.getMode();
|
var mode = this.doc.getMode();
|
||||||
|
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
|
|
@ -208,7 +209,7 @@ ace.Editor.prototype.onDocumentModeChange = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Editor.prototype.onMouseDown = function(e) {
|
this.onMouseDown = function(e) {
|
||||||
var pageX = ace.getDocumentX(e);
|
var pageX = ace.getDocumentX(e);
|
||||||
var pageY = ace.getDocumentY(e);
|
var pageY = ace.getDocumentY(e);
|
||||||
|
|
||||||
|
|
@ -246,21 +247,21 @@ ace.Editor.prototype.onMouseDown = function(e) {
|
||||||
return ace.preventDefault(e);
|
return ace.preventDefault(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onMouseDoubleClick = function(e) {
|
this.onMouseDoubleClick = function(e) {
|
||||||
this.selection.selectWord();
|
this.selection.selectWord();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onMouseTripleClick = function(e) {
|
this.onMouseTripleClick = function(e) {
|
||||||
this.selection.selectLine();
|
this.selection.selectLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onMouseWheel = function(e) {
|
this.onMouseWheel = function(e) {
|
||||||
var delta = e.wheel;
|
var delta = e.wheel;
|
||||||
this.renderer.scrollToY(this.renderer.getScrollTop() - (delta * 15));
|
this.renderer.scrollToY(this.renderer.getScrollTop() - (delta * 15));
|
||||||
return ace.preventDefault(e);
|
return ace.preventDefault(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getCopyText = function() {
|
this.getCopyText = function() {
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
return this.doc.getTextRange(this.getSelectionRange());
|
return this.doc.getTextRange(this.getSelectionRange());
|
||||||
}
|
}
|
||||||
|
|
@ -269,14 +270,14 @@ ace.Editor.prototype.getCopyText = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onCut = function() {
|
this.onCut = function() {
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
this.moveCursorToPosition(this.doc.remove(this.getSelectionRange()));
|
this.moveCursorToPosition(this.doc.remove(this.getSelectionRange()));
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onTextInput = function(text) {
|
this.onTextInput = function(text) {
|
||||||
var cursor = this.getCursorPosition();
|
var cursor = this.getCursorPosition();
|
||||||
|
|
||||||
if (this.doc.getUseSoftTabs()) {
|
if (this.doc.getUseSoftTabs()) {
|
||||||
|
|
@ -313,31 +314,31 @@ ace.Editor.prototype.onTextInput = function(text) {
|
||||||
this.renderer.scrollCursorIntoView();
|
this.renderer.scrollCursorIntoView();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype._selectionStyle = "line";
|
this._selectionStyle = "line";
|
||||||
ace.Editor.prototype.setSelectionStyle = function(style) {
|
this.setSelectionStyle = function(style) {
|
||||||
if (this._selectionStyle == style) return;
|
if (this._selectionStyle == style) return;
|
||||||
|
|
||||||
this._selectionStyle = style;
|
this._selectionStyle = style;
|
||||||
this.onSelectionChange();
|
this.onSelectionChange();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getSelectionStyle = function() {
|
this.getSelectionStyle = function() {
|
||||||
return this._selectionStyle;
|
return this._selectionStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype._highlightActiveLine = true;
|
this._highlightActiveLine = true;
|
||||||
ace.Editor.prototype.setHighlightActiveLine = function(shouldHighlight) {
|
this.setHighlightActiveLine = function(shouldHighlight) {
|
||||||
if (this._highlightActiveLine == shouldHighlight) return;
|
if (this._highlightActiveLine == shouldHighlight) return;
|
||||||
|
|
||||||
this._highlightActiveLine = shouldHighlight;
|
this._highlightActiveLine = shouldHighlight;
|
||||||
this._updateHighlightActiveLine();
|
this._updateHighlightActiveLine();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getHighlightActiveLine = function() {
|
this.getHighlightActiveLine = function() {
|
||||||
return this._highlightActiveLine;
|
return this._highlightActiveLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.removeRight = function() {
|
this.removeRight = function() {
|
||||||
if (this.selection.isEmpty()) {
|
if (this.selection.isEmpty()) {
|
||||||
this.selection.selectRight();
|
this.selection.selectRight();
|
||||||
}
|
}
|
||||||
|
|
@ -345,7 +346,7 @@ ace.Editor.prototype.removeRight = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.removeLeft = function() {
|
this.removeLeft = function() {
|
||||||
if (this.selection.isEmpty()) {
|
if (this.selection.isEmpty()) {
|
||||||
this.selection.selectLeft();
|
this.selection.selectLeft();
|
||||||
}
|
}
|
||||||
|
|
@ -353,21 +354,21 @@ ace.Editor.prototype.removeLeft = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.blockIndent = function(indentString) {
|
this.blockIndent = function(indentString) {
|
||||||
var indentString = indentString || this.doc.getTabString();
|
var indentString = indentString || this.doc.getTabString();
|
||||||
var addedColumns = this.doc.indentRows(this.getSelectionRange(), indentString);
|
var addedColumns = this.doc.indentRows(this.getSelectionRange(), indentString);
|
||||||
|
|
||||||
this.selection.shiftSelection(addedColumns);
|
this.selection.shiftSelection(addedColumns);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.blockOutdent = function(indentString) {
|
this.blockOutdent = function(indentString) {
|
||||||
var indentString = indentString || this.doc.getTabString();
|
var indentString = indentString || this.doc.getTabString();
|
||||||
var addedColumns = this.doc.outdentRows(this.getSelectionRange(), indentString);
|
var addedColumns = this.doc.outdentRows(this.getSelectionRange(), indentString);
|
||||||
|
|
||||||
this.selection.shiftSelection(addedColumns);
|
this.selection.shiftSelection(addedColumns);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.toggleCommentLines = function() {
|
this.toggleCommentLines = function() {
|
||||||
var rows = this._getSelectedRows();
|
var rows = this._getSelectedRows();
|
||||||
|
|
||||||
var range = {
|
var range = {
|
||||||
|
|
@ -386,7 +387,7 @@ ace.Editor.prototype.toggleCommentLines = function() {
|
||||||
this.selection.shiftSelection(addedColumns);
|
this.selection.shiftSelection(addedColumns);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.removeLines = function() {
|
this.removeLines = function() {
|
||||||
var rows = this._getSelectedRows();
|
var rows = this._getSelectedRows();
|
||||||
this.selection.setSelectionAnchor(rows.last+1, 0);
|
this.selection.setSelectionAnchor(rows.last+1, 0);
|
||||||
this.selection.selectTo(rows.first, 0);
|
this.selection.selectTo(rows.first, 0);
|
||||||
|
|
@ -395,33 +396,33 @@ ace.Editor.prototype.removeLines = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.moveLinesDown = function() {
|
this.moveLinesDown = function() {
|
||||||
this._moveLines(function(firstRow, lastRow) {
|
this._moveLines(function(firstRow, lastRow) {
|
||||||
return this.doc.moveLinesDown(firstRow, lastRow);
|
return this.doc.moveLinesDown(firstRow, lastRow);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.moveLinesUp = function() {
|
this.moveLinesUp = function() {
|
||||||
this._moveLines(function(firstRow, lastRow) {
|
this._moveLines(function(firstRow, lastRow) {
|
||||||
return this.doc.moveLinesUp(firstRow, lastRow);
|
return this.doc.moveLinesUp(firstRow, lastRow);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.copyLinesUp = function() {
|
this.copyLinesUp = function() {
|
||||||
this._moveLines(function(firstRow, lastRow) {
|
this._moveLines(function(firstRow, lastRow) {
|
||||||
this.doc.duplicateLines(firstRow, lastRow);
|
this.doc.duplicateLines(firstRow, lastRow);
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.copyLinesDown = function() {
|
this.copyLinesDown = function() {
|
||||||
this._moveLines(function(firstRow, lastRow) {
|
this._moveLines(function(firstRow, lastRow) {
|
||||||
return this.doc.duplicateLines(firstRow, lastRow);
|
return this.doc.duplicateLines(firstRow, lastRow);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Editor.prototype._moveLines = function(mover) {
|
this._moveLines = function(mover) {
|
||||||
var rows = this._getSelectedRows();
|
var rows = this._getSelectedRows();
|
||||||
|
|
||||||
var linesMoved = mover.call(this, rows.first, rows.last);
|
var linesMoved = mover.call(this, rows.first, rows.last);
|
||||||
|
|
@ -433,7 +434,7 @@ ace.Editor.prototype._moveLines = function(mover) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype._getSelectedRows = function() {
|
this._getSelectedRows = function() {
|
||||||
var range = this.getSelectionRange();
|
var range = this.getSelectionRange();
|
||||||
var firstRow = range.start.row;
|
var firstRow = range.start.row;
|
||||||
var lastRow = range.end.row;
|
var lastRow = range.end.row;
|
||||||
|
|
@ -447,42 +448,42 @@ ace.Editor.prototype._getSelectedRows = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onCompositionStart = function() {
|
this.onCompositionStart = function() {
|
||||||
this.renderer.showComposition(this.getCursorPosition());
|
this.renderer.showComposition(this.getCursorPosition());
|
||||||
this.onTextInput(" ");
|
this.onTextInput(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onCompositionUpdate = function(text) {
|
this.onCompositionUpdate = function(text) {
|
||||||
this.renderer.setCompositionText(text);
|
this.renderer.setCompositionText(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.onCompositionEnd = function() {
|
this.onCompositionEnd = function() {
|
||||||
this.renderer.hideComposition();
|
this.renderer.hideComposition();
|
||||||
this.removeLeft();
|
this.removeLeft();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Editor.prototype.getFirstVisibleRow = function() {
|
this.getFirstVisibleRow = function() {
|
||||||
return this.renderer.getFirstVisibleRow();
|
return this.renderer.getFirstVisibleRow();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getLastVisibleRow = function() {
|
this.getLastVisibleRow = function() {
|
||||||
return this.renderer.getLastVisibleRow();
|
return this.renderer.getLastVisibleRow();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.isRowVisible = function(row) {
|
this.isRowVisible = function(row) {
|
||||||
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getVisibleRowCount = function() {
|
this.getVisibleRowCount = function() {
|
||||||
return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1;
|
return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getPageDownRow = function() {
|
this.getPageDownRow = function() {
|
||||||
return this.renderer.getLastVisibleRow() - 1;
|
return this.renderer.getLastVisibleRow() - 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getPageUpRow = function() {
|
this.getPageUpRow = function() {
|
||||||
var firstRow = this.renderer.getFirstVisibleRow();
|
var firstRow = this.renderer.getFirstVisibleRow();
|
||||||
var lastRow = this.renderer.getLastVisibleRow();
|
var lastRow = this.renderer.getLastVisibleRow();
|
||||||
|
|
||||||
|
|
@ -490,41 +491,41 @@ ace.Editor.prototype.getPageUpRow = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Editor.prototype.scrollPageDown = function() {
|
this.scrollPageDown = function() {
|
||||||
this.scrollToRow(this.getPageDownRow());
|
this.scrollToRow(this.getPageDownRow());
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.scrollPageUp = function() {
|
this.scrollPageUp = function() {
|
||||||
this.renderer.scrollToRow(this.getPageUpRow());
|
this.renderer.scrollToRow(this.getPageUpRow());
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.scrollToRow = function(row) {
|
this.scrollToRow = function(row) {
|
||||||
this.renderer.scrollToRow(row);
|
this.renderer.scrollToRow(row);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Editor.prototype.getCursorPosition = function() {
|
this.getCursorPosition = function() {
|
||||||
return this.selection.getCursor();
|
return this.selection.getCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.getSelectionRange = function() {
|
this.getSelectionRange = function() {
|
||||||
return this.selection.getRange();
|
return this.selection.getRange();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.clearSelection = function() {
|
this.clearSelection = function() {
|
||||||
this.selection.clearSelection();
|
this.selection.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.moveCursorTo = function(row, column) {
|
this.moveCursorTo = function(row, column) {
|
||||||
this.selection.moveCursorTo(row, column);
|
this.selection.moveCursorTo(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.moveCursorToPosition = function(pos) {
|
this.moveCursorToPosition = function(pos) {
|
||||||
this.selection.moveCursorToPosition(pos);
|
this.selection.moveCursorToPosition(pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Editor.prototype.gotoLine = function(lineNumber) {
|
this.gotoLine = function(lineNumber) {
|
||||||
this._blockScrolling = true;
|
this._blockScrolling = true;
|
||||||
this.moveCursorTo(lineNumber-1, 0);
|
this.moveCursorTo(lineNumber-1, 0);
|
||||||
this._blockScrolling = false;
|
this._blockScrolling = false;
|
||||||
|
|
@ -534,22 +535,22 @@ ace.Editor.prototype.gotoLine = function(lineNumber) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
ace.Editor.prototype.navigateTo = function(row, column) {
|
this.navigateTo = function(row, column) {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateUp = function() {
|
this.navigateUp = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorUp();
|
this.selection.moveCursorUp();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateDown = function() {
|
this.navigateDown = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorDown();
|
this.selection.moveCursorDown();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateLeft = function() {
|
this.navigateLeft = function() {
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
var selectionStart = this.getSelectionRange().start;
|
var selectionStart = this.getSelectionRange().start;
|
||||||
this.moveCursorToPosition(selectionStart);
|
this.moveCursorToPosition(selectionStart);
|
||||||
|
|
@ -560,7 +561,7 @@ ace.Editor.prototype.navigateLeft = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateRight = function() {
|
this.navigateRight = function() {
|
||||||
if (!this.selection.isEmpty()) {
|
if (!this.selection.isEmpty()) {
|
||||||
var selectionEnd = this.getSelectionRange().end;
|
var selectionEnd = this.getSelectionRange().end;
|
||||||
this.moveCursorToPosition(selectionEnd);
|
this.moveCursorToPosition(selectionEnd);
|
||||||
|
|
@ -571,32 +572,33 @@ ace.Editor.prototype.navigateRight = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateLineStart = function() {
|
this.navigateLineStart = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorLineStart();
|
this.selection.moveCursorLineStart();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateLineEnd = function() {
|
this.navigateLineEnd = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorLineEnd();
|
this.selection.moveCursorLineEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateFileEnd = function() {
|
this.navigateFileEnd = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorFileEnd();
|
this.selection.moveCursorFileEnd();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateFileStart = function() {
|
this.navigateFileStart = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorFileStart();
|
this.selection.moveCursorFileStart();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateWordRight = function() {
|
this.navigateWordRight = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorWordRight();
|
this.selection.moveCursorWordRight();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Editor.prototype.navigateWordLeft = function() {
|
this.navigateWordLeft = function() {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
this.selection.moveCursorWordLeft();
|
this.selection.moveCursorWordLeft();
|
||||||
};
|
};
|
||||||
|
}).call(ace.Editor.prototype);
|
||||||
|
|
@ -1,26 +1,9 @@
|
||||||
ace.provide("ace.KeyBinding");
|
ace.provide("ace.KeyBinding");
|
||||||
|
|
||||||
(function() {
|
|
||||||
|
|
||||||
var keys = {
|
|
||||||
UP : 38,
|
|
||||||
RIGHT : 39,
|
|
||||||
DOWN : 40,
|
|
||||||
LEFT : 37,
|
|
||||||
PAGEUP : 33,
|
|
||||||
PAGEDOWN : 34,
|
|
||||||
POS1 : 36,
|
|
||||||
END : 35,
|
|
||||||
DELETE : 46,
|
|
||||||
BACKSPACE : 8,
|
|
||||||
TAB : 9,
|
|
||||||
A : 65,
|
|
||||||
D: 68,
|
|
||||||
L: 76,
|
|
||||||
"7": 55
|
|
||||||
};
|
|
||||||
|
|
||||||
ace.KeyBinding = function(element, editor) {
|
ace.KeyBinding = function(element, editor) {
|
||||||
|
|
||||||
|
var keys = this.keys;
|
||||||
|
|
||||||
ace.addListener(element, "keydown", function(e) {
|
ace.addListener(element, "keydown", function(e) {
|
||||||
var key = e.keyCode;
|
var key = e.keyCode;
|
||||||
var selection = editor.getSelection();
|
var selection = editor.getSelection();
|
||||||
|
|
@ -198,4 +181,22 @@ ace.KeyBinding = function(element, editor) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
(function() {
|
||||||
|
this.keys = {
|
||||||
|
UP : 38,
|
||||||
|
RIGHT : 39,
|
||||||
|
DOWN : 40,
|
||||||
|
LEFT : 37,
|
||||||
|
PAGEUP : 33,
|
||||||
|
PAGEDOWN : 34,
|
||||||
|
POS1 : 36,
|
||||||
|
END : 35,
|
||||||
|
DELETE : 46,
|
||||||
|
BACKSPACE : 8,
|
||||||
|
TAB : 9,
|
||||||
|
A : 65,
|
||||||
|
D: 68,
|
||||||
|
L: 76,
|
||||||
|
"7": 55
|
||||||
|
};
|
||||||
|
}).call(ace.KeyBinding.prototype);
|
||||||
|
|
|
||||||
|
|
@ -17,24 +17,28 @@ ace.ScrollBar = function(parent) {
|
||||||
ace.addListener(this.element, "scroll", ace.bind(this.onScroll, this));
|
ace.addListener(this.element, "scroll", ace.bind(this.onScroll, this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
ace.mixin(ace.ScrollBar.prototype, ace.MEventEmitter);
|
ace.mixin(ace.ScrollBar.prototype, ace.MEventEmitter);
|
||||||
|
|
||||||
ace.ScrollBar.prototype.onScroll = function() {
|
this.onScroll = function() {
|
||||||
this.$dispatchEvent("scroll", {data: this.element.scrollTop});
|
this.$dispatchEvent("scroll", {data: this.element.scrollTop});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.ScrollBar.prototype.getWidth = function() {
|
this.getWidth = function() {
|
||||||
return this.width;
|
return this.width;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.ScrollBar.prototype.setHeight = function(height) {
|
this.setHeight = function(height) {
|
||||||
this.element.style.height = Math.max(0, height - this.width) + "px";
|
this.element.style.height = Math.max(0, height - this.width) + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.ScrollBar.prototype.setInnerHeight = function(height) {
|
this.setInnerHeight = function(height) {
|
||||||
this.inner.style.height = height + "px";
|
this.inner.style.height = height + "px";
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.ScrollBar.prototype.setScrollTop = function(scrollTop) {
|
this.setScrollTop = function(scrollTop) {
|
||||||
this.element.scrollTop = scrollTop;
|
this.element.scrollTop = scrollTop;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.ScrollBar.prototype);
|
||||||
|
|
@ -11,21 +11,24 @@ ace.Selection = function(doc) {
|
||||||
column: 0
|
column: 0
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
ace.mixin(ace.Selection.prototype, ace.MEventEmitter);
|
ace.mixin(ace.Selection.prototype, ace.MEventEmitter);
|
||||||
|
|
||||||
ace.Selection.prototype.updateCursor = function() {
|
this.updateCursor = function() {
|
||||||
this.$dispatchEvent("changeCursor", { data: this.getCursor() });
|
this.$dispatchEvent("changeCursor", { data: this.getCursor() });
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.updateSelection = function() {
|
this.updateSelection = function() {
|
||||||
this.$dispatchEvent("changeSelection", {});
|
this.$dispatchEvent("changeSelection", {});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (this.selectionAnchor == null);
|
return (this.selectionAnchor == null);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.isMultiLine = function() {
|
this.isMultiLine = function() {
|
||||||
if (this.isEmpty()) {
|
if (this.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -34,17 +37,17 @@ ace.Selection.prototype.isMultiLine = function() {
|
||||||
return (range.start.row !== range.end.row);
|
return (range.start.row !== range.end.row);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.getCursor = function() {
|
this.getCursor = function() {
|
||||||
return this.selectionLead;
|
return this.selectionLead;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.setSelectionAnchor = function(row, column) {
|
this.setSelectionAnchor = function(row, column) {
|
||||||
this.clearSelection();
|
this.clearSelection();
|
||||||
|
|
||||||
this.selectionAnchor = this._clipPositionToDocument(row, column);
|
this.selectionAnchor = this._clipPositionToDocument(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.getSelectionAnchor = function() {
|
this.getSelectionAnchor = function() {
|
||||||
if (this.selectionAnchor) {
|
if (this.selectionAnchor) {
|
||||||
return this._clone(this.selectionAnchor);
|
return this._clone(this.selectionAnchor);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -52,11 +55,11 @@ ace.Selection.prototype.getSelectionAnchor = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.getSelectionLead = function() {
|
this.getSelectionLead = function() {
|
||||||
return this._clone(this.selectionLead);
|
return this._clone(this.selectionLead);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.shiftSelection = function(columns) {
|
this.shiftSelection = function(columns) {
|
||||||
if (this.isEmpty()) {
|
if (this.isEmpty()) {
|
||||||
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
|
this.moveCursorTo(this.selectionLead.row, this.selectionLead.column + columns);
|
||||||
return;
|
return;
|
||||||
|
|
@ -71,7 +74,7 @@ ace.Selection.prototype.shiftSelection = function(columns) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.getRange = function() {
|
this.getRange = function() {
|
||||||
var anchor = this.selectionAnchor || this.selectionLead;
|
var anchor = this.selectionAnchor || this.selectionLead;
|
||||||
var lead = this.selectionLead;
|
var lead = this.selectionLead;
|
||||||
|
|
||||||
|
|
@ -90,13 +93,13 @@ ace.Selection.prototype.getRange = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.clearSelection = function() {
|
this.clearSelection = function() {
|
||||||
this.selectionAnchor = null;
|
this.selectionAnchor = null;
|
||||||
this.updateSelection();
|
this.updateSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Selection.prototype.selectAll = function() {
|
this.selectAll = function() {
|
||||||
var lastRow = this.doc.getLength() - 1;
|
var lastRow = this.doc.getLength() - 1;
|
||||||
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
|
||||||
|
|
||||||
|
|
@ -105,7 +108,7 @@ ace.Selection.prototype.selectAll = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype._moveSelection = function(mover) {
|
this._moveSelection = function(mover) {
|
||||||
if (!this.selectionAnchor) {
|
if (!this.selectionAnchor) {
|
||||||
this.selectionAnchor = this._clone(this.selectionLead);
|
this.selectionAnchor = this._clone(this.selectionLead);
|
||||||
}
|
}
|
||||||
|
|
@ -114,43 +117,43 @@ ace.Selection.prototype._moveSelection = function(mover) {
|
||||||
this.updateSelection();
|
this.updateSelection();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectTo = function(row, column) {
|
this.selectTo = function(row, column) {
|
||||||
this._moveSelection(function() {
|
this._moveSelection(function() {
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectToPosition = function(pos) {
|
this.selectToPosition = function(pos) {
|
||||||
this._moveSelection(function() {
|
this._moveSelection(function() {
|
||||||
this.moveCursorToPosition(pos);
|
this.moveCursorToPosition(pos);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectUp = function() {
|
this.selectUp = function() {
|
||||||
this._moveSelection(this.moveCursorUp);
|
this._moveSelection(this.moveCursorUp);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectDown = function() {
|
this.selectDown = function() {
|
||||||
this._moveSelection(this.moveCursorDown);
|
this._moveSelection(this.moveCursorDown);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectRight = function() {
|
this.selectRight = function() {
|
||||||
this._moveSelection(this.moveCursorRight);
|
this._moveSelection(this.moveCursorRight);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectLeft = function() {
|
this.selectLeft = function() {
|
||||||
this._moveSelection(this.moveCursorLeft);
|
this._moveSelection(this.moveCursorLeft);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectLineStart = function() {
|
this.selectLineStart = function() {
|
||||||
this._moveSelection(this.moveCursorLineStart);
|
this._moveSelection(this.moveCursorLineStart);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectLineEnd = function() {
|
this.selectLineEnd = function() {
|
||||||
this._moveSelection(this.moveCursorLineEnd);
|
this._moveSelection(this.moveCursorLineEnd);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectPageDown = function() {
|
this.selectPageDown = function() {
|
||||||
var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2);
|
var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2);
|
||||||
|
|
||||||
this.scrollPageDown();
|
this.scrollPageDown();
|
||||||
|
|
@ -160,7 +163,7 @@ ace.Selection.prototype.selectPageDown = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectPageUp = function() {
|
this.selectPageUp = function() {
|
||||||
var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow();
|
var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow();
|
||||||
var row = this.getPageUpRow() + Math.round(visibleRows / 2);
|
var row = this.getPageUpRow() + Math.round(visibleRows / 2);
|
||||||
|
|
||||||
|
|
@ -171,26 +174,26 @@ ace.Selection.prototype.selectPageUp = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectFileEnd = function() {
|
this.selectFileEnd = function() {
|
||||||
this._moveSelection(this.moveCursorFileEnd);
|
this._moveSelection(this.moveCursorFileEnd);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectFileStart = function() {
|
this.selectFileStart = function() {
|
||||||
this._moveSelection(this.moveCursorFileStart);
|
this._moveSelection(this.moveCursorFileStart);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.tokenRe = /^[\w\d]+/g;
|
this.tokenRe = /^[\w\d]+/g;
|
||||||
ace.Selection.prototype.nonTokenRe = /^[^\w\d]+/g;
|
this.nonTokenRe = /^[^\w\d]+/g;
|
||||||
|
|
||||||
ace.Selection.prototype.selectWordRight = function() {
|
this.selectWordRight = function() {
|
||||||
this._moveSelection(this.moveCursorWordRight);
|
this._moveSelection(this.moveCursorWordRight);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectWordLeft = function() {
|
this.selectWordLeft = function() {
|
||||||
this._moveSelection(this.moveCursorWordLeft);
|
this._moveSelection(this.moveCursorWordLeft);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectWord = function() {
|
this.selectWord = function() {
|
||||||
var cursor = this.selectionLead;
|
var cursor = this.selectionLead;
|
||||||
|
|
||||||
var line = this.doc.getLine(cursor.row);
|
var line = this.doc.getLine(cursor.row);
|
||||||
|
|
@ -227,22 +230,22 @@ ace.Selection.prototype.selectWord = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.selectLine = function() {
|
this.selectLine = function() {
|
||||||
this.setSelectionAnchor(this.selectionLead.row, 0);
|
this.setSelectionAnchor(this.selectionLead.row, 0);
|
||||||
this._moveSelection(function() {
|
this._moveSelection(function() {
|
||||||
this.moveCursorTo(this.selectionLead.row + 1, 0);
|
this.moveCursorTo(this.selectionLead.row + 1, 0);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorUp = function() {
|
this.moveCursorUp = function() {
|
||||||
this.moveCursorBy(-1, 0);
|
this.moveCursorBy(-1, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorDown = function() {
|
this.moveCursorDown = function() {
|
||||||
this.moveCursorBy(1, 0);
|
this.moveCursorBy(1, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorLeft = function() {
|
this.moveCursorLeft = function() {
|
||||||
if (this.selectionLead.column == 0) {
|
if (this.selectionLead.column == 0) {
|
||||||
if (this.selectionLead.row > 0) {
|
if (this.selectionLead.row > 0) {
|
||||||
this.moveCursorTo(this.selectionLead.row - 1, this.doc
|
this.moveCursorTo(this.selectionLead.row - 1, this.doc
|
||||||
|
|
@ -254,7 +257,7 @@ ace.Selection.prototype.moveCursorLeft = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorRight = function() {
|
this.moveCursorRight = function() {
|
||||||
if (this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) {
|
if (this.selectionLead.column == this.doc.getLine(this.selectionLead.row).length) {
|
||||||
if (this.selectionLead.row < this.doc.getLength() - 1) {
|
if (this.selectionLead.row < this.doc.getLength() - 1) {
|
||||||
this.moveCursorTo(this.selectionLead.row + 1, 0);
|
this.moveCursorTo(this.selectionLead.row + 1, 0);
|
||||||
|
|
@ -265,26 +268,26 @@ ace.Selection.prototype.moveCursorRight = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorLineStart = function() {
|
this.moveCursorLineStart = function() {
|
||||||
this.moveCursorTo(this.selectionLead.row, 0);
|
this.moveCursorTo(this.selectionLead.row, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorLineEnd = function() {
|
this.moveCursorLineEnd = function() {
|
||||||
this.moveCursorTo(this.selectionLead.row,
|
this.moveCursorTo(this.selectionLead.row,
|
||||||
this.doc.getLine(this.selectionLead.row).length);
|
this.doc.getLine(this.selectionLead.row).length);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorFileEnd = function() {
|
this.moveCursorFileEnd = function() {
|
||||||
var row = this.doc.getLength() - 1;
|
var row = this.doc.getLength() - 1;
|
||||||
var column = this.doc.getLine(row).length;
|
var column = this.doc.getLine(row).length;
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorFileStart = function() {
|
this.moveCursorFileStart = function() {
|
||||||
this.moveCursorTo(0, 0);
|
this.moveCursorTo(0, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorWordRight = function() {
|
this.moveCursorWordRight = function() {
|
||||||
var row = this.selectionLead.row;
|
var row = this.selectionLead.row;
|
||||||
var column = this.selectionLead.column;
|
var column = this.selectionLead.column;
|
||||||
var line = this.doc.getLine(row);
|
var line = this.doc.getLine(row);
|
||||||
|
|
@ -310,7 +313,7 @@ ace.Selection.prototype.moveCursorWordRight = function() {
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorWordLeft = function() {
|
this.moveCursorWordLeft = function() {
|
||||||
var row = this.selectionLead.row;
|
var row = this.selectionLead.row;
|
||||||
var column = this.selectionLead.column;
|
var column = this.selectionLead.column;
|
||||||
var line = this.doc.getLine(row);
|
var line = this.doc.getLine(row);
|
||||||
|
|
@ -336,25 +339,25 @@ ace.Selection.prototype.moveCursorWordLeft = function() {
|
||||||
this.moveCursorTo(row, column);
|
this.moveCursorTo(row, column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorBy = function(rows, chars) {
|
this.moveCursorBy = function(rows, chars) {
|
||||||
this.moveCursorTo(this.selectionLead.row + rows, this.selectionLead.column + chars);
|
this.moveCursorTo(this.selectionLead.row + rows, this.selectionLead.column + chars);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorToPosition = function(position) {
|
this.moveCursorToPosition = function(position) {
|
||||||
this.moveCursorTo(position.row, position.column);
|
this.moveCursorTo(position.row, position.column);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorTo = function(row, column) {
|
this.moveCursorTo = function(row, column) {
|
||||||
this.selectionLead = this._clipPositionToDocument(row, column);
|
this.selectionLead = this._clipPositionToDocument(row, column);
|
||||||
this.updateCursor();
|
this.updateCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype.moveCursorUp = function() {
|
this.moveCursorUp = function() {
|
||||||
this.moveCursorBy(-1, 0);
|
this.moveCursorBy(-1, 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype._clipPositionToDocument = function(row, column) {
|
this._clipPositionToDocument = function(row, column) {
|
||||||
var pos = {};
|
var pos = {};
|
||||||
|
|
||||||
if (row >= this.doc.getLength()) {
|
if (row >= this.doc.getLength()) {
|
||||||
|
|
@ -373,9 +376,11 @@ ace.Selection.prototype._clipPositionToDocument = function(row, column) {
|
||||||
return pos;
|
return pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Selection.prototype._clone = function(pos) {
|
this._clone = function(pos) {
|
||||||
return {
|
return {
|
||||||
row: pos.row,
|
row: pos.row,
|
||||||
column: pos.column
|
column: pos.column
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.Selection.prototype);
|
||||||
|
|
@ -17,7 +17,9 @@ ace.Tokenizer = function(rules) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.Tokenizer.prototype.getLineTokens = function(line, startState) {
|
(function() {
|
||||||
|
|
||||||
|
this.getLineTokens = function(line, startState) {
|
||||||
var currentState = startState;
|
var currentState = startState;
|
||||||
var state = this.rules[currentState];
|
var state = this.rules[currentState];
|
||||||
var re = this.regExps[currentState];
|
var re = this.regExps[currentState];
|
||||||
|
|
@ -86,3 +88,5 @@ ace.Tokenizer.prototype.getLineTokens = function(line, startState) {
|
||||||
state : currentState
|
state : currentState
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.Tokenizer.prototype);
|
||||||
|
|
@ -38,34 +38,36 @@ ace.VirtualRenderer = function(container) {
|
||||||
this.onResize();
|
this.onResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.setDocument = function(doc) {
|
(function() {
|
||||||
|
|
||||||
|
this.setDocument = function(doc) {
|
||||||
this.lines = doc.lines;
|
this.lines = doc.lines;
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
this.markerLayer.setDocument(doc);
|
this.markerLayer.setDocument(doc);
|
||||||
this.textLayer.setTabSize(doc.getTabSize());
|
this.textLayer.setTabSize(doc.getTabSize());
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.setTokenizer = function(tokenizer) {
|
this.setTokenizer = function(tokenizer) {
|
||||||
this.textLayer.setTokenizer(tokenizer);
|
this.textLayer.setTokenizer(tokenizer);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.getContainerElement = function() {
|
this.getContainerElement = function() {
|
||||||
return this.container;
|
return this.container;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.getMouseEventTarget = function() {
|
this.getMouseEventTarget = function() {
|
||||||
return this.scroller;
|
return this.scroller;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.getFirstVisibleRow = function() {
|
this.getFirstVisibleRow = function() {
|
||||||
return this.layerConfig.firstRow || 0;
|
return this.layerConfig.firstRow || 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.getLastVisibleRow = function() {
|
this.getLastVisibleRow = function() {
|
||||||
return this.layerConfig.lastRow || 0;
|
return this.layerConfig.lastRow || 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.onResize = function()
|
this.onResize = function()
|
||||||
{
|
{
|
||||||
var height = ace.getInnerHeight(this.container);
|
var height = ace.getInnerHeight(this.container);
|
||||||
this.gutter.style.height = height + "px";
|
this.gutter.style.height = height + "px";
|
||||||
|
|
@ -84,16 +86,16 @@ ace.VirtualRenderer.prototype.onResize = function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.onScroll = function(e) {
|
this.onScroll = function(e) {
|
||||||
this.scrollToY(e.data);
|
this.scrollToY(e.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype._updateScrollBar = function() {
|
this._updateScrollBar = function() {
|
||||||
this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight);
|
this.scrollBar.setInnerHeight(this.doc.getLength() * this.lineHeight);
|
||||||
this.scrollBar.setScrollTop(this.scrollTop);
|
this.scrollBar.setScrollTop(this.scrollTop);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.updateLines = function(firstRow, lastRow) {
|
this.updateLines = function(firstRow, lastRow) {
|
||||||
var layerConfig = this.layerConfig;
|
var layerConfig = this.layerConfig;
|
||||||
|
|
||||||
if (firstRow > layerConfig.lastRow + 1) { return; }
|
if (firstRow > layerConfig.lastRow + 1) { return; }
|
||||||
|
|
@ -109,7 +111,7 @@ ace.VirtualRenderer.prototype.updateLines = function(firstRow, lastRow) {
|
||||||
this.textLayer.updateLines(layerConfig, firstRow, lastRow);
|
this.textLayer.updateLines(layerConfig, firstRow, lastRow);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.draw = function() {
|
this.draw = function() {
|
||||||
var lines = this.lines;
|
var lines = this.lines;
|
||||||
|
|
||||||
var offset = this.scrollTop % this.lineHeight;
|
var offset = this.scrollTop % this.lineHeight;
|
||||||
|
|
@ -147,28 +149,28 @@ ace.VirtualRenderer.prototype.draw = function() {
|
||||||
this._updateScrollBar();
|
this._updateScrollBar();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.addMarker = function(range, clazz, type) {
|
this.addMarker = function(range, clazz, type) {
|
||||||
return this.markerLayer.addMarker(range, clazz, type);
|
return this.markerLayer.addMarker(range, clazz, type);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.removeMarker = function(markerId) {
|
this.removeMarker = function(markerId) {
|
||||||
this.markerLayer.removeMarker(markerId);
|
this.markerLayer.removeMarker(markerId);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.updateCursor = function(position) {
|
this.updateCursor = function(position) {
|
||||||
this.cursorLayer.setCursor(position);
|
this.cursorLayer.setCursor(position);
|
||||||
this.cursorLayer.update(this.layerConfig);
|
this.cursorLayer.update(this.layerConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.hideCursor = function() {
|
this.hideCursor = function() {
|
||||||
this.cursorLayer.hideCursor();
|
this.cursorLayer.hideCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.showCursor = function() {
|
this.showCursor = function() {
|
||||||
this.cursorLayer.showCursor();
|
this.cursorLayer.showCursor();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.scrollCursorIntoView = function() {
|
this.scrollCursorIntoView = function() {
|
||||||
var pos = this.cursorLayer.getPixelPosition();
|
var pos = this.cursorLayer.getPixelPosition();
|
||||||
|
|
||||||
var left = pos.left;
|
var left = pos.left;
|
||||||
|
|
@ -194,19 +196,19 @@ ace.VirtualRenderer.prototype.scrollCursorIntoView = function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.getScrollTop = function() {
|
this.getScrollTop = function() {
|
||||||
return this.scrollTop;
|
return this.scrollTop;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.getScrollTopRow = function() {
|
this.getScrollTopRow = function() {
|
||||||
return this.scrollTop / this.lineHeight;
|
return this.scrollTop / this.lineHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.scrollToRow = function(row) {
|
this.scrollToRow = function(row) {
|
||||||
this.scrollToY(row * this.lineHeight);
|
this.scrollToY(row * this.lineHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.scrollToY = function(scrollTop) {
|
this.scrollToY = function(scrollTop) {
|
||||||
var maxHeight = this.lines.length * this.lineHeight
|
var maxHeight = this.lines.length * this.lineHeight
|
||||||
- this.scroller.clientHeight;
|
- this.scroller.clientHeight;
|
||||||
var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop));
|
var scrollTop = Math.max(0, Math.min(maxHeight, scrollTop));
|
||||||
|
|
@ -218,7 +220,7 @@ ace.VirtualRenderer.prototype.scrollToY = function(scrollTop) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.screenToTextCoordinates = function(pageX, pageY) {
|
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||||
var canvasPos = this.scroller.getBoundingClientRect();
|
var canvasPos = this.scroller.getBoundingClientRect();
|
||||||
|
|
||||||
var col = Math.floor((pageX + this.scroller.scrollLeft - canvasPos.left)
|
var col = Math.floor((pageX + this.scroller.scrollLeft - canvasPos.left)
|
||||||
|
|
@ -232,19 +234,21 @@ ace.VirtualRenderer.prototype.screenToTextCoordinates = function(pageX, pageY) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.visualizeFocus = function() {
|
this.visualizeFocus = function() {
|
||||||
ace.addCssClass(this.container, "focus");
|
ace.addCssClass(this.container, "focus");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.visualizeBlur = function() {
|
this.visualizeBlur = function() {
|
||||||
ace.removeCssClass(this.container, "focus");
|
ace.removeCssClass(this.container, "focus");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.showComposition = function(position) {
|
this.showComposition = function(position) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.setCompositionText = function(text) {
|
this.setCompositionText = function(text) {
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.VirtualRenderer.prototype.hideComposition = function() {
|
this.hideComposition = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.VirtualRenderer.prototype);
|
||||||
|
|
@ -11,14 +11,16 @@ ace.layer.Cursor = function(parentEl) {
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Cursor.prototype.setCursor = function(position) {
|
(function() {
|
||||||
|
|
||||||
|
this.setCursor = function(position) {
|
||||||
this.position = {
|
this.position = {
|
||||||
row : position.row,
|
row : position.row,
|
||||||
column : position.column
|
column : position.column
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Cursor.prototype.hideCursor = function() {
|
this.hideCursor = function() {
|
||||||
this.isVisible = false;
|
this.isVisible = false;
|
||||||
if (this.cursor.parentNode) {
|
if (this.cursor.parentNode) {
|
||||||
this.cursor.parentNode.removeChild(this.cursor);
|
this.cursor.parentNode.removeChild(this.cursor);
|
||||||
|
|
@ -26,7 +28,7 @@ ace.layer.Cursor.prototype.hideCursor = function() {
|
||||||
clearInterval(this.blinkId);
|
clearInterval(this.blinkId);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Cursor.prototype.showCursor = function() {
|
this.showCursor = function() {
|
||||||
this.isVisible = true;
|
this.isVisible = true;
|
||||||
this.element.appendChild(this.cursor);
|
this.element.appendChild(this.cursor);
|
||||||
|
|
||||||
|
|
@ -35,7 +37,7 @@ ace.layer.Cursor.prototype.showCursor = function() {
|
||||||
this.restartTimer();
|
this.restartTimer();
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Cursor.prototype.restartTimer = function() {
|
this.restartTimer = function() {
|
||||||
clearInterval(this.blinkId);
|
clearInterval(this.blinkId);
|
||||||
if (!this.isVisible) {
|
if (!this.isVisible) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -50,14 +52,14 @@ ace.layer.Cursor.prototype.restartTimer = function() {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Cursor.prototype.getPixelPosition = function() {
|
this.getPixelPosition = function() {
|
||||||
return this.pixelPos || {
|
return this.pixelPos || {
|
||||||
left : 0,
|
left : 0,
|
||||||
top : 0
|
top : 0
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Cursor.prototype.update = function(config) {
|
this.update = function(config) {
|
||||||
if (!this.position)
|
if (!this.position)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -79,3 +81,5 @@ ace.layer.Cursor.prototype.update = function(config) {
|
||||||
}
|
}
|
||||||
this.restartTimer();
|
this.restartTimer();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.layer.Cursor.prototype);
|
||||||
|
|
@ -6,7 +6,9 @@ ace.layer.Gutter = function(parentEl) {
|
||||||
parentEl.appendChild(this.element);
|
parentEl.appendChild(this.element);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Gutter.prototype.update = function(config) {
|
(function() {
|
||||||
|
|
||||||
|
this.update = function(config) {
|
||||||
var html = [];
|
var html = [];
|
||||||
for ( var i = config.firstRow; i <= config.lastRow; i++) {
|
for ( var i = config.firstRow; i <= config.lastRow; i++) {
|
||||||
html.push("<div class='gutter-cell' style='height:" + config.lineHeight
|
html.push("<div class='gutter-cell' style='height:" + config.lineHeight
|
||||||
|
|
@ -16,3 +18,5 @@ ace.layer.Gutter.prototype.update = function(config) {
|
||||||
|
|
||||||
this.element.innerHTML = html.join("");
|
this.element.innerHTML = html.join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.layer.Gutter.prototype);
|
||||||
|
|
@ -9,11 +9,13 @@ ace.layer.Marker = function(parentEl) {
|
||||||
this._markerId = 1;
|
this._markerId = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.setDocument = function(doc) {
|
(function() {
|
||||||
|
|
||||||
|
this.setDocument = function(doc) {
|
||||||
this.doc = doc;
|
this.doc = doc;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.addMarker = function(range, clazz, type) {
|
this.addMarker = function(range, clazz, type) {
|
||||||
var id = this._markerId++;
|
var id = this._markerId++;
|
||||||
this.markers[id] = {
|
this.markers[id] = {
|
||||||
range : range,
|
range : range,
|
||||||
|
|
@ -25,7 +27,7 @@ ace.layer.Marker.prototype.addMarker = function(range, clazz, type) {
|
||||||
return id;
|
return id;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.removeMarker = function(markerId) {
|
this.removeMarker = function(markerId) {
|
||||||
var marker = this.markers[markerId];
|
var marker = this.markers[markerId];
|
||||||
if (marker) {
|
if (marker) {
|
||||||
delete (this.markers[markerId]);
|
delete (this.markers[markerId]);
|
||||||
|
|
@ -33,7 +35,7 @@ ace.layer.Marker.prototype.removeMarker = function(markerId) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.update = function(config) {
|
this.update = function(config) {
|
||||||
var config = config || this.config;
|
var config = config || this.config;
|
||||||
if (!config)
|
if (!config)
|
||||||
return;
|
return;
|
||||||
|
|
@ -80,7 +82,7 @@ ace.layer.Marker.prototype.update = function(config) {
|
||||||
this.element.innerHTML = html.join("");
|
this.element.innerHTML = html.join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
|
||||||
|
|
||||||
// selection start
|
// selection start
|
||||||
var row = range.start.row;
|
var row = range.start.row;
|
||||||
|
|
@ -108,7 +110,7 @@ ace.layer.Marker.prototype.drawTextMarker = function(stringBuilder, range, clazz
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig) {
|
this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig) {
|
||||||
|
|
||||||
var height = layerConfig.lineHeight;
|
var height = layerConfig.lineHeight;
|
||||||
var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
|
var width = Math.round(layerConfig.width - (range.start.column * layerConfig.characterWidth));
|
||||||
|
|
@ -144,7 +146,7 @@ ace.layer.Marker.prototype.drawMultiLineMarker = function(stringBuilder, range,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Marker.prototype.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig) {
|
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig) {
|
||||||
|
|
||||||
var height = layerConfig.lineHeight;
|
var height = layerConfig.lineHeight;
|
||||||
var width = Math.round((range.end.column - range.start.column) * layerConfig.characterWidth);
|
var width = Math.round((range.end.column - range.start.column) * layerConfig.characterWidth);
|
||||||
|
|
@ -159,3 +161,5 @@ ace.layer.Marker.prototype.drawSingleLineMarker = function(stringBuilder, range,
|
||||||
"left:", left,"px;'></div>"
|
"left:", left,"px;'></div>"
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.layer.Marker.prototype);
|
||||||
|
|
@ -9,19 +9,21 @@ ace.layer.Text = function(parentEl) {
|
||||||
this._tabString = " ";
|
this._tabString = " ";
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.setTokenizer = function(tokenizer) {
|
(function() {
|
||||||
|
|
||||||
|
this.setTokenizer = function(tokenizer) {
|
||||||
this.tokenizer = tokenizer;
|
this.tokenizer = tokenizer;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.getLineHeight = function() {
|
this.getLineHeight = function() {
|
||||||
return this.lineHeight;
|
return this.lineHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.getCharacterWidth = function() {
|
this.getCharacterWidth = function() {
|
||||||
return this.characterWidth;
|
return this.characterWidth;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype._measureSizes = function() {
|
this._measureSizes = function() {
|
||||||
var measureNode = document.createElement("div");
|
var measureNode = document.createElement("div");
|
||||||
var style = measureNode.style;
|
var style = measureNode.style;
|
||||||
style.width = style.height = "auto";
|
style.width = style.height = "auto";
|
||||||
|
|
@ -42,11 +44,11 @@ ace.layer.Text.prototype._measureSizes = function() {
|
||||||
this.element.removeChild(measureNode);
|
this.element.removeChild(measureNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.setTabSize = function(tabSize) {
|
this.setTabSize = function(tabSize) {
|
||||||
this._tabString = new Array(tabSize+1).join(" ");
|
this._tabString = new Array(tabSize+1).join(" ");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.updateLines = function(layerConfig, firstRow, lastRow) {
|
this.updateLines = function(layerConfig, firstRow, lastRow) {
|
||||||
var first = Math.max(firstRow, layerConfig.firstRow);
|
var first = Math.max(firstRow, layerConfig.firstRow);
|
||||||
var last = Math.min(lastRow, layerConfig.lastRow);
|
var last = Math.min(lastRow, layerConfig.lastRow);
|
||||||
|
|
||||||
|
|
@ -61,7 +63,7 @@ ace.layer.Text.prototype.updateLines = function(layerConfig, firstRow, lastRow)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.update = function(config) {
|
this.update = function(config) {
|
||||||
var html = [];
|
var html = [];
|
||||||
for ( var i = config.firstRow; i <= config.lastRow; i++) {
|
for ( var i = config.firstRow; i <= config.lastRow; i++) {
|
||||||
html.push("<div class='line' style='height:" + this.lineHeight + "px;", "width:",
|
html.push("<div class='line' style='height:" + this.lineHeight + "px;", "width:",
|
||||||
|
|
@ -72,7 +74,7 @@ ace.layer.Text.prototype.update = function(config) {
|
||||||
this.element.innerHTML = html.join("");
|
this.element.innerHTML = html.join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.layer.Text.prototype.renderLine = function(stringBuilder, row) {
|
this.renderLine = function(stringBuilder, row) {
|
||||||
var tokens = this.tokenizer.getTokens(row);
|
var tokens = this.tokenizer.getTokens(row);
|
||||||
for ( var i = 0; i < tokens.length; i++) {
|
for ( var i = 0; i < tokens.length; i++) {
|
||||||
var token = tokens[i];
|
var token = tokens[i];
|
||||||
|
|
@ -80,6 +82,7 @@ ace.layer.Text.prototype.renderLine = function(stringBuilder, row) {
|
||||||
var output = token.value
|
var output = token.value
|
||||||
.replace(/&/g, "&")
|
.replace(/&/g, "&")
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
|
//.replace(/\t/g, "‣ ")
|
||||||
.replace(/\t/g, this._tabString)
|
.replace(/\t/g, this._tabString)
|
||||||
.replace(/\s/g, " ");
|
.replace(/\s/g, " ");
|
||||||
|
|
||||||
|
|
@ -91,4 +94,8 @@ ace.layer.Text.prototype.renderLine = function(stringBuilder, row) {
|
||||||
stringBuilder.push(output);
|
stringBuilder.push(output);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// TODO: show invisibles
|
||||||
|
//stringBuilder.push("¶");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.layer.Text.prototype);
|
||||||
|
|
@ -5,7 +5,9 @@ ace.mode.Css = function() {
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.Css, ace.mode.Text);
|
ace.inherits(ace.mode.Css, ace.mode.Text);
|
||||||
|
|
||||||
ace.mode.Css.prototype.getNextLineIndent = function(line, state, tab) {
|
(function() {
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(line, state, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
// ignore braces in comments
|
// ignore braces in comments
|
||||||
|
|
@ -21,3 +23,5 @@ ace.mode.Css.prototype.getNextLineIndent = function(line, state, tab) {
|
||||||
|
|
||||||
return indent;
|
return indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.Css.prototype);
|
||||||
|
|
@ -175,6 +175,10 @@ ace.mode.CssHighlightRules = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.CssHighlightRules.prototype.getRules = function() {
|
(function() {
|
||||||
|
|
||||||
|
this.getRules = function() {
|
||||||
return this._rules;
|
return this._rules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.CssHighlightRules.prototype);
|
||||||
|
|
@ -8,7 +8,9 @@ ace.mode.Html = function() {
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.Html, ace.mode.Text);
|
ace.inherits(ace.mode.Html, ace.mode.Text);
|
||||||
|
|
||||||
ace.mode.Html.prototype.toggleCommentLines = function(doc, range, state) {
|
(function() {
|
||||||
|
|
||||||
|
this.toggleCommentLines = function(doc, range, state) {
|
||||||
var split = state.split("js-");
|
var split = state.split("js-");
|
||||||
if (!split[0] && split[1]) {
|
if (!split[0] && split[1]) {
|
||||||
return this._js.toggleCommentLines(doc, range, state);
|
return this._js.toggleCommentLines(doc, range, state);
|
||||||
|
|
@ -22,7 +24,7 @@ ace.mode.Html.prototype.toggleCommentLines = function(doc, range, state) {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.Html.prototype.getNextLineIndent = function(line, state, tab) {
|
this.getNextLineIndent = function(line, state, tab) {
|
||||||
var split = state.split("js-");
|
var split = state.split("js-");
|
||||||
if (!split[0] && split[1]) {
|
if (!split[0] && split[1]) {
|
||||||
return this._js.getNextLineIndent(line, split[1], tab);
|
return this._js.getNextLineIndent(line, split[1], tab);
|
||||||
|
|
@ -35,3 +37,5 @@ ace.mode.Html.prototype.getNextLineIndent = function(line, state, tab) {
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.Html.prototype);
|
||||||
|
|
@ -130,8 +130,9 @@ ace.mode.HtmlHighlightRules = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
ace.mode.HtmlHighlightRules.prototype._addRules = function(rules, prefix) {
|
this._addRules = function(rules, prefix) {
|
||||||
for (var key in rules) {
|
for (var key in rules) {
|
||||||
var state = rules[key];
|
var state = rules[key];
|
||||||
for (var i=0; i<state.length; i++) {
|
for (var i=0; i<state.length; i++) {
|
||||||
|
|
@ -144,6 +145,8 @@ ace.mode.HtmlHighlightRules.prototype._addRules = function(rules, prefix) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.HtmlHighlightRules.prototype.getRules = function() {
|
this.getRules = function() {
|
||||||
return this._rules;
|
return this._rules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.HtmlHighlightRules.prototype);
|
||||||
|
|
@ -5,7 +5,9 @@ ace.mode.JavaScript = function() {
|
||||||
};
|
};
|
||||||
ace.inherits(ace.mode.JavaScript, ace.mode.Text);
|
ace.inherits(ace.mode.JavaScript, ace.mode.Text);
|
||||||
|
|
||||||
ace.mode.JavaScript.prototype.toggleCommentLines = function(doc, range, state) {
|
(function() {
|
||||||
|
|
||||||
|
this.toggleCommentLines = function(doc, range, state) {
|
||||||
var addedRows = doc.outdentRows(range, "//");
|
var addedRows = doc.outdentRows(range, "//");
|
||||||
if (addedRows == 0) {
|
if (addedRows == 0) {
|
||||||
var addedRows = doc.indentRows(range, "//");
|
var addedRows = doc.indentRows(range, "//");
|
||||||
|
|
@ -13,7 +15,7 @@ ace.mode.JavaScript.prototype.toggleCommentLines = function(doc, range, state) {
|
||||||
return addedRows;
|
return addedRows;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.JavaScript.prototype.getNextLineIndent = function(line, state, tab) {
|
this.getNextLineIndent = function(line, state, tab) {
|
||||||
var indent = this.$getIndent(line);
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
|
||||||
|
|
@ -44,3 +46,5 @@ ace.mode.JavaScript.prototype.getNextLineIndent = function(line, state, tab) {
|
||||||
|
|
||||||
return indent;
|
return indent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.JavaScript.prototype);
|
||||||
|
|
@ -127,6 +127,10 @@ ace.mode.JavaScriptHighlightRules = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.JavaScriptHighlightRules.prototype.getRules = function() {
|
(function() {
|
||||||
|
|
||||||
|
this.getRules = function() {
|
||||||
return this._rules;
|
return this._rules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.JavaScriptHighlightRules.prototype);
|
||||||
|
|
@ -10,19 +10,21 @@ ace.mode.Text = function() {
|
||||||
this.$tokenizer = new ace.Tokenizer(rules);
|
this.$tokenizer = new ace.Tokenizer(rules);
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.Text.prototype.getTokenizer = function() {
|
(function() {
|
||||||
|
|
||||||
|
this.getTokenizer = function() {
|
||||||
return this.$tokenizer;
|
return this.$tokenizer;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.Text.prototype.toggleCommentLines = function(doc, range, state) {
|
this.toggleCommentLines = function(doc, range, state) {
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.Text.prototype.getNextLineIndent = function(line, state, tab) {
|
this.getNextLineIndent = function(line, state, tab) {
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.Text.prototype.$getIndent = function(line) {
|
this.$getIndent = function(line) {
|
||||||
var match = line.match(/^(\s+)/);
|
var match = line.match(/^(\s+)/);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match[1];
|
return match[1];
|
||||||
|
|
@ -30,3 +32,5 @@ ace.mode.Text.prototype.$getIndent = function(line) {
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.Text.prototype);
|
||||||
|
|
@ -70,6 +70,10 @@ ace.mode.XmlHighlightRules = function() {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ace.mode.XmlHighlightRules.prototype.getRules = function() {
|
(function() {
|
||||||
|
|
||||||
|
this.getRules = function() {
|
||||||
return this._rules;
|
return this._rules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}).call(ace.mode.XmlHighlightRules.prototype);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue