Merge branch 'master' of github.com:ajaxorg/editor into HEAD
This commit is contained in:
commit
325d1e20c3
12 changed files with 73 additions and 75 deletions
|
|
@ -259,14 +259,6 @@ var Document = function(text, mode) {
|
||||||
return this.lines[row] || "";
|
return this.lines[row] || "";
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a line as it is displayed on screen. Tabs are replaced by spaces.
|
|
||||||
*/
|
|
||||||
this.getDisplayLine = function(row) {
|
|
||||||
var tab = new Array(this.getTabSize()+1).join(" ");
|
|
||||||
return this.lines[row].replace(/\t/g, tab);
|
|
||||||
};
|
|
||||||
|
|
||||||
this.getLines = function(firstRow, lastRow) {
|
this.getLines = function(firstRow, lastRow) {
|
||||||
return this.lines.slice(firstRow, lastRow+1);
|
return this.lines.slice(firstRow, lastRow+1);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ var Selection = function(doc) {
|
||||||
this.moveCursorLineStart = function() {
|
this.moveCursorLineStart = function() {
|
||||||
var row = this.selectionLead.row;
|
var row = this.selectionLead.row;
|
||||||
var column = this.selectionLead.column;
|
var column = this.selectionLead.column;
|
||||||
var beforeCursor = this.doc.getDisplayLine(row).slice(0, column);
|
var beforeCursor = this.doc.getLine(row).slice(0, column);
|
||||||
var leadingSpace = beforeCursor.match(/^\s+/);
|
var leadingSpace = beforeCursor.match(/^\s+/);
|
||||||
if (!leadingSpace || leadingSpace[0].length >= column)
|
if (!leadingSpace || leadingSpace[0].length >= column)
|
||||||
this.moveCursorTo(this.selectionLead.row, 0);
|
this.moveCursorTo(this.selectionLead.row, 0);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
.ace_editor {
|
.ace_editor {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
|
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||||
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_scroller {
|
.ace_scroller {
|
||||||
|
|
|
||||||
|
|
@ -221,18 +221,18 @@ var Text = function(parentEl) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$renderLine = function(stringBuilder, row, tokens) {
|
this.$renderLine = function(stringBuilder, row, tokens) {
|
||||||
if (this.$showInvisibles) {
|
// if (this.$showInvisibles) {
|
||||||
var self = this;
|
// var self = this;
|
||||||
var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+/g;
|
// var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]+/g;
|
||||||
var spaceReplace = function(space) {
|
// var spaceReplace = function(space) {
|
||||||
var space = new Array(space.length+1).join(self.SPACE_CHAR);
|
// var space = new Array(space.length+1).join(self.SPACE_CHAR);
|
||||||
return "<span class='ace_invisible'>" + space + "</span>";
|
// return "<span class='ace_invisible'>" + space + "</span>";
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
else {
|
// else {
|
||||||
var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g;
|
var spaceRe = /[\v\f \u00a0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000]/g;
|
||||||
var spaceReplace = " ";
|
var spaceReplace = " ";
|
||||||
}
|
// }
|
||||||
|
|
||||||
for ( var i = 0; i < tokens.length; i++) {
|
for ( var i = 0; i < tokens.length; i++) {
|
||||||
var token = tokens[i];
|
var token = tokens[i];
|
||||||
|
|
@ -244,7 +244,7 @@ var Text = function(parentEl) {
|
||||||
.replace(/\t/g, this.$tabString);
|
.replace(/\t/g, this.$tabString);
|
||||||
|
|
||||||
if (!this.$textToken[token.type]) {
|
if (!this.$textToken[token.type]) {
|
||||||
var classes = "ace_" + token.type.replace(".", " ace_");
|
var classes = "ace_" + token.type.replace(/\./g, " ace_");
|
||||||
stringBuilder.push("<span class='", classes, "'>", output, "</span>");
|
stringBuilder.push("<span class='", classes, "'>", output, "</span>");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,11 @@ var CssHighlightRules = function() {
|
||||||
"zero").split("|")
|
"zero").split("|")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var colors = lang.arrayToMap(
|
||||||
|
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
|
||||||
|
"purple|red|silver|teal|white|yellow").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
|
@ -100,61 +105,61 @@ var CssHighlightRules = function() {
|
||||||
token : "string", // single line
|
token : "string", // single line
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("em")
|
regex : numRe + ic("em")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("ex")
|
regex : numRe + ic("ex")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("px")
|
regex : numRe + ic("px")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("cm")
|
regex : numRe + ic("cm")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("mm")
|
regex : numRe + ic("mm")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("in")
|
regex : numRe + ic("in")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("pt")
|
regex : numRe + ic("pt")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("pc")
|
regex : numRe + ic("pc")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("deg")
|
regex : numRe + ic("deg")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("rad")
|
regex : numRe + ic("rad")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("grad")
|
regex : numRe + ic("grad")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("ms")
|
regex : numRe + ic("ms")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("s")
|
regex : numRe + ic("s")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("hz")
|
regex : numRe + ic("hz")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + ic("khz")
|
regex : numRe + ic("khz")
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe + "%"
|
regex : numRe + "%"
|
||||||
}, {
|
}, {
|
||||||
token : "number",
|
token : "constant.numeric",
|
||||||
regex : numRe
|
regex : numRe
|
||||||
}, {
|
}, {
|
||||||
token : "number", // hex6 color
|
token : "constant.numeric", // hex6 color
|
||||||
regex : "#[a-fA-F0-9]{6}"
|
regex : "#[a-fA-F0-9]{6}"
|
||||||
}, {
|
}, {
|
||||||
token : "number", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-fA-F0-9]{3}"
|
regex : "#[a-fA-F0-9]{3}"
|
||||||
}, {
|
}, {
|
||||||
token : "lparen",
|
token : "lparen",
|
||||||
|
|
@ -165,16 +170,19 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties[value.toLowerCase()]) {
|
if (properties[value.toLowerCase()]) {
|
||||||
return "constant.language";
|
return "support.type";
|
||||||
}
|
}
|
||||||
else if (functions[value.toLowerCase()]) {
|
else if (functions[value.toLowerCase()]) {
|
||||||
return "function.language";
|
return "support.function";
|
||||||
}
|
}
|
||||||
else if (constants[value.toLowerCase()]) {
|
else if (constants[value.toLowerCase()]) {
|
||||||
return "constant.library";
|
return "support.constant";
|
||||||
|
}
|
||||||
|
else if (colors[value.toLowerCase()]) {
|
||||||
|
return "support.constant.color";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "identifier";
|
return "text";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ require.def("ace/theme/Dawn",
|
||||||
width: 50px;\
|
width: 50px;\
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
color: #333;\
|
color: #333;\
|
||||||
font-family: \"Menlo\", \"Monaco\", \"Courier New\", monospace;\
|
|
||||||
font-size: 11px;\
|
|
||||||
overflow : hidden;\
|
overflow : hidden;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
|
@ -39,8 +37,6 @@ require.def("ace/theme/Dawn",
|
||||||
.ace-dawn .ace_text-layer {\
|
.ace-dawn .ace_text-layer {\
|
||||||
cursor: text;\
|
cursor: text;\
|
||||||
color: #080808;\
|
color: #080808;\
|
||||||
font-family: \"Menlo\", \"Monaco\", \"Courier New\", \"Courier\", monospace;\
|
|
||||||
font-size: 11px;\
|
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-dawn .ace_cursor {\
|
.ace-dawn .ace_cursor {\
|
||||||
|
|
@ -115,8 +111,12 @@ font-style:italic;\
|
||||||
color:#B52A1D;\
|
color:#B52A1D;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-dawn .ace_function {\
|
.ace-dawn .ace_support {\
|
||||||
|
color:#691C97;\
|
||||||
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-dawn .ace_support.ace_function {\
|
||||||
|
color:#693A17;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-dawn .ace_function.ace_buildin {\
|
.ace-dawn .ace_function.ace_buildin {\
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ require.def("ace/theme/IdleFingers",
|
||||||
width: 50px;\
|
width: 50px;\
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
color: #333;\
|
color: #333;\
|
||||||
font-family: \"Menlo\", \"Monaco\", \"Courier New\", monospace;\
|
|
||||||
font-size: 11px;\
|
|
||||||
overflow : hidden;\
|
overflow : hidden;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
|
@ -39,8 +37,6 @@ require.def("ace/theme/IdleFingers",
|
||||||
.ace-idle-fingers .ace_text-layer {\
|
.ace-idle-fingers .ace_text-layer {\
|
||||||
cursor: text;\
|
cursor: text;\
|
||||||
color: #FFFFFF;\
|
color: #FFFFFF;\
|
||||||
font-family: \"Menlo\", \"Monaco\", \"Courier New\", \"Courier\", monospace;\
|
|
||||||
font-size: 11px;\
|
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-idle-fingers .ace_cursor {\
|
.ace-idle-fingers .ace_cursor {\
|
||||||
|
|
@ -111,10 +107,14 @@ background-color:#FF0000;\
|
||||||
\
|
\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-idle-fingers .ace_function {\
|
.ace-idle-fingers .ace_support {\
|
||||||
\
|
\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-idle-fingers .ace_support.ace_function {\
|
||||||
|
color:#B83426;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-idle-fingers .ace_function.ace_buildin {\
|
.ace-idle-fingers .ace_function.ace_buildin {\
|
||||||
\
|
\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,6 @@ require.def("ace/theme/Twilight",
|
||||||
width: 50px;\
|
width: 50px;\
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
color: #333;\
|
color: #333;\
|
||||||
font-family: \"Menlo\", \"Monaco\", \"Courier New\", monospace;\
|
|
||||||
font-size: 11px;\
|
|
||||||
overflow : hidden;\
|
overflow : hidden;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
|
@ -39,8 +37,6 @@ require.def("ace/theme/Twilight",
|
||||||
.ace-twilight .ace_text-layer {\
|
.ace-twilight .ace_text-layer {\
|
||||||
cursor: text;\
|
cursor: text;\
|
||||||
color: #F8F8F8;\
|
color: #F8F8F8;\
|
||||||
font-family: \"Menlo\", \"Monaco\", \"Courier New\", \"Courier\", monospace;\
|
|
||||||
font-size: 11px;\
|
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-twilight .ace_cursor {\
|
.ace-twilight .ace_cursor {\
|
||||||
|
|
@ -113,8 +109,12 @@ font-style:italic;\
|
||||||
color:#D2A8A1;\
|
color:#D2A8A1;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-twilight .ace_function {\
|
.ace-twilight .ace_support {\
|
||||||
|
color:#9B859D;\
|
||||||
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-twilight .ace_support.ace_function {\
|
||||||
|
color:#DAD085;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-twilight .ace_function.ace_buildin {\
|
.ace-twilight .ace_function.ace_buildin {\
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@
|
||||||
background: rgb(227, 227, 227);
|
background: rgb(227, 227, 227);
|
||||||
border-right: 1px solid rgb(159, 159, 159);
|
border-right: 1px solid rgb(159, 159, 159);
|
||||||
color: rgb(136, 136, 136);
|
color: rgb(136, 136, 136);
|
||||||
font-family: Monaco, "Courier New";
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-eclipse .ace_gutter-layer {
|
.ace-eclipse .ace_gutter-layer {
|
||||||
|
|
@ -21,8 +19,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-eclipse .ace_text-layer {
|
.ace-eclipse .ace_text-layer {
|
||||||
font-family: Monaco, "Courier New", monospace;
|
|
||||||
font-size: 11px;
|
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@
|
||||||
width: 50px;
|
width: 50px;
|
||||||
background: #e8e8e8;
|
background: #e8e8e8;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
|
||||||
font-size: 11px;
|
|
||||||
overflow : hidden;
|
overflow : hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,8 +29,6 @@
|
||||||
|
|
||||||
.ace-tm .ace_text-layer {
|
.ace-tm .ace_text-layer {
|
||||||
cursor: text;
|
cursor: text;
|
||||||
font-family: "Menlo", "Monaco", "Courier New", "Courier", monospace;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tm .ace_cursor {
|
.ace-tm .ace_cursor {
|
||||||
|
|
@ -65,7 +61,7 @@
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace-tm .ace_line .ace_function {
|
.ace-tm .ace_line .ace_support.ace_function {
|
||||||
color: rgb(60, 76, 114);
|
color: rgb(60, 76, 114);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,6 @@
|
||||||
width: 50px;
|
width: 50px;
|
||||||
background: #e8e8e8;
|
background: #e8e8e8;
|
||||||
color: #333;
|
color: #333;
|
||||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
|
||||||
font-size: 11px;
|
|
||||||
overflow : hidden;
|
overflow : hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,8 +34,6 @@
|
||||||
.%cssClass% .ace_text-layer {
|
.%cssClass% .ace_text-layer {
|
||||||
cursor: text;
|
cursor: text;
|
||||||
color: %foreground%;
|
color: %foreground%;
|
||||||
font-family: "Menlo", "Monaco", "Courier New", "Courier", monospace;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.%cssClass% .ace_cursor {
|
.%cssClass% .ace_cursor {
|
||||||
|
|
@ -107,8 +103,12 @@
|
||||||
%invalid.deprecated%
|
%invalid.deprecated%
|
||||||
}
|
}
|
||||||
|
|
||||||
.%cssClass% .ace_function {
|
.%cssClass% .ace_support {
|
||||||
%function%
|
%support%
|
||||||
|
}
|
||||||
|
|
||||||
|
.%cssClass% .ace_support.ace_function {
|
||||||
|
%support.function%
|
||||||
}
|
}
|
||||||
|
|
||||||
.%cssClass% .ace_function.ace_buildin {
|
.%cssClass% .ace_function.ace_buildin {
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,9 @@ var supportedScopes = {
|
||||||
"constant.library": "constant.library",
|
"constant.library": "constant.library",
|
||||||
"constant.numeric": "constant.numeric",
|
"constant.numeric": "constant.numeric",
|
||||||
|
|
||||||
|
"support": "support",
|
||||||
|
"support.function": "support.function",
|
||||||
|
|
||||||
"function": "function",
|
"function": "function",
|
||||||
"function.buildin": "function.buildin",
|
"function.buildin": "function.buildin",
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue