This commit is contained in:
William Candillon 2012-04-19 12:28:36 +02:00
commit a951e93778
46 changed files with 440 additions and 167 deletions

View file

@ -151,6 +151,10 @@
opacity: 0.2; opacity: 0.2;
} }
.ace_editor.multiselect .ace_cursor {
border-left-width: 1px;
}
.ace_line { .ace_line {
white-space: nowrap; white-space: nowrap;
} }

View file

@ -1163,11 +1163,12 @@ var Editor = function(renderer, session) {
if (!ranges.length) if (!ranges.length)
return replaced; return replaced;
this.$blockScrolling += 1;
var selection = this.getSelectionRange(); var selection = this.getSelectionRange();
this.clearSelection(); this.clearSelection();
this.selection.moveCursorTo(0, 0); this.selection.moveCursorTo(0, 0);
this.$blockScrolling += 1;
for (var i = ranges.length - 1; i >= 0; --i) { for (var i = ranges.length - 1; i >= 0; --i) {
if(this.$tryReplace(ranges[i], replacement)) { if(this.$tryReplace(ranges[i], replacement)) {
replaced++; replaced++;

View file

@ -107,11 +107,11 @@ var Cursor = function(parentEl) {
if (!this.isVisible) if (!this.isVisible)
return; return;
var element = this.element; var element = this.cursors.length == 1 ? this.cursor : this.element;
this.blinkId = setInterval(function() { this.blinkId = setInterval(function() {
element.style.visibility = "hidden"; element.style.visibility = "hidden";
setTimeout(function() { setTimeout(function() {
element.style.visibility = "visible"; element.style.visibility = "";
}, 400); }, 400);
}, 1000); }, 1000);
}; };
@ -141,7 +141,7 @@ var Cursor = function(parentEl) {
this.update = function(config) { this.update = function(config) {
this.config = config; this.config = config;
if (this.session.selectionMarkerCount > 1) { if (this.session.selectionMarkerCount > 0) {
var selections = this.session.$selectionMarkers; var selections = this.session.$selectionMarkers;
var i = 0, sel, cursorIndex = 0; var i = 0, sel, cursorIndex = 0;

View file

@ -99,7 +99,7 @@ var Marker = function(parentEl) {
} }
else { else {
this.drawSingleLineMarker( this.drawSingleLineMarker(
html, range, marker.clazz, config, html, range, marker.clazz + " start", config,
null, marker.type null, marker.type
); );
} }
@ -122,7 +122,7 @@ var Marker = function(parentEl) {
row, range.start.column, row, range.start.column,
row, this.session.getScreenLastRowColumn(row) row, this.session.getScreenLastRowColumn(row)
); );
this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text"); this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
// selection end // selection end
row = range.end.row; row = range.end.row;
@ -152,7 +152,7 @@ var Marker = function(parentEl) {
); );
stringBuilder.push( stringBuilder.push(
"<div class='", clazz, "' style='", "<div class='", clazz, " start' style='",
"height:", height, "px;", "height:", height, "px;",
"width:", width, "px;", "width:", width, "px;",
"top:", top, "px;", "top:", top, "px;",

View file

@ -72,7 +72,7 @@ var c_cppHighlightRules = function() {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -171,7 +171,7 @@ var c_cppHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(c_cppHighlightRules, TextHighlightRules); oop.inherits(c_cppHighlightRules, TextHighlightRules);

View file

@ -69,27 +69,24 @@ var DocCommentHighlightRules = function() {
oop.inherits(DocCommentHighlightRules, TextHighlightRules); oop.inherits(DocCommentHighlightRules, TextHighlightRules);
(function() { DocCommentHighlightRules.getStartRule = function(start) {
return {
this.getStartRule = function(start) { token : "comment.doc", // doc comment
return { merge : true,
token : "comment.doc", // doc comment regex : "\\/\\*(?=\\*)",
merge : true, next : start
regex : "\\/\\*(?=\\*)",
next : start
};
};
this.getEndRule = function (start) {
return {
token : "comment.doc", // closing comment
merge : true,
regex : "\\*\\/",
next : start
};
}; };
};
DocCommentHighlightRules.getEndRule = function (start) {
return {
token : "comment.doc", // closing comment
merge : true,
regex : "\\*\\/",
next : start
};
};
}).call(DocCommentHighlightRules.prototype);
exports.DocCommentHighlightRules = DocCommentHighlightRules; exports.DocCommentHighlightRules = DocCommentHighlightRules;

View file

@ -64,7 +64,7 @@ var GroovyHighlightRules = function() {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -134,7 +134,7 @@ var GroovyHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(GroovyHighlightRules, TextHighlightRules); oop.inherits(GroovyHighlightRules, TextHighlightRules);

View file

@ -26,7 +26,7 @@ var HaxeHighlightRules = function() {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
regex : "\\/\\*", regex : "\\/\\*",
@ -95,7 +95,7 @@ var HaxeHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(HaxeHighlightRules, TextHighlightRules); oop.inherits(HaxeHighlightRules, TextHighlightRules);

View file

@ -65,7 +65,7 @@ var JavaHighlightRules = function() {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -135,7 +135,7 @@ var JavaHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(JavaHighlightRules, TextHighlightRules); oop.inherits(JavaHighlightRules, TextHighlightRules);

View file

@ -116,7 +116,7 @@ var JavaScriptHighlightRules = function() {
token : "comment", token : "comment",
regex : /\/\/.*$/ regex : /\/\/.*$/
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -124,11 +124,11 @@ var JavaScriptHighlightRules = function() {
next : "comment" next : "comment"
}, { }, {
token : "string", token : "string",
regex : "'", regex : "'(?=.)",
next : "qstring" next : "qstring"
}, { }, {
token : "string", token : "string",
regex : '"', regex : '"(?=.)',
next : "qqstring" next : "qqstring"
}, { }, {
token : "constant.numeric", // hex token : "constant.numeric", // hex
@ -148,11 +148,10 @@ var JavaScriptHighlightRules = function() {
"text", "text",
"storage.type", "storage.type",
"text", "text",
"paren.lparen", "paren.lparen"
"variable.parameter",
"paren.rparen"
], ],
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))" regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { // match stuff like: Sound.prototype.play = myfunc }, { // match stuff like: Sound.prototype.play = myfunc
token : [ token : [
"storage.type", "storage.type",
@ -164,7 +163,8 @@ var JavaScriptHighlightRules = function() {
"keyword.operator", "keyword.operator",
"text" "text"
], ],
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)" regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)",
next: "function_arguments"
}, { // match stuff like: Sound.play = function() { } }, { // match stuff like: Sound.play = function() { }
token : [ token : [
"storage.type", "storage.type",
@ -175,11 +175,10 @@ var JavaScriptHighlightRules = function() {
"text", "text",
"storage.type", "storage.type",
"text", "text",
"paren.lparen", "paren.lparen"
"variable.parameter",
"paren.rparen"
], ],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))" regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { // match stuff like: play = function() { } }, { // match stuff like: play = function() { }
token : [ token : [
"entity.name.function", "entity.name.function",
@ -188,22 +187,20 @@ var JavaScriptHighlightRules = function() {
"text", "text",
"storage.type", "storage.type",
"text", "text",
"paren.lparen", "paren.lparen"
"variable.parameter",
"paren.rparen"
], ],
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))" regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { // match regular function like: function myFunc(arg) { } }, { // match regular function like: function myFunc(arg) { }
token : [ token : [
"storage.type", "storage.type",
"text", "text",
"entity.name.function", "entity.name.function",
"text", "text",
"paren.lparen", "paren.lparen"
"variable.parameter",
"paren.rparen"
], ],
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))" regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
next: "function_arguments"
}, { // match stuff like: foobar: function() { } }, { // match stuff like: foobar: function() { }
token : [ token : [
"entity.name.function", "entity.name.function",
@ -212,22 +209,20 @@ var JavaScriptHighlightRules = function() {
"text", "text",
"storage.type", "storage.type",
"text", "text",
"paren.lparen", "paren.lparen"
"variable.parameter",
"paren.rparen"
], ],
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))" regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { }) }, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
token : [ token : [
"text", "text",
"text", "text",
"storage.type", "storage.type",
"text", "text",
"paren.lparen", "paren.lparen"
"variable.parameter",
"paren.rparen"
], ],
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))" regex : "(:)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { }, {
token : "constant.language.boolean", token : "constant.language.boolean",
regex : /(?:true|false)\b/ regex : /(?:true|false)\b/
@ -297,6 +292,7 @@ var JavaScriptHighlightRules = function() {
// regular expressions are only allowed after certain tokens. This // regular expressions are only allowed after certain tokens. This
// makes sure we don't mix up regexps with the divison operator // makes sure we don't mix up regexps with the divison operator
"regex_allowed": [ "regex_allowed": [
DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -324,10 +320,9 @@ var JavaScriptHighlightRules = function() {
"regex": [ "regex": [
{ {
token: "regexp.keyword.operator", token: "regexp.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
next: "regex"
}, { }, {
// flag // flag
token: "string.regexp", token: "string.regexp",
regex: "/\\w*", regex: "/\\w*",
next: "start", next: "start",
@ -335,7 +330,6 @@ var JavaScriptHighlightRules = function() {
}, { }, {
token: "string.regexp", token: "string.regexp",
regex: "[^\\\\/\\[]+", regex: "[^\\\\/\\[]+",
next: "regex",
merge: true merge: true
}, { }, {
token: "string.regexp.charachterclass", token: "string.regexp.charachterclass",
@ -351,8 +345,7 @@ var JavaScriptHighlightRules = function() {
"regex_character_class": [ "regex_character_class": [
{ {
token: "regexp.keyword.operator", token: "regexp.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)", regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
next: "regex_character_class"
}, { }, {
token: "string.regexp.charachterclass", token: "string.regexp.charachterclass",
regex: "]", regex: "]",
@ -361,7 +354,24 @@ var JavaScriptHighlightRules = function() {
}, { }, {
token: "string.regexp.charachterclass", token: "string.regexp.charachterclass",
regex: "[^\\\\\\]]+", regex: "[^\\\\\\]]+",
next: "regex_character_class", merge: true
}, {
token: "empty",
regex: "",
next: "start"
}
],
"function_arguments": [
{
token: "variable.parameter",
regex: identifierRe,
}, {
token: "punctuation.operator",
regex: "[, ]+",
merge: true
}, {
token: "punctuation.operator",
regex: "$",
merge: true merge: true
}, { }, {
token: "empty", token: "empty",
@ -399,11 +409,18 @@ var JavaScriptHighlightRules = function() {
regex : escapedRe regex : escapedRe
}, { }, {
token : "string", token : "string",
regex : '[^"\\\\]+' regex : '[^"\\\\]+',
merge : true
}, { }, {
token : "string", token : "string",
regex : '"', regex : "\\\\$",
next : "start" next : "qqstring",
merge : true
}, {
token : "string",
regex : '"|$',
next : "start",
merge : true
} }
], ],
"qstring" : [ "qstring" : [
@ -412,17 +429,24 @@ var JavaScriptHighlightRules = function() {
regex : escapedRe regex : escapedRe
}, { }, {
token : "string", token : "string",
regex : "[^'\\\\]+" regex : "[^'\\\\]+",
merge : true
}, { }, {
token : "string", token : "string",
regex : "'", regex : "\\\\$",
next : "start" next : "qstring",
merge : true
}, {
token : "string",
regex : "'|$",
next : "start",
merge : true
} }
] ]
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(JavaScriptHighlightRules, TextHighlightRules); oop.inherits(JavaScriptHighlightRules, TextHighlightRules);

View file

@ -46,9 +46,9 @@ var JavaScriptMode = require("./javascript").Mode;
var assert = require("../test/assertions"); var assert = require("../test/assertions");
module.exports = { module.exports = {
name: "JavaScript Tokenizer", name: "JavaScript Tokenizer",
setUp : function() { setUp : function() {
this.tokenizer = new JavaScriptMode().getTokenizer(); this.tokenizer = new JavaScriptMode().getTokenizer();
}, },
@ -71,12 +71,12 @@ module.exports = {
var tokens = this.tokenizer.getLineTokens(line, "start").tokens; var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(27, tokens.length); assert.equal(23, tokens.length);
assert.equal("support.function", tokens[2].type); // charCodeAt assert.equal("support.function", tokens[2].type); // charCodeAt
assert.equal("support.function.dom", tokens[10].type); // getElementById assert.equal("support.function.dom", tokens[10].type); // getElementById
assert.equal("support.function.firebug", tokens[20].type); // log assert.equal("support.function.firebug", tokens[18].type); // log
}, },
"test: tokenize doc comment" : function() { "test: tokenize doc comment" : function() {
var line = "abc /** de */ fg"; var line = "abc /** de */ fg";
@ -135,11 +135,11 @@ module.exports = {
var tokens = this.tokenizer.getLineTokens("a=/b/g", "start").tokens; var tokens = this.tokenizer.getLineTokens("a=/b/g", "start").tokens;
assert.equal(3, tokens.length); assert.equal(3, tokens.length);
assert.equal("string.regexp", tokens[2].type); assert.equal("string.regexp", tokens[2].type);
var tokens = this.tokenizer.getLineTokens("a+/b/g", "start").tokens; var tokens = this.tokenizer.getLineTokens("a+/b/g", "start").tokens;
assert.equal(3, tokens.length); assert.equal(3, tokens.length);
assert.equal("string.regexp", tokens[2].type); assert.equal("string.regexp", tokens[2].type);
var tokens = this.tokenizer.getLineTokens("a = 1 + /2 + 1/b", "start").tokens; var tokens = this.tokenizer.getLineTokens("a = 1 + /2 + 1/b", "start").tokens;
assert.equal(9, tokens.length); assert.equal(9, tokens.length);
assert.equal("string.regexp", tokens[8].type); assert.equal("string.regexp", tokens[8].type);
@ -148,17 +148,17 @@ module.exports = {
assert.equal(7, tokens.length); assert.equal(7, tokens.length);
assert.equal("string.regexp", tokens[2].type); assert.equal("string.regexp", tokens[2].type);
assert.equal("string.regexp", tokens[6].type); assert.equal("string.regexp", tokens[6].type);
var tokens = this.tokenizer.getLineTokens("case /a/.test(c)", "start").tokens; var tokens = this.tokenizer.getLineTokens("case /a/.test(c)", "start").tokens;
assert.equal(8, tokens.length); assert.equal(8, tokens.length);
assert.equal("string.regexp", tokens[2].type); assert.equal("string.regexp", tokens[2].type);
}, },
"test tokenize multi-line comment containing a single line comment" : function() { "test tokenize multi-line comment containing a single line comment" : function() {
var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "start").tokens; var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "start").tokens;
assert.equal(1, tokens.length); assert.equal(1, tokens.length);
assert.equal("comment", tokens[0].type); assert.equal("comment", tokens[0].type);
var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "regex_allowed").tokens; var tokens = this.tokenizer.getLineTokens("/* foo // bar */", "regex_allowed").tokens;
assert.equal(1, tokens.length); assert.equal(1, tokens.length);
assert.equal("comment", tokens[0].type); assert.equal("comment", tokens[0].type);
@ -168,7 +168,7 @@ module.exports = {
var tokens = this.tokenizer.getLineTokens("füße", "start").tokens; var tokens = this.tokenizer.getLineTokens("füße", "start").tokens;
assert.equal(1, tokens.length); assert.equal(1, tokens.length);
}, },
"test // is not a regexp": function() { "test // is not a regexp": function() {
var tokens = this.tokenizer.getLineTokens("{ // 123", "start").tokens; var tokens = this.tokenizer.getLineTokens("{ // 123", "start").tokens;
assert.equal(3, tokens.length); assert.equal(3, tokens.length);
@ -176,19 +176,45 @@ module.exports = {
assert.equal("text", tokens[1].type); assert.equal("text", tokens[1].type);
assert.equal("comment", tokens[2].type); assert.equal("comment", tokens[2].type);
}, },
"test skipping escaped chars": function() { "test skipping escaped chars": function() {
var line = "console.log('Meh\\nNeh');" var line = "console.log('Meh\\nNeh');"
var tokens = this.tokenizer.getLineTokens(line, "start").tokens; var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(11, tokens.length); assert.equal(9, tokens.length);
assert.equal("constant.language.escape", tokens[6].type); assert.equal("constant.language.escape", tokens[5].type);
line = "console.log('\\u1232Feh');"; line = "console.log('\\u1232Feh');";
tokens = this.tokenizer.getLineTokens(line, "start").tokens; tokens = this.tokenizer.getLineTokens(line, "start").tokens;
assert.equal(10, tokens.length); assert.equal(9, tokens.length);
assert.equal("constant.language.escape", tokens[5].type); assert.equal("constant.language.escape", tokens[5].type);
},
"test multiline strings": function() {
var line = "console.log('Meh\\"
var data = this.tokenizer.getLineTokens(line, "start")
assert.equal(5, data.tokens.length);
assert.equal(data.state, "qstring");
line = "console.log('Meh\\ "
data = this.tokenizer.getLineTokens(line, "start")
assert.equal(6, data.tokens.length);
assert.equal(data.state, "start");
line = 'console.log("\\'
data = this.tokenizer.getLineTokens(line, "start")
assert.equal(5, data.tokens.length);
assert.equal(data.state, "qqstring");
line = 'a="'
data = this.tokenizer.getLineTokens(line, "start")
assert.equal(3, data.tokens.length);
assert.equal(data.state, "start");
} }
}; };

View file

@ -442,7 +442,7 @@ var PgsqlHighlightRules = function() {
token : "comment", token : "comment",
regex : "--.*$" regex : "--.*$"
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi-line comment token : "comment", // multi-line comment
merge : true, merge : true,
@ -571,7 +571,7 @@ var PgsqlHighlightRules = function() {
] ]
}; };
this.embedRules(DocCommentHighlightRules, "doc-", [ new DocCommentHighlightRules().getEndRule("start") ]); this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]); this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]); this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
}; };

View file

@ -45,7 +45,7 @@ var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocComme
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var PhpHighlightRules = function() { var PhpHighlightRules = function() {
var docComment = new DocCommentHighlightRules(); var docComment = DocCommentHighlightRules;
// http://php.net/quickref.php // http://php.net/quickref.php
var builtinFunctions = lang.arrayToMap( var builtinFunctions = lang.arrayToMap(
('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' + ('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
@ -1150,7 +1150,7 @@ var PhpHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(PhpHighlightRules, TextHighlightRules); oop.inherits(PhpHighlightRules, TextHighlightRules);

View file

@ -65,7 +65,7 @@ var scadHighlightRules = function() {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
new DocCommentHighlightRules().getStartRule("start"), DocCommentHighlightRules.getStartRule("start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -159,7 +159,7 @@ var scadHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(scadHighlightRules, TextHighlightRules); oop.inherits(scadHighlightRules, TextHighlightRules);

View file

@ -65,7 +65,7 @@ var ScalaHighlightRules = function() {
token : "comment", token : "comment",
regex : "\\/\\/.*$" regex : "\\/\\/.*$"
}, },
new DocCommentHighlightRules().getStartRule("doc-start"), DocCommentHighlightRules.getStartRule("doc-start"),
{ {
token : "comment", // multi line comment token : "comment", // multi line comment
merge : true, merge : true,
@ -135,7 +135,7 @@ var ScalaHighlightRules = function() {
}; };
this.embedRules(DocCommentHighlightRules, "doc-", this.embedRules(DocCommentHighlightRules, "doc-",
[ new DocCommentHighlightRules().getEndRule("start") ]); [ DocCommentHighlightRules.getEndRule("start") ]);
}; };
oop.inherits(ScalaHighlightRules, TextHighlightRules); oop.inherits(ScalaHighlightRules, TextHighlightRules);

View file

@ -20,6 +20,8 @@
* *
* Contributor(s): * Contributor(s):
* Rich Healey <richo AT psych0tik DOT net> * Rich Healey <richo AT psych0tik DOT net>
* Javier Perez-Griffo <javier AT besol DOT es>
* James Tan <jamestyj AT gmail DOT com>
* *
* Alternatively, the contents of this file may be used under the terms of * 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 * either the GNU General Public License Version 2 or later (the "GPL"), or
@ -47,14 +49,20 @@ var ShHighlightRules = function() {
var reservedKeywords = lang.arrayToMap( var reservedKeywords = lang.arrayToMap(
('!|{|}|case|do|done|elif|else|'+ ('!|{|}|case|do|done|elif|else|'+
'esac|fi|for|if|in|then|until|while|'+ 'esac|fi|for|if|in|then|until|while|'+
'&|;' '&|;|export|local|read|typeset|unset|'+
'elif|select|set'
).split('|') ).split('|')
); );
var languageConstructs = lang.arrayToMap( var languageConstructs = lang.arrayToMap(
// TODO ('[|]|alias|bg|bind|break|builtin|'+
('echo|exit|eval|source|[|]|test|'+ 'cd|command|compgen|complete|continue|'+
'true|false|read' 'dirs|disown|echo|enable|eval|exec|'+
'exit|fc|fg|getopts|hash|help|history|'+
'jobs|kill|let|logout|popd|printf|pushd|'+
'pwd|return|set|shift|shopt|source|'+
'suspend|test|times|trap|type|ulimit|'+
'umask|unalias|wait'
).split('|') ).split('|')
); );

View file

@ -65,8 +65,6 @@ var TextHighlightRules = function() {
var rule = state[i]; var rule = state[i];
if (rule.next) { if (rule.next) {
rule.next = prefix + rule.next; rule.next = prefix + rule.next;
} else {
rule.next = prefix + key;
} }
} }
this.$rules[prefix + key] = state; this.$rules[prefix + key] = state;

View file

@ -111,9 +111,10 @@ function onMouseDown(e) {
if (!isMultiSelect && inSelection) if (!isMultiSelect && inSelection)
return; // dragging return; // dragging
if (!isMultiSelect) if (!isMultiSelect) {
selection.addRange(selection.toOrientedRange()); var range = selection.toOrientedRange();
editor.addSelectionMarker(range);
}
var oldRange = selection.rangeList.rangeAtPoint(pos); var oldRange = selection.rangeList.rangeAtPoint(pos);
@ -122,8 +123,13 @@ function onMouseDown(e) {
if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor)) if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
selection.substractPoint(tmpSel.cursor); selection.substractPoint(tmpSel.cursor);
else else {
if (range) {
editor.removeSelectionMarker(range);
selection.addRange(range);
}
selection.addRange(tmpSel); selection.addRange(tmpSel);
}
}); });
} else if (!shift && alt && button == 0) { } else if (!shift && alt && button == 0) {

View file

@ -76,18 +76,19 @@ var EditSession = require("./edit_session").EditSession;
* *
* adds a range to selection entering multiselect mode if necessary * adds a range to selection entering multiselect mode if necessary
**/ **/
this.addRange = function(range) { this.addRange = function(range, $blockChangeEvents) {
if (!this.inMultiSelectMode && this.rangeCount == 0) {
var oldRange = this.toOrientedRange();
if (!range || !range.isEqual(oldRange)) {
this.rangeList.add(oldRange);
this.$onAddRange(oldRange);
}
}
if (!range) if (!range)
return; return;
if (!this.inMultiSelectMode && this.rangeCount == 0) {
var oldRange = this.toOrientedRange();
if (range.intersects(oldRange))
return $blockChangeEvents || this.fromOrientedRange(range);
this.rangeList.add(oldRange);
this.$onAddRange(oldRange);
}
if (!range.cursor) if (!range.cursor)
range.cursor = range.end; range.cursor = range.end;
@ -98,12 +99,14 @@ var EditSession = require("./edit_session").EditSession;
if (removed.length) if (removed.length)
this.$onRemoveRange(removed); this.$onRemoveRange(removed);
if (this.rangeCount > 0 && !this.inMultiSelectMode) { if (this.rangeCount > 1 && !this.inMultiSelectMode) {
this._emit("multiSelect"); this._emit("multiSelect");
this.inMultiSelectMode = true; this.inMultiSelectMode = true;
this.session.$undoSelect = false; this.session.$undoSelect = false;
this.rangeList.attach(this.session); this.rangeList.attach(this.session);
} }
return $blockChangeEvents || this.fromOrientedRange(range);
}; };
this.toSingleRange = function(range) { this.toSingleRange = function(range) {
@ -145,7 +148,6 @@ var EditSession = require("./edit_session").EditSession;
this.$onAddRange = function(range) { this.$onAddRange = function(range) {
this.rangeCount = this.rangeList.ranges.length; this.rangeCount = this.rangeList.ranges.length;
this.ranges.unshift(range); this.ranges.unshift(range);
this.fromOrientedRange(range);
this._emit("addRange", {range: range}); this._emit("addRange", {range: range});
}; };
@ -309,17 +311,34 @@ var Editor = require("./editor").Editor;
return orientedRange; return orientedRange;
}; };
/**
* Editor.removeSelectionMarker(range) -> Void
* - range: selection range added with addSelectionMarker
*
* removes selection marker
**/
this.removeSelectionMarker = function(range) {
if (!range.marker)
return;
this.session.removeMarker(range.marker);
var index = this.session.$selectionMarkers.indexOf(range);
if (index != -1)
this.session.$selectionMarkers.splice(index, 1);
this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
};
this.removeSelectionMarkers = function(ranges) { this.removeSelectionMarkers = function(ranges) {
var markerList = this.session.$selectionMarkers;
for (var i = ranges.length; i--; ) { for (var i = ranges.length; i--; ) {
var range = ranges[i]; var range = ranges[i];
if (!range.marker) if (!range.marker)
continue; continue;
this.session.removeMarker(range.marker); this.session.removeMarker(range.marker);
var index = this.session.$selectionMarkers.indexOf(range); var index = markerList.indexOf(range);
if (index != -1) if (index != -1)
this.session.$selectionMarkers.splice(index, 1); markerList.splice(index, 1);
} }
this.session.selectionMarkerCount = this.session.$selectionMarkers.length; this.session.selectionMarkerCount = markerList.length;
}; };
this.$onAddRange = function(e) { this.$onAddRange = function(e) {
@ -442,6 +461,37 @@ var Editor = require("./editor").Editor;
return text; return text;
}; };
/**
* Editor.findAll(dir, options) -> Number
* - needle: text to find
* - options: search options
* - additive: keeps
*
* finds and selects all the occurencies of needle
* returns number of found ranges
**/
this.findAll = function(needle, options, additive) {
options = options || {};
options.needle = needle || options.needle;
this.$search.set(options);
var ranges = this.$search.findAll(this.session);
if (!ranges.length)
return 0;
this.$blockScrolling += 1;
var selection = this.multiSelect;
if (!additive)
selection.toSingleRange(ranges[0]);
for (var i = ranges.length; i--; )
selection.addRange(ranges[i], true);
this.$blockScrolling -= 1;
return ranges.length;
};
// commands // commands
/** /**
@ -623,6 +673,33 @@ function MultiSelect(editor) {
editor.on("mousedown", onMouseDown); editor.on("mousedown", onMouseDown);
editor.commands.addCommands(exports.commands.defaultCommands); editor.commands.addCommands(exports.commands.defaultCommands);
addAltCursorListeners(editor);
}
function addAltCursorListeners(editor){
var el = editor.textInput.getElement();
var altCursor = false;
var contentEl = editor.renderer.content;
el.addEventListener("keydown", function(e) {
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
if (!altCursor) {
contentEl.style.cursor = "crosshair";
altCursor = true;
}
} else if (altCursor) {
contentEl.style.cursor = "";
}
});
el.addEventListener("keyup", reset);
el.addEventListener("blur", reset);
function reset() {
if (altCursor) {
contentEl.style.cursor = "";
altCursor = false;
}
}
} }
exports.MultiSelect = MultiSelect; exports.MultiSelect = MultiSelect;

View file

@ -57,7 +57,7 @@ var exec = function(name, times, args) {
} while(times --> 1) } while(times --> 1)
}; };
var testRanges = function(str) { var testRanges = function(str) {
assert.equal(editor.selection.getAllRanges()+"", str); assert.equal(editor.selection.getAllRanges() + "", str + "");
} }
module.exports = { module.exports = {
@ -78,8 +78,8 @@ module.exports = {
assert.ok(editor.inMultiSelectMode); assert.ok(editor.inMultiSelectMode);
assert.equal(editor.selection.getAllRanges().length, 4); assert.equal(editor.selection.getAllRanges().length, 4);
var newLine = editor.session.getDocument().getNewLineCharacter(); var newLine = editor.session.getDocument().getNewLineCharacter();
var copyText = "wwww".split("").join(newLine); var copyText = "wwww".split("").join(newLine);
assert.equal(editor.getCopyText(), copyText); assert.equal(editor.getCopyText(), copyText);
exec("insertstring", 1, "a"); exec("insertstring", 1, "a");
exec("backspace", 2); exec("backspace", 2);
@ -120,14 +120,11 @@ module.exports = {
" wtt.w", " wtt.w",
" wtt.w" " wtt.w"
]); ]);
var editor = new Editor(new MockRenderer(), doc); editor = new Editor(new MockRenderer(), doc);
MultiSelect(editor); MultiSelect(editor);
editor.selectMoreLines(1) editor.selectMoreLines(1)
assert.equal( testRanges("Range: [0/0] -> [0/0],Range: [1/0] -> [1/0]");
editor.selection.getAllRanges()+"",
"Range: [0/0] -> [0/0],Range: [1/0] -> [1/0]"
);
assert.ok(editor.inMultiSelectMode); assert.ok(editor.inMultiSelectMode);
var doc2 = new EditSession(["w1"]); var doc2 = new EditSession(["w1"]);
@ -136,6 +133,34 @@ module.exports = {
editor.setSession(doc); editor.setSession(doc);
assert.ok(editor.inMultiSelectMode); assert.ok(editor.inMultiSelectMode);
},
"test: multiselect addRange": function() {
var doc = new EditSession([
"w1.w2",
" wtt.w",
" wtt.w"
]);
editor = new Editor(new MockRenderer(), doc);
MultiSelect(editor);
var selection = editor.selection;
var range1 = new Range(0, 2, 0, 4);
editor.selection.fromOrientedRange(range1);
var range2 = new Range(0, 3, 0, 4);
selection.addRange(range2);
assert.ok(!editor.inMultiSelectMode);
assert.ok(range2.isEqual(editor.selection.getRange()));
var range3 = new Range(0, 1, 0, 1);
selection.addRange(range3);
assert.ok(editor.inMultiSelectMode);
testRanges([range3, range2]);
var range4 = new Range(0, 0, 4, 0);
selection.addRange(range4);
assert.ok(!editor.inMultiSelectMode);
} }
}; };

View file

@ -117,7 +117,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
} }
this.intersectsRange = function(range) { this.intersects = function(range) {
var cmp = this.compareRange(range); var cmp = this.compareRange(range);
return (cmp == -1 || cmp == 0 || cmp == 1); return (cmp == -1 || cmp == 0 || cmp == 1);
} }

View file

@ -56,7 +56,7 @@ var Split = function(container, theme, splits) {
this.$splits = 0; this.$splits = 0;
this.$editorCSS = ""; this.$editorCSS = "";
this.$editors = []; this.$editors = [];
this.$oriantation = this.BESIDE; this.$orientation = this.BESIDE;
this.setSplits(splits || 1); this.setSplits(splits || 1);
this.$cEditor = this.$editors[0]; this.$cEditor = this.$editors[0];
@ -213,15 +213,15 @@ var Split = function(container, theme, splits) {
return session; return session;
}; };
this.getOriantation = function() { this.getOrientation = function() {
return this.$oriantation; return this.$orientation;
}; };
this.setOriantation = function(oriantation) { this.setOrientation = function(orientation) {
if (this.$oriantation == oriantation) { if (this.$orientation == orientation) {
return; return;
} }
this.$oriantation = oriantation; this.$orientation = orientation;
this.resize(); this.resize();
}; };
@ -230,7 +230,7 @@ var Split = function(container, theme, splits) {
var height = this.$container.clientHeight; var height = this.$container.clientHeight;
var editor; var editor;
if (this.$oriantation == this.BESIDE) { if (this.$orientation == this.BESIDE) {
var editorWidth = width / this.$splits; var editorWidth = width / this.$splits;
for (var i = 0; i < this.$splits; i++) { for (var i = 0; i < this.$splits; i++) {
editor = this.$editors[i]; editor = this.$editors[i];

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-clouds .ace_cursor {\ .ace-clouds .ace_cursor {\
border-left: 1px solid #000000;\ border-left: 2px solid #000000;\
}\ }\
\ \
.ace-clouds .ace_cursor.ace_overwrite {\ .ace-clouds .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #BDD5FC;\ background: #BDD5FC;\
}\ }\
\ \
.ace-clouds.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #FFFFFF;\
border-radius: 2px;\
}\
\
.ace-clouds .ace_marker-layer .ace_step {\ .ace-clouds .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-clouds-midnight .ace_cursor {\ .ace-clouds-midnight .ace_cursor {\
border-left: 1px solid #7DA5DC;\ border-left: 2px solid #7DA5DC;\
}\ }\
\ \
.ace-clouds-midnight .ace_cursor.ace_overwrite {\ .ace-clouds-midnight .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #000000;\ background: #000000;\
}\ }\
\ \
.ace-clouds-midnight.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #191919;\
border-radius: 2px;\
}\
\
.ace-clouds-midnight .ace_marker-layer .ace_step {\ .ace-clouds-midnight .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-cobalt .ace_cursor {\ .ace-cobalt .ace_cursor {\
border-left: 1px solid #FFFFFF;\ border-left: 2px solid #FFFFFF;\
}\ }\
\ \
.ace-cobalt .ace_cursor.ace_overwrite {\ .ace-cobalt .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(179, 101, 57, 0.75);\ background: rgba(179, 101, 57, 0.75);\
}\ }\
\ \
.ace-cobalt.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #002240;\
border-radius: 2px;\
}\
\
.ace-cobalt .ace_marker-layer .ace_step {\ .ace-cobalt .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-dawn .ace_cursor {\ .ace-dawn .ace_cursor {\
border-left: 1px solid #000000;\ border-left: 2px solid #000000;\
}\ }\
\ \
.ace-dawn .ace_cursor.ace_overwrite {\ .ace-dawn .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(39, 95, 255, 0.30);\ background: rgba(39, 95, 255, 0.30);\
}\ }\
\ \
.ace-dawn.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #F9F9F9;\
border-radius: 2px;\
}\
\
.ace-dawn .ace_marker-layer .ace_step {\ .ace-dawn .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -67,7 +67,7 @@ exports.cssText = ".ace-eclipse .ace_editor {\
}\ }\
\ \
.ace-eclipse .ace_cursor {\ .ace-eclipse .ace_cursor {\
border-left: 1px solid black;\ border-left: 2px solid black;\
}\ }\
\ \
.ace-eclipse .ace_line .ace_storage,\ .ace-eclipse .ace_line .ace_storage,\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-idle-fingers .ace_cursor {\ .ace-idle-fingers .ace_cursor {\
border-left: 1px solid #91FF00;\ border-left: 2px solid #91FF00;\
}\ }\
\ \
.ace-idle-fingers .ace_cursor.ace_overwrite {\ .ace-idle-fingers .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(90, 100, 126, 0.88);\ background: rgba(90, 100, 126, 0.88);\
}\ }\
\ \
.ace-idle-fingers.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #323232;\
border-radius: 2px;\
}\
\
.ace-idle-fingers .ace_marker-layer .ace_step {\ .ace-idle-fingers .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-kr-theme .ace_cursor {\ .ace-kr-theme .ace_cursor {\
border-left: 1px solid #FF9900;\ border-left: 2px solid #FF9900;\
}\ }\
\ \
.ace-kr-theme .ace_cursor.ace_overwrite {\ .ace-kr-theme .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(170, 0, 255, 0.45);\ background: rgba(170, 0, 255, 0.45);\
}\ }\
\ \
.ace-kr-theme.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #0B0A09;\
border-radius: 2px;\
}\
\
.ace-kr-theme .ace_marker-layer .ace_step {\ .ace-kr-theme .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-merbivore .ace_cursor {\ .ace-merbivore .ace_cursor {\
border-left: 1px solid #FFFFFF;\ border-left: 2px solid #FFFFFF;\
}\ }\
\ \
.ace-merbivore .ace_cursor.ace_overwrite {\ .ace-merbivore .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #454545;\ background: #454545;\
}\ }\
\ \
.ace-merbivore.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #161616;\
border-radius: 2px;\
}\
\
.ace-merbivore .ace_marker-layer .ace_step {\ .ace-merbivore .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-merbivore-soft .ace_cursor {\ .ace-merbivore-soft .ace_cursor {\
border-left: 1px solid #FFFFFF;\ border-left: 2px solid #FFFFFF;\
}\ }\
\ \
.ace-merbivore-soft .ace_cursor.ace_overwrite {\ .ace-merbivore-soft .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #494949;\ background: #494949;\
}\ }\
\ \
.ace-merbivore-soft.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #1C1C1C;\
border-radius: 2px;\
}\
\
.ace-merbivore-soft .ace_marker-layer .ace_step {\ .ace-merbivore-soft .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-mono-industrial .ace_cursor {\ .ace-mono-industrial .ace_cursor {\
border-left: 1px solid #FFFFFF;\ border-left: 2px solid #FFFFFF;\
}\ }\
\ \
.ace-mono-industrial .ace_cursor.ace_overwrite {\ .ace-mono-industrial .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(145, 153, 148, 0.40);\ background: rgba(145, 153, 148, 0.40);\
}\ }\
\ \
.ace-mono-industrial.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #222C28;\
border-radius: 2px;\
}\
\
.ace-mono-industrial .ace_marker-layer .ace_step {\ .ace-mono-industrial .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-monokai .ace_cursor {\ .ace-monokai .ace_cursor {\
border-left: 1px solid #F8F8F0;\ border-left: 2px solid #F8F8F0;\
}\ }\
\ \
.ace-monokai .ace_cursor.ace_overwrite {\ .ace-monokai .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #49483E;\ background: #49483E;\
}\ }\
\ \
.ace-monokai.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #272822;\
border-radius: 2px;\
}\
\
.ace-monokai .ace_marker-layer .ace_step {\ .ace-monokai .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-pastel-on-dark .ace_cursor {\ .ace-pastel-on-dark .ace_cursor {\
border-left: 1px solid #A7A7A7;\ border-left: 2px solid #A7A7A7;\
}\ }\
\ \
.ace-pastel-on-dark .ace_cursor.ace_overwrite {\ .ace-pastel-on-dark .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(221, 240, 255, 0.20);\ background: rgba(221, 240, 255, 0.20);\
}\ }\
\ \
.ace-pastel-on-dark.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #2C2828;\
border-radius: 2px;\
}\
\
.ace-pastel-on-dark .ace_marker-layer .ace_step {\ .ace-pastel-on-dark .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-solarized-dark .ace_cursor {\ .ace-solarized-dark .ace_cursor {\
border-left: 1px solid #D30102;\ border-left: 2px solid #D30102;\
}\ }\
\ \
.ace-solarized-dark .ace_cursor.ace_overwrite {\ .ace-solarized-dark .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #073642;\ background: #073642;\
}\ }\
\ \
.ace-solarized-dark.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #002B36;\
border-radius: 2px;\
}\
\
.ace-solarized-dark .ace_marker-layer .ace_step {\ .ace-solarized-dark .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-solarized-light .ace_cursor {\ .ace-solarized-light .ace_cursor {\
border-left: 1px solid #000000;\ border-left: 2px solid #000000;\
}\ }\
\ \
.ace-solarized-light .ace_cursor.ace_overwrite {\ .ace-solarized-light .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #073642;\ background: #073642;\
}\ }\
\ \
.ace-solarized-light.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #FDF6E3;\
border-radius: 2px;\
}\
\
.ace-solarized-light .ace_marker-layer .ace_step {\ .ace-solarized-light .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -67,7 +67,7 @@ exports.cssText = ".ace-tm .ace_editor {\
}\ }\
\ \
.ace-tm .ace_cursor {\ .ace-tm .ace_cursor {\
border-left: 1px solid black;\ border-left: 2px solid black;\
}\ }\
\ \
.ace-tm .ace_cursor.ace_overwrite {\ .ace-tm .ace_cursor.ace_overwrite {\
@ -169,7 +169,10 @@ exports.cssText = ".ace-tm .ace_editor {\
.ace-tm .ace_marker-layer .ace_selection {\ .ace-tm .ace_marker-layer .ace_selection {\
background: rgb(181, 213, 255);\ background: rgb(181, 213, 255);\
}\ }\
\ .ace-tm.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px white;\
border-radius: 2px;\
}\
.ace-tm .ace_marker-layer .ace_step {\ .ace-tm .ace_marker-layer .ace_step {\
background: rgb(252, 255, 0);\ background: rgb(252, 255, 0);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-tomorrow .ace_cursor {\ .ace-tomorrow .ace_cursor {\
border-left: 1px solid #AEAFAD;\ border-left: 2px solid #AEAFAD;\
}\ }\
\ \
.ace-tomorrow .ace_cursor.ace_overwrite {\ .ace-tomorrow .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #D6D6D6;\ background: #D6D6D6;\
}\ }\
\ \
.ace-tomorrow.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #FFFFFF;\
border-radius: 2px;\
}\
\
.ace-tomorrow .ace_marker-layer .ace_step {\ .ace-tomorrow .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-tomorrow-night .ace_cursor {\ .ace-tomorrow-night .ace_cursor {\
border-left: 1px solid #AEAFAD;\ border-left: 2px solid #AEAFAD;\
}\ }\
\ \
.ace-tomorrow-night .ace_cursor.ace_overwrite {\ .ace-tomorrow-night .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #373B41;\ background: #373B41;\
}\ }\
\ \
.ace-tomorrow-night.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #1D1F21;\
border-radius: 2px;\
}\
\
.ace-tomorrow-night .ace_marker-layer .ace_step {\ .ace-tomorrow-night .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-tomorrow-night-blue .ace_cursor {\ .ace-tomorrow-night-blue .ace_cursor {\
border-left: 1px solid #FFFFFF;\ border-left: 2px solid #FFFFFF;\
}\ }\
\ \
.ace-tomorrow-night-blue .ace_cursor.ace_overwrite {\ .ace-tomorrow-night-blue .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #003F8E;\ background: #003F8E;\
}\ }\
\ \
.ace-tomorrow-night-blue.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #002451;\
border-radius: 2px;\
}\
\
.ace-tomorrow-night-blue .ace_marker-layer .ace_step {\ .ace-tomorrow-night-blue .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-tomorrow-night-bright .ace_cursor {\ .ace-tomorrow-night-bright .ace_cursor {\
border-left: 1px solid #9F9F9F;\ border-left: 2px solid #9F9F9F;\
}\ }\
\ \
.ace-tomorrow-night-bright .ace_cursor.ace_overwrite {\ .ace-tomorrow-night-bright .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #424242;\ background: #424242;\
}\ }\
\ \
.ace-tomorrow-night-bright.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #000000;\
border-radius: 2px;\
}\
\
.ace-tomorrow-night-bright .ace_marker-layer .ace_step {\ .ace-tomorrow-night-bright .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-tomorrow-night-eighties .ace_cursor {\ .ace-tomorrow-night-eighties .ace_cursor {\
border-left: 1px solid #CCCCCC;\ border-left: 2px solid #CCCCCC;\
}\ }\
\ \
.ace-tomorrow-night-eighties .ace_cursor.ace_overwrite {\ .ace-tomorrow-night-eighties .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #515151;\ background: #515151;\
}\ }\
\ \
.ace-tomorrow-night-eighties.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #2D2D2D;\
border-radius: 2px;\
}\
\
.ace-tomorrow-night-eighties .ace_marker-layer .ace_step {\ .ace-tomorrow-night-eighties .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-twilight .ace_cursor {\ .ace-twilight .ace_cursor {\
border-left: 1px solid #A7A7A7;\ border-left: 2px solid #A7A7A7;\
}\ }\
\ \
.ace-twilight .ace_cursor.ace_overwrite {\ .ace-twilight .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: rgba(221, 240, 255, 0.20);\ background: rgba(221, 240, 255, 0.20);\
}\ }\
\ \
.ace-twilight.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #141414;\
border-radius: 2px;\
}\
\
.ace-twilight .ace_marker-layer .ace_step {\ .ace-twilight .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -68,7 +68,7 @@ exports.cssText = "\
}\ }\
\ \
.ace-vibrant-ink .ace_cursor {\ .ace-vibrant-ink .ace_cursor {\
border-left: 1px solid #FFFFFF;\ border-left: 2px solid #FFFFFF;\
}\ }\
\ \
.ace-vibrant-ink .ace_cursor.ace_overwrite {\ .ace-vibrant-ink .ace_cursor.ace_overwrite {\
@ -80,6 +80,11 @@ exports.cssText = "\
background: #6699CC;\ background: #6699CC;\
}\ }\
\ \
.ace-vibrant-ink.multiselect .ace_selection.start {\
box-shadow: 0 0 3px 0px #0F0F0F;\
border-radius: 2px;\
}\
\
.ace-vibrant-ink .ace_marker-layer .ace_step {\ .ace-vibrant-ink .ace_marker-layer .ace_step {\
background: rgb(198, 219, 174);\ background: rgb(198, 219, 174);\
}\ }\

View file

@ -119,9 +119,8 @@ var Tokenizer = function(rules, flag) {
else else
type = rule.token; type = rule.token;
var next = rule.next; if (rule.next) {
if (next && next !== currentState) { currentState = rule.next;
currentState = next;
state = this.rules[currentState]; state = this.rules[currentState];
mapping = this.matchMappings[currentState]; mapping = this.matchMappings[currentState];
lastIndex = re.lastIndex; lastIndex = re.lastIndex;

View file

@ -27,7 +27,7 @@
} }
.%cssClass% .ace_cursor { .%cssClass% .ace_cursor {
border-left: 1px solid %cursor%; border-left: 2px solid %cursor%;
} }
.%cssClass% .ace_cursor.ace_overwrite { .%cssClass% .ace_cursor.ace_overwrite {
@ -39,6 +39,11 @@
background: %selection%; background: %selection%;
} }
.%cssClass%.multiselect .ace_selection.start {
box-shadow: 0 0 3px 0px %background%;
border-radius: 2px;
}
.%cssClass% .ace_marker-layer .ace_step { .%cssClass% .ace_marker-layer .ace_step {
background: %step%; background: %step%;
} }