Merge branch 'master' of github.com:mozilla/ace

Conflicts:
	support/cockpit
This commit is contained in:
Joe Walker 2011-04-27 11:27:52 +01:00
Родитель dd2f865b96 4baac2ff36
Коммит 6cee229d72
20 изменённых файлов: 1183 добавлений и 91 удалений

Просмотреть файл

@ -164,7 +164,7 @@ exports.launch = function(env) {
c_cpp: new CCPPMode(),
coffee: new CoffeeMode(),
perl: new PerlMode(),
csharp: new CSharpMode()
csharp: new CSharpMode()
};
function getMode() {

Двоичные данные
doc/Contributor_License_Agreement-v2.pdf Normal file

Двоичный файл не отображается.

Двоичные данные
doc/Corporate_Contributor_License_Agreement-v2.pdf Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -47,6 +47,8 @@
<option value="ace/theme/merbivore">Merbivore</option>
<option value="ace/theme/merbivore_soft">Merbivore Soft</option>
<option value="ace/theme/vibrant_ink">Vibrant Ink</option>
<option value="ace/theme/solarized_dark">Solarized Dark</option>
<option value="ace/theme/solarized_light">Solarized Light</option>
</select>
</td>
<td align="right">

Просмотреть файл

@ -56,7 +56,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
var doc = self.doc;
var processedLines = 0;
var lastVisibleRow = editor.getLastVisibleRow();
var len = doc.getLength();
while (self.currentLine < len) {
@ -67,9 +66,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
processedLines += 1;
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
self.fireUpdateEvent(startLine, self.currentLine-1);
var timeout = self.currentLine < lastVisibleRow ? 20 : 100;
self.running = setTimeout(self.$worker, timeout);
self.running = setTimeout(self.$worker, 20);
return;
}
}

Просмотреть файл

@ -46,6 +46,7 @@ var Selection = require("ace/selection").Selection;
var TextMode = require("ace/mode/text").Mode;
var Range = require("ace/range").Range;
var Document = require("ace/document").Document;
var BackgroundTokenizer = require("ace/background_tokenizer").BackgroundTokenizer;
var EditSession = function(text, mode) {
this.$modified = true;
@ -64,6 +65,8 @@ var EditSession = function(text, mode) {
this.selection = new Selection(this);
if (mode)
this.setMode(mode);
else
this.setMode(new TextMode());
};
@ -92,6 +95,8 @@ var EditSession = function(text, mode) {
}
this.$updateWrapDataOnChange(e);
this.bgTokenizer.start(delta.range.start.row);
this._dispatchEvent("change", e);
};
@ -110,6 +115,14 @@ var EditSession = function(text, mode) {
return this.selection;
};
this.getState = function(row) {
return this.bgTokenizer.getState(row);
};
this.getTokens = function(firstRow, lastRow) {
return this.bgTokenizer.getTokens(firstRow, lastRow);
};
this.setUndoManager = function(undoManager) {
this.$undoManager = undoManager;
this.$deltas = [];
@ -356,6 +369,8 @@ var EditSession = function(text, mode) {
this.$worker.terminate();
this.$worker = null;
}
this.$useWorker = useWorker;
};
this.getUseWorker = function() {
@ -369,19 +384,31 @@ var EditSession = function(text, mode) {
if (this.$worker)
this.$worker.terminate();
if (this.$useWorker && window.Worker && !require.noWorker)
if (this.$useWorker && typeof Worker !== "undefined" && !require.noWorker)
this.$worker = mode.createWorker(this);
else
this.$worker = null;
var tokenizer = mode.getTokenizer();
if (!this.bgTokenizer) {
this.bgTokenizer = new BackgroundTokenizer(tokenizer);
var _self = this;
this.bgTokenizer.addEventListener("update", function(e) {
_self._dispatchEvent("tokenizerUpdate", e);
});
} else {
this.bgTokenizer.setTokenizer(tokenizer);
}
this.bgTokenizer.setDocument(this.getDocument());
this.bgTokenizer.start(0);
this.$mode = mode;
this._dispatchEvent("changeMode");
};
this.getMode = function() {
if (!this.$mode) {
this.$mode = new TextMode();
}
return this.$mode;
};
@ -1275,7 +1302,11 @@ var EditSession = function(text, mode) {
return screenRows;
};
// For every keystroke this gets called once per char in the whole doc!!
// Wouldn't hurt to make it a bit faster for c >= 0x1100
function isFullWidth(c) {
if (c < 0x1100)
return false;
return c >= 0x1100 && c <= 0x115F ||
c >= 0x11A3 && c <= 0x11A7 ||
c >= 0x11FA && c <= 0x11FF ||

Просмотреть файл

@ -52,7 +52,6 @@ var MouseHandler = require("ace/mouse_handler").MouseHandler;
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
var EditSession = require("ace/edit_session").EditSession;
var Search = require("ace/search").Search;
var BackgroundTokenizer = require("ace/background_tokenizer").BackgroundTokenizer;
var Range = require("ace/range").Range;
var EventEmitter = require("pilot/event_emitter").EventEmitter;
@ -122,6 +121,7 @@ var Editor =function(renderer, session) {
var oldSession = this.session;
this.session.removeEventListener("change", this.$onDocumentChange);
this.session.removeEventListener("changeMode", this.$onChangeMode);
this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
@ -147,6 +147,9 @@ var Editor =function(renderer, session) {
this.$onChangeMode = this.onChangeMode.bind(this);
session.addEventListener("changeMode", this.$onChangeMode);
this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
session.addEventListener("tokeizerupdate", this.$onTokenizerUpdate);
this.$onChangeTabSize = this.renderer.updateText.bind(this.renderer);
session.addEventListener("changeTabSize", this.$onChangeTabSize);
@ -178,8 +181,6 @@ var Editor =function(renderer, session) {
this.selection.addEventListener("changeSelection", this.$onSelectionChange);
this.onChangeMode();
this.bgTokenizer.setDocument(session.getDocument());
this.bgTokenizer.start(0);
this.onCursorChange();
this.onSelectionChange();
@ -278,7 +279,6 @@ var Editor =function(renderer, session) {
var delta = e.data;
var range = delta.range;
this.bgTokenizer.start(range.start.row);
if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
var lastRow = range.end.row;
else
@ -341,7 +341,7 @@ var Editor =function(renderer, session) {
this.onCursorChange(e);
if (this.$highlightSelectedWord)
this.mode.highlightSelection(this);
this.session.getMode().highlightSelection(this);
};
this.onChangeFrontMarker = function() {
@ -361,22 +361,7 @@ var Editor =function(renderer, session) {
};
this.onChangeMode = function() {
var mode = this.session.getMode();
if (this.mode == mode)
return;
this.mode = mode;
var tokenizer = mode.getTokenizer();
if (!this.bgTokenizer) {
var onUpdate = this.onTokenizerUpdate.bind(this);
this.bgTokenizer = new BackgroundTokenizer(tokenizer, this);
this.bgTokenizer.addEventListener("update", onUpdate);
} else {
this.bgTokenizer.setTokenizer(tokenizer);
}
this.renderer.setTokenizer(this.bgTokenizer);
this.renderer.updateText()
};
this.onChangeWrapLimit = function() {
@ -410,6 +395,9 @@ var Editor =function(renderer, session) {
if (this.$readOnly)
return;
var session = this.session;
var mode = session.getMode();
var cursor = this.getCursorPosition();
text = text.replace("\t", this.session.getTabString());
@ -426,28 +414,27 @@ var Editor =function(renderer, session) {
this.clearSelection();
var lineState = this.bgTokenizer.getState(cursor.row);
var shouldOutdent = this.mode.checkOutdent(lineState, this.session.getLine(cursor.row), text);
var line = this.session.getLine(cursor.row);
var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString());
var end = this.session.insert(cursor, text);
var lineState = session.getState(cursor.row);
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
var line = session.getLine(cursor.row);
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
var end = session.insert(cursor, text);
var lineState = this.bgTokenizer.getState(cursor.row);
var lineState = session.getState(cursor.row);
// TODO disabled multiline auto indent
// possibly doing the indent before inserting the text
// if (cursor.row !== end.row) {
if (this.session.getDocument().isNewLine(text)) {
if (session.getDocument().isNewLine(text)) {
this.moveCursorTo(cursor.row+1, 0);
var size = this.session.getTabSize(),
minIndent = Number.MAX_VALUE;
var size = session.getTabSize();
var minIndent = Number.MAX_VALUE;
for (var row = cursor.row + 1; row <= end.row; ++row) {
var indent = 0;
line = this.session.getLine(row);
line = session.getLine(row);
for (var i = 0; i < line.length; ++i)
if (line.charAt(i) == '\t')
indent += size;
@ -462,18 +449,18 @@ var Editor =function(renderer, session) {
for (var row = cursor.row + 1; row <= end.row; ++row) {
var outdent = minIndent;
line = this.session.getLine(row);
line = session.getLine(row);
for (var i = 0; i < line.length && outdent > 0; ++i)
if (line.charAt(i) == '\t')
outdent -= size;
else if (line.charAt(i) == ' ')
outdent -= 1;
this.session.remove(new Range(row, 0, row, i));
session.remove(new Range(row, 0, row, i));
}
this.session.indentRows(cursor.row + 1, end.row, lineIndent);
session.indentRows(cursor.row + 1, end.row, lineIndent);
} else {
if (shouldOutdent) {
this.mode.autoOutdent(lineState, this.session, cursor.row);
mode.autoOutdent(lineState, session, cursor.row);
}
};
}
@ -538,9 +525,9 @@ var Editor =function(renderer, session) {
this.$highlightSelectedWord = shouldHighlight;
if (shouldHighlight)
this.mode.highlightSelection(this);
this.session.getMode().highlightSelection(this);
else
this.mode.clearSelectionHighlight(this);
this.session.getMode().clearSelectionHighlight(this);
};
this.getHighlightSelectedWord = function() {
@ -726,9 +713,9 @@ var Editor =function(renderer, session) {
if (this.$readOnly)
return;
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
var state = this.session.getState(this.getCursorPosition().row);
var rows = this.$getSelectedRows()
this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
};
this.removeLines = function() {

Просмотреть файл

@ -21,6 +21,7 @@
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or

Просмотреть файл

@ -63,10 +63,6 @@ var Text = function(parentEl) {
this.TAB_CHAR = "&rarr;";
this.SPACE_CHAR = "&middot;";
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
};
this.getLineHeight = function() {
return this.$characterSize.height || 1;
};
@ -191,7 +187,7 @@ var Text = function(parentEl) {
var last = Math.min(lastRow, config.lastRow);
var lineElements = this.element.childNodes;
var tokens = this.tokenizer.getTokens(first, last);
var tokens = this.session.getTokens(first, last);
for (var i=first; i<=last; i++) {
var lineElement = lineElements[i - config.firstRow];
if (!lineElement)
@ -242,7 +238,7 @@ var Text = function(parentEl) {
this.$renderLinesFragment = function(config, firstRow, lastRow) {
var fragment = document.createDocumentFragment();
var tokens = this.tokenizer.getTokens(firstRow, lastRow);
var tokens = this.session.getTokens(firstRow, lastRow);
for (var row=firstRow; row<=lastRow; row++) {
var lineEl = dom.createElement("div");
lineEl.className = "ace_line";
@ -265,7 +261,7 @@ var Text = function(parentEl) {
this.config = config;
var html = [];
var tokens = this.tokenizer.getTokens(config.firstRow, config.lastRow);
var tokens = this.session.getTokens(config.firstRow, config.lastRow);
var fragment = this.$renderLinesFragment(config, config.firstRow, config.lastRow);
// Clear the current content of the element and add the rendered fragment.

Просмотреть файл

@ -47,6 +47,36 @@ var HtmlHighlightRules = function() {
// regexp must not have capturing parentheses
// regexps are ordered -> the first match is used
function string(state) {
return [
{
token : "string",
regex : '".*?"'
}, {
token : "string", // multi line string start
regex : '["].*$',
next : state + "-qqstring"
}, {
token : "string",
regex : "'.*?'"
}, {
token : "string", // multi line string start
regex : "['].*$",
next : state + "-qstring"
}]
}
function multiLineString(quote, state) {
return [{
token : "string",
regex : ".*" + quote,
next : state
}, {
token : "string",
regex : '.+'
}]
}
this.$rules = {
start : [ {
token : "text",
@ -89,13 +119,7 @@ var HtmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "string",
regex : '".*?"'
}, {
token : "string",
regex : "'.*?'"
} ],
}].concat(string("script")),
css : [ {
token : "text",
@ -107,13 +131,7 @@ var HtmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "string",
regex : '".*?"'
}, {
token : "string",
regex : "'.*?'"
} ],
}].concat(string("css")),
tag : [ {
token : "text",
@ -125,14 +143,15 @@ var HtmlHighlightRules = function() {
}, {
token : "text",
regex : "\\s+"
}, {
token : "string",
regex : '".*?"'
}, {
token : "string",
regex : "'.*?'"
} ],
}].concat(string("tag")),
"css-qstring": multiLineString("'", "css"),
"css-qqstring": multiLineString('"', "css"),
"script-qstring": multiLineString("'", "script"),
"script-qqstring": multiLineString('"', "script"),
"tag-qstring": multiLineString("'", "tag"),
"tag-qqstring": multiLineString('"', "tag"),
cdata : [ {
token : "text",
regex : "\\]\\]>",

Просмотреть файл

@ -66,7 +66,23 @@ module.exports = {
assert.equal("text", tokens[8].type);
assert.equal("keyword", tokens[9].type);
assert.equal("text", tokens[10].type);
}
},
"test: tokenize multiline attribute value with double quotes": function() {
var line1 = this.tokenizer.getLineTokens('<a href="abc', "start");
var t1 = line1.tokens;
var t2 = this.tokenizer.getLineTokens('def">', line1.state).tokens;
assert.equal(t1[t1.length-1].type, "string");
assert.equal(t2[0].type, "string");
},
"test: tokenize multiline attribute value with single quotes": function() {
var line1 = this.tokenizer.getLineTokens('<a href=\'abc', "start");
var t1 = line1.tokens;
var t2 = this.tokenizer.getLineTokens('def\'>', line1.state).tokens;
assert.equal(t1[t1.length-1].type, "string");
assert.equal(t2[0].type, "string");
}
};
});

Просмотреть файл

@ -20,6 +20,7 @@
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -48,7 +49,8 @@ var JavaScriptHighlightRules = function() {
var keywords = lang.arrayToMap(
("break|case|catch|continue|default|delete|do|else|finally|for|function|" +
"if|in|instanceof|new|return|switch|throw|try|typeof|var|while|with").split("|")
"if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|" +
"const|yield|import|get|set").split("|")
);
var buildinConstants = lang.arrayToMap(
@ -56,8 +58,8 @@ var JavaScriptHighlightRules = function() {
);
var futureReserved = lang.arrayToMap(
("class|enum|extends|super|const|export|import|implements|let|private|" +
"public|yield|interface|package|protected|static").split("|")
("class|enum|extends|super|export|implements|private|" +
"public|interface|package|protected|static").split("|")
);
// regexp must not have capturing parentheses. Use (?:) instead.

Просмотреть файл

@ -82,11 +82,37 @@ var XmlHighlightRules = function() {
}, {
token : "string",
regex : '".*?"'
}, {
token : "string", // multi line string start
regex : '["].*$',
next : "qqstring"
}, {
token : "string",
regex : "'.*?'"
} ],
}, {
token : "string", // multi line string start
regex : "['].*$",
next : "qstring"
}],
qstring: [{
token : "string",
regex : ".*'",
next : "tag"
}, {
token : "string",
regex : '.+'
}],
qqstring: [{
token : "string",
regex : ".*\"",
next : "tag"
}, {
token : "string",
regex : '.+'
}],
cdata : [ {
token : "text",
regex : "\\]\\]>",

Просмотреть файл

@ -45,6 +45,9 @@ var Range = require("ace/range").Range;
var assert = require("ace/test/assertions");
module.exports = {
name: "ACE range.js",
"test: create range": function() {
var range = new Range(1,2,3,4);

Просмотреть файл

@ -0,0 +1,200 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var dom = require("pilot/dom");
var cssText = ".ace-solarized-dark .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-solarized-dark .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-solarized-dark .ace_gutter {\
width: 50px;\
background: #e8e8e8;\
color: #333;\
overflow : hidden;\
}\
\
.ace-solarized-dark .ace_gutter-layer {\
width: 100%;\
text-align: right;\
}\
\
.ace-solarized-dark .ace_gutter-layer .ace_gutter-cell {\
padding-right: 6px;\
}\
\
.ace-solarized-dark .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-solarized-dark .ace_scroller {\
background-color: #002B36;\
}\
\
.ace-solarized-dark .ace_text-layer {\
cursor: text;\
color: #93A1A1;\
}\
\
.ace-solarized-dark .ace_cursor {\
border-left: 2px solid #D30102;\
}\
\
.ace-solarized-dark .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #D30102;\
}\
\
.ace-solarized-dark .ace_marker-layer .ace_selection {\
background: #073642;\
}\
\
.ace-solarized-dark .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\
}\
\
.ace-solarized-dark .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgba(147, 161, 161, 0.50);\
}\
\
.ace-solarized-dark .ace_marker-layer .ace_active_line {\
background: #073642;\
}\
\
\
.ace-solarized-dark .ace_invisible {\
color: rgba(147, 161, 161, 0.50);\
}\
\
.ace-solarized-dark .ace_keyword {\
color:#859900;\
}\
\
.ace-solarized-dark .ace_keyword.ace_operator {\
\
}\
\
.ace-solarized-dark .ace_constant {\
\
}\
\
.ace-solarized-dark .ace_constant.ace_language {\
color:#B58900;\
}\
\
.ace-solarized-dark .ace_constant.ace_library {\
\
}\
\
.ace-solarized-dark .ace_constant.ace_numeric {\
color:#D33682;\
}\
\
.ace-solarized-dark .ace_invalid {\
\
}\
\
.ace-solarized-dark .ace_invalid.ace_illegal {\
\
}\
\
.ace-solarized-dark .ace_invalid.ace_deprecated {\
\
}\
\
.ace-solarized-dark .ace_support {\
\
}\
\
.ace-solarized-dark .ace_support.ace_function {\
color:#268BD2;\
}\
\
.ace-solarized-dark .ace_function.ace_buildin {\
\
}\
\
.ace-solarized-dark .ace_string {\
color:#2AA198;\
}\
\
.ace-solarized-dark .ace_string.ace_regexp {\
color:#D30102;\
}\
\
.ace-solarized-dark .ace_comment {\
font-style:italic;\
color:#657B83;\
}\
\
.ace-solarized-dark .ace_comment.ace_doc {\
\
}\
\
.ace-solarized-dark .ace_comment.ace_doc.ace_tag {\
\
}\
\
.ace-solarized-dark .ace_variable {\
\
}\
\
.ace-solarized-dark .ace_variable.ace_language {\
color:#268BD2;\
}\
\
.ace-solarized-dark .ace_xml_pe {\
\
}\
\
.ace-solarized-dark .ace_collab.ace_user1 {\
\
}";
// import CSS once
dom.importCssString(cssText);
exports.cssClass = "ace-solarized-dark";
});

Просмотреть файл

@ -0,0 +1,199 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var dom = require("pilot/dom");
var cssText = ".ace-solarized-light .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-solarized-light .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-solarized-light .ace_gutter {\
width: 50px;\
background: #e8e8e8;\
color: #333;\
overflow : hidden;\
}\
\
.ace-solarized-light .ace_gutter-layer {\
width: 100%;\
text-align: right;\
}\
\
.ace-solarized-light .ace_gutter-layer .ace_gutter-cell {\
padding-right: 6px;\
}\
\
.ace-solarized-light .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-solarized-light .ace_scroller {\
background-color: #FDF6E3;\
}\
\
.ace-solarized-light .ace_text-layer {\
cursor: text;\
color: #586E75;\
}\
\
.ace-solarized-light .ace_cursor {\
border-left: 2px solid #000000;\
}\
\
.ace-solarized-light .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #000000;\
}\
\
.ace-solarized-light .ace_marker-layer .ace_selection {\
background: #073642;\
}\
\
.ace-solarized-light .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\
}\
\
.ace-solarized-light .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgba(147, 161, 161, 0.50);\
}\
\
.ace-solarized-light .ace_marker-layer .ace_active_line {\
background: #EEE8D5;\
}\
\
\
.ace-solarized-light .ace_invisible {\
color: rgba(147, 161, 161, 0.50);\
}\
\
.ace-solarized-light .ace_keyword {\
color:#859900;\
}\
\
.ace-solarized-light .ace_keyword.ace_operator {\
\
}\
\
.ace-solarized-light .ace_constant {\
\
}\
\
.ace-solarized-light .ace_constant.ace_language {\
color:#B58900;\
}\
\
.ace-solarized-light .ace_constant.ace_library {\
\
}\
\
.ace-solarized-light .ace_constant.ace_numeric {\
color:#D33682;\
}\
\
.ace-solarized-light .ace_invalid {\
\
}\
\
.ace-solarized-light .ace_invalid.ace_illegal {\
\
}\
\
.ace-solarized-light .ace_invalid.ace_deprecated {\
\
}\
\
.ace-solarized-light .ace_support {\
\
}\
\
.ace-solarized-light .ace_support.ace_function {\
color:#268BD2;\
}\
\
.ace-solarized-light .ace_function.ace_buildin {\
\
}\
\
.ace-solarized-light .ace_string {\
color:#2AA198;\
}\
\
.ace-solarized-light .ace_string.ace_regexp {\
color:#D30102;\
}\
\
.ace-solarized-light .ace_comment {\
color:#93A1A1;\
}\
\
.ace-solarized-light .ace_comment.ace_doc {\
\
}\
\
.ace-solarized-light .ace_comment.ace_doc.ace_tag {\
\
}\
\
.ace-solarized-light .ace_variable {\
\
}\
\
.ace-solarized-light .ace_variable.ace_language {\
color:#268BD2;\
}\
\
.ace-solarized-light .ace_xml_pe {\
\
}\
\
.ace-solarized-light .ace_collab.ace_user1 {\
\
}";
// import CSS once
dom.importCssString(cssText);
exports.cssClass = "ace-solarized-light";
});

Просмотреть файл

@ -237,12 +237,6 @@ var VirtualRenderer = function(container, theme) {
this.$loop.schedule(changes);
};
this.setTokenizer = function(tokenizer) {
this.$tokenizer = tokenizer;
this.$textLayer.setTokenizer(tokenizer);
this.$loop.schedule(this.CHANGE_TEXT);
};
this.$onGutterClick = function(e) {
var pageX = event.getDocumentX(e);
var pageY = event.getDocumentY(e);
@ -395,7 +389,7 @@ var VirtualRenderer = function(container, theme) {
};
this.$renderChanges = function(changes) {
if (!changes || !this.session || !this.$tokenizer)
if (!changes || !this.session)
return;
// text, scrolling and resize changes can cause the view port size to change

Просмотреть файл

@ -186,7 +186,9 @@ var themes = {
"mono_industrial": "monoindustrial",
"clouds": "Clouds",
"clouds_midnight": "Clouds Midnight",
"kr_theme": "krTheme"
"kr_theme": "krTheme",
"solarized_light": "Solarized-light",
"solarized_dark": "Solarized-dark"
}
for (var name in themes) {

Просмотреть файл

@ -0,0 +1,312 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (dark)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>background</key>
<string>#002B36</string>
<key>caret</key>
<string>#D30102</string>
<key>foreground</key>
<string>#93A1A1</string>
<key>invisibles</key>
<string>#93A1A180</string>
<key>lineHighlight</key>
<string>#073642</string>
<key>selection</key>
<string>#073642</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comment</string>
<key>scope</key>
<string>comment</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
<key>foreground</key>
<string>#657B83</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>String</string>
<key>scope</key>
<string>string</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#2AA198</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Regexp</string>
<key>scope</key>
<string>string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Number</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D33682</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variable</string>
<key>scope</key>
<string>variable.language, variable.other</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keyword</string>
<key>scope</key>
<string>keyword</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#859900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#93A1A1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Class name</string>
<key>scope</key>
<string>entity.name.class, entity.name.type.class</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#CB4B16</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Function name</string>
<key>scope</key>
<string>entity.name.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variable start</string>
<key>scope</key>
<string>punctuation.definition.variable</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#859900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded code markers</string>
<key>scope</key>
<string>punctuation.section.embedded.begin, punctuation.section.embedded.end</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Built-in constant</string>
<key>scope</key>
<string>constant.language, meta.preprocessor</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#B58900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Support.construct</string>
<key>scope</key>
<string>support.function.construct, keyword.other.new</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CB4B16</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>User-defined constant</string>
<key>scope</key>
<string>constant.character, constant.other</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CB4B16</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Inherited class</string>
<key>scope</key>
<string>entity.other.inherited-class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#6C71C4</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Function argument</string>
<key>scope</key>
<string>variable.parameter</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Tag name</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tag start/end</string>
<key>scope</key>
<string>punctuation.definition.tag</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#657B83</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tag attribute</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#93A1A1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library function</string>
<key>scope</key>
<string>support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Continuation</string>
<key>scope</key>
<string>punctuation.separator.continuation</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library constant</string>
<key>scope</key>
<string>support.constant</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Library class/type</string>
<key>scope</key>
<string>support.type, support.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#859900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library Exception</string>
<key>scope</key>
<string>support.type.exception</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CB4B16</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library variable</string>
<key>scope</key>
<string>support.other.variable</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Invalid</string>
<key>scope</key>
<string>invalid</string>
<key>settings</key>
<dict/>
</dict>
</array>
<key>uuid</key>
<string>F930B0BF-AA03-4232-A30F-CEF749FF8E72</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (light)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>background</key>
<string>#FDF6E3</string>
<key>caret</key>
<string>#000000</string>
<key>foreground</key>
<string>#586E75</string>
<key>invisibles</key>
<string>#93A1A180</string>
<key>lineHighlight</key>
<string>#EEE8D5</string>
<key>selection</key>
<string>#073642</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comment</string>
<key>scope</key>
<string>comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#93A1A1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>String</string>
<key>scope</key>
<string>string</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#2AA198</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Regexp</string>
<key>scope</key>
<string>string.regexp</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Number</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D33682</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variable</string>
<key>scope</key>
<string>variable.language, variable.other</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Keyword</string>
<key>scope</key>
<string>keyword</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#859900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Storage</string>
<key>scope</key>
<string>storage</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#073642</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Class name</string>
<key>scope</key>
<string>entity.name.class, entity.name.type.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Function name</string>
<key>scope</key>
<string>entity.name.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Variable start</string>
<key>scope</key>
<string>punctuation.definition.variable</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#859900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Embedded code markers</string>
<key>scope</key>
<string>punctuation.section.embedded.begin, punctuation.section.embedded.end</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Built-in constant</string>
<key>scope</key>
<string>constant.language, meta.preprocessor</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#B58900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Support.construct</string>
<key>scope</key>
<string>support.function.construct, keyword.other.new</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>User-defined constant</string>
<key>scope</key>
<string>constant.character, constant.other</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CB4B16</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Inherited class</string>
<key>scope</key>
<string>entity.other.inherited-class</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Function argument</string>
<key>scope</key>
<string>variable.parameter</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Tag name</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tag start/end</string>
<key>scope</key>
<string>punctuation.definition.tag.begin, punctuation.definition.tag.end</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#93A1A1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tag attribute</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#93A1A1</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library function</string>
<key>scope</key>
<string>support.function</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#268BD2</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Continuation</string>
<key>scope</key>
<string>punctuation.separator.continuation</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D30102</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library constant</string>
<key>scope</key>
<string>support.constant</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Library class/type</string>
<key>scope</key>
<string>support.type, support.class</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#859900</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library Exception</string>
<key>scope</key>
<string>support.type.exception</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CB4B16</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Library variable</string>
<key>scope</key>
<string>support.other.variable</string>
<key>settings</key>
<dict/>
</dict>
<dict>
<key>name</key>
<string>Invalid</string>
<key>scope</key>
<string>invalid</string>
<key>settings</key>
<dict/>
</dict>
</array>
<key>uuid</key>
<string>38E819D9-AE02-452F-9231-ECC3B204AFD7</string>
</dict>
</plist>