Merge branch 'master' of github.com:ajaxorg/ace into ui/optimize-experimental

This commit is contained in:
Ruben Daniels 2012-06-13 22:54:39 -07:00
commit 575cec571e
591 changed files with 72910 additions and 314039 deletions

View file

@ -41,6 +41,9 @@ define(function(require, exports, module) {
var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter;
// tokenizing lines longer than this makes editor very slow
var MAX_LINE_LENGTH = 5000;
/**
* class BackgroundTokenizer
*
@ -59,8 +62,9 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
**/
var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false;
this.running = false;
this.lines = [];
this.states = [];
this.currentLine = 0;
this.tokenizer = tokenizer;
@ -77,11 +81,12 @@ var BackgroundTokenizer = function(tokenizer, editor) {
var len = doc.getLength();
while (self.currentLine < len) {
self.lines[self.currentLine] = self.$tokenizeRows(self.currentLine, self.currentLine)[0];
self.currentLine++;
self.$tokenizeRow(self.currentLine);
while (self.lines[self.currentLine])
self.currentLine++;
// only check every 5 lines
processedLines += 1;
processedLines ++;
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
self.fireUpdateEvent(startLine, self.currentLine-1);
self.running = setTimeout(self.$worker, 20);
@ -106,10 +111,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Sets a new tokenizer for this object.
*
**/
this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer;
this.lines = [];
this.states = [];
this.start(0);
};
@ -121,10 +126,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Sets a new document to associate with this object.
*
**/
this.setDocument = function(doc) {
this.doc = doc;
this.lines = [];
this.states = [];
this.stop();
};
@ -137,7 +142,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
*
**/
this.fireUpdateEvent = function(firstRow, lastRow) {
var data = {
first: firstRow,
@ -153,13 +157,36 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Starts tokenizing at the row indicated.
*
**/
this.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine,
this.doc.getLength());
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
// remove all cached items below this line
this.lines.splice(this.currentLine, this.lines.length);
this.states.splice(this.currentLine, this.states.length);
this.stop();
// pretty long delay to prevent the tokenizer from interfering with the user
this.running = setTimeout(this.$worker, 700);
};
this.$updateOnChange = function(delta) {
var range = delta.range;
var startRow = range.start.row;
var len = range.end.row - startRow;
if (len === 0) {
this.lines[startRow] = null;
} else if (delta.action == "removeText" || delta.action == "removeLines") {
this.lines.splice(startRow, len + 1, null);
this.states.splice(startRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(startRow, 1);
this.lines.splice.apply(this.lines, args);
this.states.splice.apply(this.states, args);
}
this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
this.stop();
// pretty long delay to prevent the tokenizer from interfering with the user
@ -172,7 +199,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Stops tokenizing.
*
**/
this.stop = function() {
if (this.running)
clearTimeout(this.running);
@ -187,71 +213,46 @@ var BackgroundTokenizer = function(tokenizer, editor) {
* Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
*
**/
this.getTokens = function(firstRow, lastRow) {
return this.$tokenizeRows(firstRow, lastRow);
};
/**
* BackgroundTokenizer.getState(row) -> String
* - row (Number): The row to start at
*
* [Returns the state of tokenization for a row.]{: #BackgroundTokenizer.getState}
*
**/
this.getState = function(row) {
return this.$tokenizeRows(row, row)[0].state;
this.getTokens = function(row) {
return this.lines[row] || this.$tokenizeRow(row);
};
/**
* BackgroundTokenizer.$tokenizeRows(firstRow, lastRow) -> [Object]
* - startRow (Number): The row to start at
* - lastRow (Number): The row to finish at
* + ([Object]): A list of the tokenized rows. Each item in the list is an object with two properties, `state` and `start`.
*
* Tokenizes all the rows within the specified region.
*
* BackgroundTokenizer.getState(row) -> String
* - row (Number): The row to start at
*
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
**/
this.$tokenizeRows = function(firstRow, lastRow) {
if (!this.doc || isNaN(firstRow) || isNaN(lastRow))
return [{'state':'start','tokens':[]}];
var rows = [];
this.getState = function(row) {
if (this.currentLine == row)
this.$tokenizeRow(row);
return this.states[row] || "start";
};
// determine start state
var state = "start";
var doCache = false;
if (firstRow > 0 && this.lines[firstRow - 1]) {
state = this.lines[firstRow - 1].state;
doCache = true;
} else if (firstRow == 0) {
state = "start";
doCache = true;
} else if (this.lines.length > 0) {
// Guess that we haven't changed state.
state = this.lines[this.lines.length-1].state;
this.$tokenizeRow = function(row) {
var line = this.doc.getLine(row);
var state = this.states[row - 1];
if (line.length > MAX_LINE_LENGTH) {
var overflow = {value: line.substr(MAX_LINE_LENGTH), type: "text"};
line = line.slice(0, MAX_LINE_LENGTH);
}
var data = this.tokenizer.getLineTokens(line, state);
if (overflow) {
data.tokens.push(overflow);
data.state = "start";
}
var lines = this.doc.getLines(firstRow, lastRow);
for (var row=firstRow; row<=lastRow; row++) {
if (!this.lines[row]) {
var tokens = this.tokenizer.getLineTokens(lines[row-firstRow] || "", state);
var state = tokens.state;
rows.push(tokens);
if (doCache) {
this.lines[row] = tokens;
}
}
else {
var tokens = this.lines[row];
state = tokens.state;
rows.push(tokens);
}
if (this.states[row] !== data.state) {
this.states[row] = data.state;
this.lines[row + 1] = null;
if (this.currentLine > row + 1)
this.currentLine = row + 1;
} else if (this.currentLine == row) {
this.currentLine = row + 1;
}
return rows;
return this.lines[row] = data.tokens;
};
}).call(BackgroundTokenizer.prototype);

View file

@ -0,0 +1,92 @@
/* ***** 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):
* Harutyun Amirjanyan <harutyun@c9.io>
*
* 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 ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var EditSession = require("./edit_session").EditSession;
var JavaScriptMode = require("./mode/javascript").Mode;
var Range = require("./range").Range;
var assert = require("./test/assertions");
function forceTokenize(session){
for (var i = 0, l = session.getLength(); i < l; i++)
session.getTokens(i)
}
function testStates(session, states) {
for (var i = 0, l = session.getLength(); i < l; i++)
assert.equal(session.bgTokenizer.states[i], states[i])
assert.ok(l == states.length)
}
module.exports = {
"test background tokenizer update on session change" : function() {
var doc = new EditSession([
"/*",
"*/",
"var juhu"
]);
doc.setMode("./mode/javascript")
forceTokenize(doc)
testStates(doc, ["comment", "start", "start"])
doc.remove(new Range(0,2,1,2))
testStates(doc, [null, "start"])
forceTokenize(doc)
testStates(doc, ["comment", "comment"])
doc.insert({row:0, column:2}, "\n*/")
testStates(doc, [undefined, undefined, "comment"])
forceTokenize(doc)
testStates(doc, ["comment", "start", "start"])
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}

View file

@ -51,16 +51,11 @@ oop.inherits(CommandManager, HashHandler);
if (editor && editor.$readOnly && !command.readOnly)
return false;
try {
var retvalue = this._emit("exec", {
editor: editor,
command: command,
args: args
});
} catch (e) {
window.console && window.console.log(e);
return true;
}
var retvalue = this._emit("exec", {
editor: editor,
command: command,
args: args
});
return retvalue === false ? false : true;
};

View file

@ -72,22 +72,22 @@ exports.commands = [{
readOnly: true
}, {
name: "fold",
bindKey: bindKey("Alt-L", "Alt-L"),
bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
exec: function(editor) { editor.session.toggleFold(false); },
readOnly: true
}, {
name: "unfold",
bindKey: bindKey("Alt-Shift-L", "Alt-Shift-L"),
bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
exec: function(editor) { editor.session.toggleFold(true); },
readOnly: true
}, {
name: "foldall",
bindKey: bindKey("Alt-0", "Alt-0"),
bindKey: bindKey("Alt-0", "Command-Option-0"),
exec: function(editor) { editor.session.foldAll(); },
readOnly: true
}, {
name: "unfoldall",
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
exec: function(editor) { editor.session.unfold(); },
readOnly: true
}, {
@ -110,17 +110,17 @@ exports.commands = [{
readOnly: true
}, {
name: "overwrite",
bindKey: bindKey("Insert", "Insert"),
bindKey: "Insert",
exec: function(editor) { editor.toggleOverwrite(); },
readOnly: true
}, {
name: "selecttostart",
bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); },
readOnly: true
}, {
name: "gotostart",
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); },
readOnly: true
}, {
@ -137,13 +137,13 @@ exports.commands = [{
readOnly: true
}, {
name: "selecttoend",
bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
exec: function(editor) { editor.getSelection().selectFileEnd(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "gotoend",
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
exec: function(editor) { editor.navigateFileEnd(); },
multiSelectAction: "forEach",
readOnly: true
@ -233,43 +233,53 @@ exports.commands = [{
readOnly: true
}, {
name: "selectpagedown",
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
bindKey: "Shift-PageDown",
exec: function(editor) { editor.selectPageDown(); },
readOnly: true
}, {
name: "pagedown",
bindKey: bindKey(null, "PageDown"),
bindKey: bindKey(null, "Option-PageDown"),
exec: function(editor) { editor.scrollPageDown(); },
readOnly: true
}, {
name: "gotopagedown",
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
exec: function(editor) { editor.gotoPageDown(); },
readOnly: true
}, {
name: "selectpageup",
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
bindKey: "Shift-PageUp",
exec: function(editor) { editor.selectPageUp(); },
readOnly: true
}, {
name: "pageup",
bindKey: bindKey(null, "PageUp"),
bindKey: bindKey(null, "Option-PageUp"),
exec: function(editor) { editor.scrollPageUp(); },
readOnly: true
}, {
name: "gotopageup",
bindKey: bindKey("PageUp", "Option-PageUp"),
bindKey: "PageUp",
exec: function(editor) { editor.gotoPageUp(); },
readOnly: true
}, {
name: "scrollup",
bindKey: bindKey("Ctrl-Up", null),
exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "scrolldown",
bindKey: bindKey("Ctrl-Down", null),
exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
readOnly: true
}, {
name: "selectlinestart",
bindKey: bindKey("Shift-Home", "Shift-Home"),
bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selectlineend",
bindKey: bindKey("Shift-End", "Shift-End"),
bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach",
readOnly: true
@ -285,10 +295,15 @@ exports.commands = [{
readOnly: true
}, {
name: "jumptomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
bindKey: bindKey("Ctrl-P", "Ctrl-P"),
exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach",
readOnly: true
}, {
name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(true); },
readOnly: true
},
// commands disabled in readOnly mode
@ -309,6 +324,11 @@ exports.commands = [{
bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); },
multiSelectAction: "forEach"
}, {
name: "duplicateSelection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); },
multiSelectAction: "forEach"
}, {
name: "togglecomment",
bindKey: bindKey("Ctrl-/", "Command-/"),
@ -348,7 +368,7 @@ exports.commands = [{
exec: function(editor) { editor.redo(); }
}, {
name: "copylinesup",
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); }
}, {
name: "movelinesup",
@ -356,7 +376,7 @@ exports.commands = [{
exec: function(editor) { editor.moveLinesUp(); }
}, {
name: "copylinesdown",
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); }
}, {
name: "movelinesdown",

View file

@ -79,12 +79,15 @@ exports.defaultCommands = [{
exec: function(editor) { editor.selectMore(1, true); },
bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
readonly: true
}, {
}, {
name: "splitIntoLines",
exec: function(editor) { editor.multiSelect.splitIntoLines(); },
bindKey: {win: "Ctrl-Shift-L", mac: "Ctrl-Shift-L"},
readonly: true
}, {
}];
// commands active in multiselect mode
exports.multiSelectCommands = [{
name: "singleSelection",
bindKey: "esc",
exec: function(editor) { editor.exitMultiSelectMode(); },
@ -92,10 +95,7 @@ exports.defaultCommands = [{
isAvailable: function(editor) {return editor.inMultiSelectMode}
}];
// commands active in multiselect mode
exports.multiEditCommands = {"singleSelection": "esc"};
var HashHandler = require("../keyboard/hash_handler").HashHandler;
exports.keyboardHandler = new HashHandler(exports.multiEditCommands);
exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
});

View file

@ -55,14 +55,14 @@ var options = {
exports.get = function(key) {
if (!options.hasOwnProperty(key))
throw new Error("Unknown confik key: " + key);
throw new Error("Unknown config key: " + key);
return options[key];
};
exports.set = function(key, value) {
if (!options.hasOwnProperty(key))
throw new Error("Unknown confik key: " + key);
throw new Error("Unknown config key: " + key);
options[key] = value;
};

View file

@ -1,4 +1,3 @@
.ace_editor {
position: absolute;
overflow: hidden;
@ -20,13 +19,6 @@
cursor: text;
}
.ace_composition {
position: absolute;
background: #555;
color: #DDD;
z-index: 4;
}
.ace_gutter {
position: absolute;
overflow : hidden;
@ -36,12 +28,6 @@
z-index: 4;
}
.ace_gutter_active_line {
position: absolute;
right: 0;
width: 100%;
}
.ace_scroller.horscroll {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
}
@ -97,8 +83,8 @@
height: 100%;
}
.ace_editor textarea {
position: fixed;
.ace_editor > textarea {
position: absolute;
z-index: 0;
width: 0.5em;
height: 1em;
@ -112,6 +98,15 @@
overflow: hidden;
}
.ace_editor > textarea.ace_composition {
background: #fff;
color: #000;
z-index: 1000;
opacity: 1;
border: solid lightgray 1px;
margin: -1px
}
.ace_layer {
z-index: 1;
position: absolute;
@ -130,6 +125,7 @@
.ace_gutter .ace_layer {
position: relative;
min-width: 40px;
width: auto;
text-align: right;
pointer-events: auto;
}
@ -197,13 +193,13 @@
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
display: inline-block;
height: 11px;
margin-top: -2px;
vertical-align: middle;
background-image:
background-image:
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat, repeat-x;
@ -214,7 +210,7 @@
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
cursor: pointer;
pointer-events: auto;
}
@ -223,7 +219,7 @@
}
.ace_fold:hover{
background-image:
background-image:
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat, repeat-x;
@ -248,7 +244,7 @@
height: 14px;
width: 11px;
vertical-align: text-bottom;
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat;
background-position: center 5px;
@ -293,23 +289,19 @@
}
.ace_fade-fold-widgets .ace_fold-widget {
-moz-transition: 0.5s opacity;
-webkit-transition: 0.5s opacity;
-o-transition: 0.5s opacity;
-ms-transition: 0.5s opacity;
transition: 0.5s opacity;
-moz-transition: opacity 0.4s ease 0.05s;
-webkit-transition: opacity 0.4s ease 0.05s;
-o-transition: opacity 0.4s ease 0.05s;
-ms-transition: opacity 0.4s ease 0.05s;
transition: opacity 0.4s ease 0.05s;
opacity: 0;
}
.ace_fade-fold-widgets:hover .ace_fold-widget {
-moz-transition-duration: 0.05s;
-webkit-transition-duration: 0.05s;
-o-transition-duration: 0.05s;
-ms-transition-duration: 0.05s;
transition-duration: 0.05s;
-moz-transition-delay: 0.2s;
-webkit-transition-delay: 0.2s;
-o-transition-delay: 0.2s;
-ms-transition-delay: 0.2s;
transition-delay: 0.2s;
-moz-transition: opacity 0.05s ease 0.05s;
-webkit-transition: opacity 0.05s ease 0.05s;
-o-transition: opacity 0.05s ease 0.05s;
-ms-transition: opacity 0.05s ease 0.05s;
transition: opacity 0.05s ease 0.05s;
opacity:1;
}

View file

@ -61,13 +61,12 @@ var Anchor = require("./anchor").Anchor;
var Document = function(text) {
this.$lines = [];
if (Array.isArray(text)) {
this.insertLines(0, text);
}
// There has to be one line at least in the document. If you pass an empty
// string to the insert function, nothing will happen. Workaround.
else if (text.length == 0) {
if (text.length == 0) {
this.$lines = [""];
} else if (Array.isArray(text)) {
this.insertLines(0, text);
} else {
this.insert({row: 0, column:0}, text);
}
@ -327,6 +326,13 @@ var Document = function(text) {
if (lines.length == 0)
return {row: row, column: 0};
// apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF)
// to circumvent that we have to break huge inserts into smaller chunks here
if (lines.length > 0xFFFF) {
var end = this.insertLines(row, lines.slice(0xFFFF));
lines = lines.slice(0, 0xFFFF);
}
var args = [row, 0];
args.push.apply(args, lines);
this.$lines.splice.apply(this.$lines, args);
@ -338,7 +344,7 @@ var Document = function(text) {
lines: lines
};
this._emit("change", { data: delta });
return range.end;
return end || range.end;
};
/**

File diff suppressed because it is too large Load diff

View file

@ -40,6 +40,7 @@ define(function(require, exports, module) {
"use strict";
var TokenIterator = require("../token_iterator").TokenIterator;
var Range = require("../range").Range;
/**
* class BracketMatch
@ -76,15 +77,56 @@ function BracketMatch() {
if (charBeforeCursor == "") return null;
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
if (!match)
return null;
if (match[1])
return this.$findClosingBracket(match[1], position);
else
return this.$findOpeningBracket(match[2], position);
};
this.getBracketRange = function(pos) {
var line = this.getLine(pos.row);
var before = true, range;
var chr = line.charAt(pos.column-1);
var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
if (!match) {
chr = line.charAt(pos.column);
pos.column++;
match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
before = false;
}
if (!match)
return null;
if (match[1]) {
return this.$findClosingBracket(match[1], position);
var bracketPos = this.$findClosingBracket(match[1], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(pos, bracketPos);
if (!before) {
range.end.column++;
range.start.column--;
}
range.cursor = range.end;
} else {
return this.$findOpeningBracket(match[2], position);
var bracketPos = this.$findOpeningBracket(match[2], pos);
if (!bracketPos)
return null;
range = Range.fromPoints(bracketPos, pos);
if (!before) {
range.start.column++;
range.end.column--;
}
range.cursor = range.start;
}
if (!before)
pos.column--;
return range;
};
this.$brackets = {

View file

@ -340,6 +340,8 @@ function Folding() {
if (this.$useWrapMode)
this.$updateWrapData(foldLine.start.row, foldLine.start.row);
else
this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
// Notify that fold data has changed.
this.$modified = true;
@ -395,9 +397,10 @@ function Folding() {
newFoldLine.start.column = folds[0].start.column;
}
if (this.$useWrapMode) {
if (this.$useWrapMode)
this.$updateWrapData(startRow, endRow);
}
else
this.$updateRowLengthCache(startRow, endRow);
// Notify that fold data has changed.
this.$modified = true;

View file

@ -423,22 +423,18 @@ module.exports = {
"test get longest line" : function() {
var session = new EditSession(["12"]);
session.setTabSize(4);
assert.equal(session.getWidth(), 2);
assert.equal(session.getScreenWidth(), 2);
session.doc.insertNewLine(0);
session.doc.insertNewLine({row: 0, column: Infinity});
session.doc.insertLines(1, ["123"]);
assert.equal(session.getWidth(), 3);
assert.equal(session.getScreenWidth(), 3);
session.doc.insertNewLine(0);
session.doc.insertNewLine({row: 0, column: Infinity});
session.doc.insertLines(1, ["\t\t"]);
assert.equal(session.getWidth(), 3);
assert.equal(session.getScreenWidth(), 8);
session.setTabSize(2);
assert.equal(session.getWidth(), 3);
assert.equal(session.getScreenWidth(), 4);
},

View file

@ -235,6 +235,35 @@ var Editor = function(renderer, session) {
return this.session;
};
/** related to: Document.setValue
* Editor.setValue(val [,dontSelect]) -> String
* - val (String): The new value to set for the document
* - cursorPos (number): 0: selectAll, -1 document start, 1 end
*
* Sets the current document to `val`.
**/
this.setValue = function(val, cursorPos) {
this.session.doc.setValue(val);
if (!cursorPos)
this.selectAll();
else if (cursorPos == 1)
this.navigateFileEnd();
else if (cursorPos == -1)
this.navigateFileStart();
return val;
};
/** related to: EditSession.getValue
* Editor.getValue() -> String
*
* Returns the current session's content.
**/
this.getValue = function() {
return this.session.getValue();
};
/**
* Editor.getSelection() -> String
*
@ -368,6 +397,9 @@ var Editor = function(renderer, session) {
* Emitted once the editor comes into focus.
**/
this.onFocus = function() {
if (this.$isFocused)
return;
this.$isFocused = true;
this.renderer.showCursor();
this.renderer.visualizeFocus();
this._emit("focus");
@ -379,6 +411,9 @@ var Editor = function(renderer, session) {
* Emitted once the editor has been blurred.
**/
this.onBlur = function() {
if (!this.$isFocused)
return;
this.$isFocused = false;
this.renderer.hideCursor();
this.renderer.visualizeBlur();
this._emit("blur");
@ -494,7 +529,7 @@ var Editor = function(renderer, session) {
* Emitted when a selection has changed.
**/
this.onSelectionChange = function(e) {
var session = this.getSession();
var session = this.session;
if (session.$selectionMarker) {
session.removeMarker(session.$selectionMarker);
@ -509,11 +544,40 @@ var Editor = function(renderer, session) {
this.$updateHighlightActiveLine();
}
if (this.$highlightSelectedWord && !this.$wordHighlightTimer)
this.$wordHighlightTimer = setTimeout(function(self) {
self.session.$mode.highlightSelection(self);
self.$wordHighlightTimer = null;
}, 30, this);
var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
this.session.highlight(re);
};
this.$getSelectionHighLightRegexp = function() {
var session = this.session;
var selection = this.getSelectionRange();
if (selection.isEmpty() || selection.isMultiLine())
return;
var startOuter = selection.start.column - 1;
var endOuter = selection.end.column + 1;
var line = session.getLine(selection.start.row);
var lineCols = line.length;
var needle = line.substring(Math.max(startOuter, 0),
Math.min(endOuter, lineCols));
// Make sure the outer characters are not part of the word.
if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
(endOuter <= lineCols && /[\w\d]$/.test(needle)))
return;
needle = line.substring(selection.start.column, selection.end.column);
if (!/^[\w\d]+$/.test(needle))
return;
var re = this.$search.$assembleRegExp({
wholeWord: true,
caseSensitive: true,
needle: needle
});
return re;
};
/**
@ -540,7 +604,7 @@ var Editor = function(renderer, session) {
* Emitted when a breakpoint changes.
**/
this.onChangeBreakpoint = function() {
this.renderer.setBreakpoints(this.session.getBreakpoints());
this.renderer.updateBreakpoints();
};
/**
@ -887,7 +951,7 @@ var Editor = function(renderer, session) {
this.$highlightSelectedWord = true;
/**
* Editor.setHighlightSelectedWord(shouldHighlight)
* Editor.setHighlightSelectedWord(shouldHighlight)
* - shouldHighlight (Boolean): Set to `true` to highlight the currently selected word
*
* Determines if the currently selected word should be highlighted.
@ -897,20 +961,12 @@ var Editor = function(renderer, session) {
return;
this.$highlightSelectedWord = shouldHighlight;
if (shouldHighlight) {
this.session.getMode().highlightSelection(this);
} else {
this.session.getMode().clearSelectionHighlight(this);
if (this.$wordHighlightTimer) {
clearTimeout(this.$wordHighlightTimer);
this.$wordHighlightTimer = null;
}
}
this.$onSelectionChange();
};
/**
* Editor.getHighlightSelectedWord() -> Boolean
*
*
* Returns `true` if currently highlighted words are to be highlighted.
**/
this.getHighlightSelectedWord = function() {
@ -1292,6 +1348,24 @@ var Editor = function(renderer, session) {
this.clearSelection();
};
this.duplicateSelection = function() {
var sel = this.selection;
var doc = this.session;
var range = sel.getRange();
if (range.isEmpty()) {
var row = range.start.row;
doc.duplicateLines(row, row);
} else {
var reverse = sel.isBackwards()
var point = sel.isBackwards() ? range.start : range.end;
var endPoint = doc.insert(point, doc.getTextRange(range), false);
range.start = point;
range.end = endPoint;
sel.setSelectionRange(range, reverse)
}
};
/** related to: EditSession.moveLinesDown
* Editor.moveLinesDown() -> Number
* + (Number): On success, it returns -1.
@ -1604,8 +1678,11 @@ var Editor = function(renderer, session) {
**/
this.centerSelection = function() {
var range = this.getSelectionRange();
var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
this.renderer.scrollToLine(line, true);
var pos = {
row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
}
this.renderer.alignCursor(pos, 0.5);
};
/** related to: Selection.getCursor
@ -1690,21 +1767,34 @@ var Editor = function(renderer, session) {
* Moves the cursor's row and column to the next matching bracket.
*
**/
this.jumpToMatching = function() {
this.jumpToMatching = function(select) {
var cursor = this.getCursorPosition();
var pos = this.session.findMatchingBracket(cursor);
if (!pos) {
cursor.column += 1;
pos = this.session.findMatchingBracket(cursor);
}
if (!pos) {
cursor.column -= 2;
pos = this.session.findMatchingBracket(cursor);
}
var range = this.session.getBracketRange(cursor);
if (!range) {
range = editor.find({
needle: /[{}()\[\]]/g,
preventScroll:true,
start: {row: cursor.row, column: cursor.column - 1}
});
if (!range)
return;
var pos = range.start;
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
range = this.session.getBracketRange(pos);
}
pos = range && range.cursor || pos;
if (pos) {
this.clearSelection();
this.moveCursorTo(pos.row, pos.column);
if (select) {
if (range && range.isEqual(editor.getSelectionRange()))
this.clearSelection();
else
this.selection.selectTo(pos.row, pos.column);
} else {
this.clearSelection();
this.moveCursorTo(pos.row, pos.column);
}
}
};
@ -1953,65 +2043,84 @@ var Editor = function(renderer, session) {
};
/** related to: Search.find
* Editor.find(needle, options)
* - needle (String): The text to search for
* Editor.find(needle, options)
* - needle (String): The text to search for (optional)
* - options (Object): An object defining various search properties
* - animate (Boolean): If `true` animate scrolling
*
* Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
**/
this.find = function(needle, options, animate) {
this.clearSelection();
options = options || {};
options.needle = needle;
if (!options)
options = {};
if (typeof needle == "string" || needle instanceof RegExp)
options.needle = needle;
else if (typeof needle == "object")
oop.mixin(options, needle);
var range = this.selection.getRange();
if (options.needle == null) {
needle = this.session.getTextRange(range)
|| this.$search.$options.needle;
if (!needle) {
range = this.session.getWordRange(range.start.row, range.start.column);
needle = this.session.getTextRange(range);
}
this.$search.set({needle: needle});
}
this.$search.set(options);
this.$find(options.backwards, animate);
if (!options.start)
this.$search.set({start: range});
var newRange = this.$search.find(this.session);
if (options.preventScroll)
return newRange;
if (newRange) {
this.revealRange(newRange, animate);
return newRange;
}
// clear selection if nothing is found
if (options.backwards)
range.start = range.end;
else
range.end = range.start;
this.selection.setRange(range);
};
/** related to: Editor.find
* Editor.findNext(options)
* Editor.findNext(options)
* - options (Object): search options
* - animate (Boolean): If `true` animate scrolling
*
*
* Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]].
**/
this.findNext = function(options, animate) {
options = options || {};
this.$search.set(options);
this.$find(false, animate);
this.find({skipCurrent: true, backwards: false}, options, animate);
};
/** related to: Editor.find
* Editor.findPrevious(options)
* Editor.findPrevious(options)
* - options (Object): search options
* - animate (Boolean): If `true` animate scrolling
*
*
* Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]].
**/
this.findPrevious = function(options, animate) {
options = options || {};
this.$search.set(options);
this.$find(true, animate);
this.find(options, {skipCurrent: true, backwards: true}, animate);
};
this.$find = function(backwards, animate) {
if (!this.selection.isEmpty())
this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())});
this.revealRange = function(range, animate) {
this.$blockScrolling += 1;
this.session.unfold(range);
this.selection.setSelectionRange(range);
this.$blockScrolling -= 1;
if (typeof backwards != "undefined")
this.$search.set({backwards: backwards});
var range = this.$search.find(this.session);
if (range) {
this.$blockScrolling += 1;
this.session.unfold(range);
this.selection.setSelectionRange(range);
this.$blockScrolling -= 1;
var scrollTop = this.renderer.scrollTop;
this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
var scrollTop = this.renderer.scrollTop;
this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
if (animate != false)
this.renderer.animateScrolling(scrollTop);
}
};
/** related to: UndoManager.undo

View file

@ -70,6 +70,16 @@ var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
"libero vehicula odio, eget bibendum mauris velit eu lorem.\n" +
"consectetur";
function callHighlighterUpdate(session, firstRow, lastRow) {
var rangeCount = 0;
var mockMarkerLayer = { drawSingleLineMarker: function() {rangeCount++;} }
session.$searchHighlight.update([], mockMarkerLayer, session, {
firstRow: firstRow,
lastRow: lastRow
});
return rangeCount;
}
module.exports = {
setUp: function(next) {
this.session = new EditSession(lipsum);
@ -87,55 +97,51 @@ module.exports = {
this.editor.moveCursorTo(0, 9);
this.selection.selectWord();
assert.ok(this.editor.$wordHighlightTimer != null);
this.session.$mode.highlightSelection(this.editor);
var highlighter = this.editor.session.$searchHighlight;
assert.ok(highlighter != null);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "ipsum");
assert.equal(this.session.$selectionOccurrences.length, 1);
assert.equal(highlighter.cache.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 2);
},
"test: highlight a word and clear highlight": function() {
this.editor.moveCursorTo(0, 8);
this.selection.selectWord();
this.session.$mode.highlightSelection(this.editor);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "ipsum");
assert.equal(this.session.$selectionOccurrences.length, 1);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 2);
this.session.getMode().clearSelectionHighlight(this.editor);
assert.equal(this.session.$selectionOccurrences.length, 0);
this.session.highlight("");
assert.equal(this.session.$searchHighlight.cache.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: highlight another word": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
this.session.$mode.highlightSelection(this.editor);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolor");
assert.equal(this.session.$selectionOccurrences.length, 3);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 4);
},
"test: no selection, no highlight": function() {
this.selection.clearSelection();
this.session.$mode.highlightSelection(this.editor);
assert.equal(this.session.$selectionOccurrences.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: select a word, no highlight": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
this.session.$mode.highlightSelection(this.editor);
this.editor.setHighlightSelectedWord(false);
assert.ok(this.editor.$wordHighlightTimer == null);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolor");
assert.equal(this.session.$selectionOccurrences.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: select a word with no matches": function() {
@ -156,32 +162,29 @@ module.exports = {
this.search.set(currentOptions);
this.selection.setSelectionRange(match);
this.session.$mode.highlightSelection(this.editor);
assert.equal(this.session.getTextRange(match), "Mauris");
assert.equal(this.session.$selectionOccurrences.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 1);
},
"test: partial word selection 1": function() {
this.selection.moveCursorTo(0, 14);
this.selection.selectWord();
this.selection.selectLeft();
this.session.$mode.highlightSelection(this.editor);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolo");
assert.equal(this.session.$selectionOccurrences.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: partial word selection 2": function() {
this.selection.moveCursorTo(0, 13);
this.selection.selectWord();
this.selection.selectRight();
this.session.$mode.highlightSelection(this.editor);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "dolor ");
assert.equal(this.session.$selectionOccurrences.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: partial word selection 3": function() {
@ -189,11 +192,10 @@ module.exports = {
this.selection.selectWord();
this.selection.selectLeft();
this.selection.shiftSelection(1);
this.session.$mode.highlightSelection(this.editor);
var range = this.selection.getRange();
assert.equal(this.session.getTextRange(range), "olor");
assert.equal(this.session.$selectionOccurrences.length, 0);
assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
},
"test: select last word": function() {
@ -216,10 +218,9 @@ module.exports = {
this.search.set(currentOptions);
this.selection.setSelectionRange(match);
this.session.$mode.highlightSelection(this.editor);
assert.equal(this.session.getTextRange(match), "consectetur");
assert.equal(this.session.$selectionOccurrences.length, 2);
assert.equal(callHighlighterUpdate(this.session, 0, 1), 3);
}
};

View file

@ -52,7 +52,7 @@ var baseStyles = require("../requirejs/text!./static.css");
* @returns {object} An object containing: html, css
*/
exports.render = function(input, mode, theme, lineStart) {
exports.render = function(input, mode, theme, lineStart, disableGutter) {
lineStart = parseInt(lineStart || 1, 10);
var session = new EditSession("");
@ -70,12 +70,12 @@ exports.render = function(input, mode, theme, lineStart) {
var stringBuilder = [];
var length = session.getLength();
var tokens = session.getTokens(0, length - 1);
for(var ix = 0; ix < length; ix++) {
var lineTokens = tokens[ix].tokens;
var lineTokens = session.getTokens(ix);
stringBuilder.push("<div class='ace_line'>");
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
if (!disableGutter)
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, 0, lineTokens, true);
stringBuilder.push("</div>");
}

View file

@ -21,6 +21,7 @@
* Contributor(s):
* Kevin Dangoor (kdangoor@mozilla.com)
* Julian Viereck <julian.viereck@gmail.com>
* Harutyun Amirjanyan [harutyun@c9.io]
*
* 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
@ -39,20 +40,22 @@
define(function(require, exports, module) {
"use strict";
var Event = require("../lib/event");
var event = require("../lib/event");
var UA = require("../lib/useragent");
var net = require("../lib/net");
var ace = require("../ace");
require("ace/theme/textmate");
module.exports = exports = ace;
/*
* Returns the CSS property of element.
* 1) If the CSS property is on the style object of the element, use it, OR
* 2) Compute the CSS property
*
* If the property can't get computed, is 'auto' or 'intrinsic', the former
* calculated property is uesd (this can happen in cases where the textarea
* calculated property is used (this can happen in cases where the textarea
* is hidden and has no dimension styles).
*/
var getCSSProperty = function(element, container, property) {
@ -131,7 +134,7 @@ function setupContainer(element, getValue) {
style += 'display:inline-block;';
container.setAttribute('style', style);
};
Event.addListener(window, 'resize', resizeEvent);
event.addListener(window, 'resize', resizeEvent);
// Call the resizeEvent once, so that the size of the container is
// calculated.
@ -194,11 +197,13 @@ exports.transformTextarea = function(element, loader) {
right: "0px",
bottom: "0px",
background: "red",
cursor: "pointer",
textAlign: "center",
fontSize: "12px"
cursor: "nw-resize",
borderStyle: "solid",
borderWidth: "9px 8px 10px 9px",
width: "2px",
borderColor: "lightblue gray gray lightblue",
zIndex: 101
});
settingOpener.innerHTML = "I";
var settingDiv = document.createElement("div");
var settingDivStyles = {
@ -236,12 +241,41 @@ exports.transformTextarea = function(element, loader) {
editorDiv.appendChild(settingOpener);
// Create the API.
var api = setupApi(editor, editorDiv, settingDiv, ace, options, loader);
setupApi(editor, editorDiv, settingDiv, ace, options, loader);
// Create the setting's panel.
setupSettingPanel(settingDiv, settingOpener, api, options);
setupSettingPanel(settingDiv, settingOpener, editor, options);
var state = "";
event.addListener(settingOpener, "mousemove", function(e) {
var rect = this.getBoundingClientRect();
var x = e.clientX - rect.left, y = e.clientY - rect.top;
if (x + y < (rect.width + rect.height)/2) {
this.style.cursor = "pointer";
state = "toggle";
} else {
state = "resize";
this.style.cursor = "nw-resize";
}
});
event.addListener(settingOpener, "mousedown", function(e) {
if (state == "toggle") {
editor.setDisplaySettings();
return;
}
container.style.zIndex = 100000;
var rect = container.getBoundingClientRect();
var startX = rect.width + rect.left - e.clientX;
var startY = rect.height + rect.top - e.clientY;
event.capture(settingOpener, function(e) {
container.style.width = e.clientX - rect.left + startX + "px";
container.style.height = e.clientY - rect.top + startY + "px";
editor.resize();
}, function() {});
});
return api;
return editor;
};
function load(url, module, callback) {
@ -259,103 +293,103 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
return value == "true";
}
var ret = {
setDisplaySettings: function(display) {
settingDiv.style.display = display ? "block" : "none";
},
editor.setDisplaySettings = function(display) {
if (display == null)
display = settingDiv.style.display == "none";
settingDiv.style.display = display ? "block" : "none";
};
editor.setOption = function(key, value) {
if (options[key] == value) return;
setOption: function(key, value) {
if (options[key] == value) return;
switch (key) {
case "gutter":
renderer.setShowGutter(toBool(value));
break;
switch (key) {
case "gutter":
renderer.setShowGutter(toBool(value));
break;
case "mode":
if (value != "text") {
// Load the required mode file. Files get loaded only once.
loader("mode-" + value + ".js", "ace/mode/" + value, function() {
var aceMode = require("../mode/" + value).Mode;
session.setMode(new aceMode());
});
} else {
session.setMode(new (require("../mode/text").Mode));
}
break;
case "mode":
if (value != "text") {
// Load the required mode file. Files get loaded only once.
loader("mode-" + value + ".js", "ace/mode/" + value, function() {
var aceMode = require("../mode/" + value).Mode;
session.setMode(new aceMode());
});
} else {
session.setMode(new (require("../mode/text").Mode));
}
break;
case "theme":
if (value != "textmate") {
// Load the required theme file. Files get loaded only once.
loader("theme-" + value + ".js", "ace/theme/" + value, function() {
editor.setTheme("ace/theme/" + value);
});
} else {
editor.setTheme("ace/theme/textmate");
}
break;
case "theme":
if (value != "textmate") {
// Load the required theme file. Files get loaded only once.
loader("theme-" + value + ".js", "ace/theme/" + value, function() {
editor.setTheme("ace/theme/" + value);
});
} else {
editor.setTheme("ace/theme/textmate");
}
break;
case "fontSize":
editorDiv.style.fontSize = value;
break;
case "fontSize":
editorDiv.style.fontSize = value;
break;
case "softWrap":
switch (value) {
case "off":
session.setUseWrapMode(false);
renderer.setPrintMarginColumn(80);
break;
case "40":
session.setUseWrapMode(true);
session.setWrapLimitRange(40, 40);
renderer.setPrintMarginColumn(40);
break;
case "80":
session.setUseWrapMode(true);
session.setWrapLimitRange(80, 80);
renderer.setPrintMarginColumn(80);
break;
case "free":
session.setUseWrapMode(true);
session.setWrapLimitRange(null, null);
renderer.setPrintMarginColumn(80);
break;
}
break;
case "softWrap":
switch (value) {
case "off":
session.setUseWrapMode(false);
renderer.setPrintMarginColumn(80);
break;
case "40":
session.setUseWrapMode(true);
session.setWrapLimitRange(40, 40);
renderer.setPrintMarginColumn(40);
break;
case "80":
session.setUseWrapMode(true);
session.setWrapLimitRange(80, 80);
renderer.setPrintMarginColumn(80);
break;
case "free":
session.setUseWrapMode(true);
session.setWrapLimitRange(null, null);
renderer.setPrintMarginColumn(80);
break;
}
break;
case "useSoftTabs":
session.setUseSoftTabs(toBool(value));
break;
case "useSoftTabs":
session.setUseSoftTabs(toBool(value));
break;
case "showPrintMargin":
renderer.setShowPrintMargin(toBool(value));
break;
case "showPrintMargin":
renderer.setShowPrintMargin(toBool(value));
break;
case "showInvisibles":
editor.setShowInvisibles(toBool(value));
break;
}
options[key] = value;
},
getOption: function(key) {
return options[key];
},
getOptions: function() {
return options;
case "showInvisibles":
editor.setShowInvisibles(toBool(value));
break;
}
options[key] = value;
};
editor.getOption = function(key) {
return options[key];
};
editor.getOptions = function() {
return options;
};
for (var option in exports.options) {
ret.setOption(option, exports.options[option]);
editor.setOption(option, exports.options[option]);
}
return ret;
return editor;
}
function setupSettingPanel(settingDiv, settingOpener, api, options) {
function setupSettingPanel(settingDiv, settingOpener, editor, options) {
var BOOL = {
"true": true,
"false": false
@ -472,7 +506,7 @@ function setupSettingPanel(settingDiv, settingOpener, api, options) {
return function() {
var option = select.title;
var value = select.value;
api.setOption(option, value);
editor.setOption(option, value);
};
})();
selects[i].onchange = onChange;
@ -481,14 +515,10 @@ function setupSettingPanel(settingDiv, settingOpener, api, options) {
var button = document.createElement("input");
button.type = "button";
button.value = "Hide";
button.onclick = function() {
api.setDisplaySettings(false);
};
event.addListener(button, "click", function() {
editor.setDisplaySettings(false);
});
settingDiv.appendChild(button);
settingOpener.onclick = function() {
api.setDisplaySettings(true);
};
}
// Default startup options.

View file

@ -57,9 +57,8 @@ function HashHandler(config, platform) {
this.commands[command.name] = command;
if (command.bindKey) {
if (command.bindKey)
this._buildKeyHash(command);
}
};
this.removeCommand = function(command) {
@ -81,6 +80,10 @@ function HashHandler(config, platform) {
this.bindKey = function(key, command) {
if(!key)
return;
if (typeof command == "function") {
this.addCommand({exec: command, bindKey: key, name: key});
return;
}
var ckb = this.commmandKeyBinding;
key.split("|").forEach(function(keyPart) {

View file

@ -119,7 +119,8 @@ var KeyBinding = function(editor) {
else
success = toExecute.passEvent != true;
if (success && e)
// do not stop input events to not break repeating
if (success && e && hashId != -1)
event.stopEvent(e);
return success;

View file

@ -45,18 +45,22 @@ var useragent = require("../lib/useragent");
var dom = require("../lib/dom");
var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea");
/*/ debug
text.style.opacity = 1
text.style.background = "rgba(0, 250, 0, 0.3)"
text.style.outline = "rgba(0, 250, 0, 0.8) solid 1px"
text.style.outlineOffset = "3px"
/**/
if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true);
text.setAttribute("wrap", "off");
text.style.left = "-10000px";
text.style.position = "fixed";
text.style.top = "-2em";
parentNode.insertBefore(text, parentNode.firstChild);
var PLACEHOLDER = String.fromCharCode(0);
var PLACEHOLDER = useragent.isIE ? "\x01" : "\x01";
sendText();
var inCompostion = false;
@ -64,9 +68,14 @@ var TextInput = function(parentNode, host) {
var pasted = false;
var tempStyle = '';
function select() {
function reset(full) {
try {
text.select();
if (full) {
text.value = PLACEHOLDER;
text.selectionStart = 0;
text.selectionEnd = 1;
} else
text.select();
} catch (e) {}
}
@ -87,11 +96,6 @@ var TextInput = function(parentNode, host) {
else
host.onTextInput(value);
}
// If editor is no longer focused we quit immediately, since
// it means that something else is in charge now.
if (!isFocused())
return false;
}
}
@ -99,19 +103,19 @@ var TextInput = function(parentNode, host) {
pasted = false;
// Safari doesn't fire copy events if no text is selected
text.value = PLACEHOLDER;
select();
reset(true);
}
var onTextInput = function(e) {
if (!inCompostion)
sendText(e.data);
setTimeout(function () {
if (!inCompostion)
sendText(e.data);
reset(true);
}, 0);
};
var onPropertyChange = function(e) {
if (useragent.isOldIE && text.value.charCodeAt(0) > 128) return;
setTimeout(function() {
if (!inCompostion)
sendText();
@ -121,7 +125,7 @@ var TextInput = function(parentNode, host) {
var onCompositionStart = function(e) {
inCompostion = true;
host.onCompositionStart();
if (!useragent.isGecko) setTimeout(onCompositionUpdate, 0);
setTimeout(onCompositionUpdate, 0);
};
var onCompositionUpdate = function() {
@ -141,12 +145,12 @@ var TextInput = function(parentNode, host) {
text.value = copyText;
else
e.preventDefault();
select();
reset();
setTimeout(function () {
sendText();
}, 0);
};
var onCut = function(e) {
copied = true;
var copyText = host.getCopyText();
@ -155,31 +159,15 @@ var TextInput = function(parentNode, host) {
host.onCut();
} else
e.preventDefault();
select();
reset();
setTimeout(function () {
sendText();
}, 0);
};
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
if (useragent.isOldIE) {
var keytable = { 13:1, 27:1 };
event.addListener(text, "keyup", function (e) {
if (inCompostion && (!text.value || keytable[e.keyCode]))
setTimeout(onCompositionEnd, 0);
if ((text.value.charCodeAt(0)|0) < 129) {
return;
}
inCompostion ? onCompositionUpdate() : onCompositionStart();
});
}
if ("onpropertychange" in text && !("oninput" in text))
event.addListener(text, "propertychange", onPropertyChange);
else
event.addListener(text, "input", onTextInput);
event.addListener(text, "paste", function(e) {
// Mark that the next input text comes from past.
pasted = true;
@ -198,6 +186,8 @@ var TextInput = function(parentNode, host) {
if ("onbeforecopy" in text && typeof clipboardData !== "undefined") {
event.addListener(text, "beforecopy", function(e) {
if (tempStyle)
return; // without this text is copied when contextmenu is shown
var copyText = host.getCopyText();
if (copyText)
clipboardData.setData("Text", copyText);
@ -214,6 +204,7 @@ var TextInput = function(parentNode, host) {
event.preventDefault(e);
}
});
event.addListener(text, "cut", onCut); // for ie9 context menu
}
else if (useragent.isOpera) {
event.addListener(parentNode, "keydown", function(e) {
@ -251,12 +242,11 @@ var TextInput = function(parentNode, host) {
event.addListener(text, "focus", function() {
host.onFocus();
select();
reset();
});
this.focus = function() {
host.onFocus();
select();
reset();
text.focus();
};
@ -273,28 +263,52 @@ var TextInput = function(parentNode, host) {
return text;
};
this.onContextMenu = function(mousePos, isEmpty){
if (mousePos) {
if (!tempStyle)
tempStyle = text.style.cssText;
text.style.cssText =
'position:fixed; z-index:1000;' +
'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;';
}
if (isEmpty)
text.value='';
this.onContextMenu = function(e) {
if (!tempStyle)
tempStyle = text.style.cssText;
text.style.cssText =
"position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
if (host.selection.isEmpty())
text.value = "";
if (e.type != "mousedown")
return;
if (host.renderer.$keepTextAreaAtCursor)
host.renderer.$keepTextAreaAtCursor = null;
// on windows context menu is opened after mouseup
if (useragent.isGecko && useragent.isWin)
event.capture(host.container, function(e) {
text.style.left = e.clientX - 2 + "px";
text.style.top = e.clientY - 2 + "px";
}, onContextMenuClose);
};
this.onContextMenuClose = function(){
function onContextMenuClose() {
setTimeout(function () {
if (tempStyle) {
text.style.cssText = tempStyle;
tempStyle = '';
}
sendText();
if (host.renderer.$keepTextAreaAtCursor == null) {
host.renderer.$keepTextAreaAtCursor = true;
host.renderer.$moveTextAreaToCursor();
}
}, 0);
};
this.onContextMenuClose = onContextMenuClose;
// firefox fires contextmenu event after opening it
if (!useragent.isGecko)
event.addListener(text, "contextmenu", function(e) {
host.textInput.onContextMenu(e);
onContextMenuClose()
});
};
exports.TextInput = TextInput;

View file

@ -108,7 +108,9 @@ exports.handler = {
editor.removeListener("click", exports.onCursorMove);
util.noMode(editor);
util.currentMode = "normal";
}
},
actions: cmds.actions
};

View file

@ -52,18 +52,6 @@ var MOTION = 3;
var ACTION = 4;
var HMARGIN = 8; // Minimum amount of line separation between margins;
exports.searchStore = {
current: "",
options: {
needle: "",
backwards: false,
wrap: true,
caseSensitive: false,
wholeWord: false,
regExp: false
}
};
var repeat = function repeat(fn, count, args) {
while (0 < count--)
fn.apply(this, args);
@ -88,7 +76,7 @@ var ensureScrollMargin = function(editor) {
}
};
var actions = {
var actions = exports.actions = {
"z": {
param: true,
fn: function(editor, range, count, param) {
@ -288,16 +276,17 @@ var actions = {
},
":": {
fn: function(editor, range, count, param) {
editor.blur();
txtConsoleInput.focus();
txtConsoleInput.setValue(":");
// not implemented
}
},
"/": {
fn: function(editor, range, count, param) {
editor.blur();
txtConsoleInput.focus();
txtConsoleInput.setValue("/");
// not implemented
}
},
"?": {
fn: function(editor, range, count, param) {
// not implemented
}
},
".": {

View file

@ -300,27 +300,27 @@ module.exports = {
case "(":
case "{":
case "[":
var cursor = editor.getCursorPosition()
var end = editor.session.$findClosingBracket(param, cursor, /paren/)
var cursor = editor.getCursorPosition();
var end = editor.session.$findClosingBracket(param, cursor, /paren/);
if (!end)
return;
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/)
var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
if (!start)
return;
start.column ++;
editor.selection.setSelectionRange(Range.fromPoints(start, end))
break
editor.selection.setSelectionRange(Range.fromPoints(start, end));
break;
case "'":
case "\"":
case '"':
case "/":
var end = find(editor, param, 1)
var end = find(editor, param, 1);
if (!end)
return;
var start = find(editor, param, -1)
var start = find(editor, param, -1);
if (!start)
return;
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start))
break
editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
break;
}
}
},

View file

@ -72,11 +72,7 @@ var Gutter = function(parentEl) {
};
this.removeGutterDecoration = function(row, className){
this.$decorations[row] = this.$decorations[row].replace(" " + className, "");
};
this.setBreakpoints = function(rows) {
this.$breakpoints = rows.concat();
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
};
this.setAnnotations = function(annotations) {
@ -116,6 +112,7 @@ var Gutter = function(parentEl) {
var fold = this.session.getNextFoldLine(i);
var foldStart = fold ? fold.start.row : Infinity;
var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
var breakpoints = this.session.$breakpoints;
while (true) {
if(i > foldStart) {
@ -129,10 +126,10 @@ var Gutter = function(parentEl) {
var annotation = this.$annotations[i] || emptyAnno;
html.push("<div class='ace_gutter-cell",
this.$decorations[i] || "",
this.$breakpoints[i] ? " ace_breakpoint " : " ",
breakpoints[i] ? " ace_breakpoint " : " ",
annotation.className,
"' title='", annotation.text.join("\n"),
"' style='height:", config.lineHeight, "px;'>", (i+1));
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
if (foldWidgets) {
var c = foldWidgets[i];
@ -147,15 +144,18 @@ var Gutter = function(parentEl) {
);
}
var wrappedRowLength = this.session.getRowLength(i) - 1;
while (wrappedRowLength--) {
html.push("</div><div class='ace_gutter-cell' style='height:", config.lineHeight, "px'>\xA6");
}
html.push("</div>");
i++;
}
if (this.session.$useWrapMode)
html.push(
"<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
this.session.getLength() - 1,
"</div>"
);
this.element = dom.setInnerHtml(this.element, html.join(""));
this.element.style.height = config.minHeight + "px";

View file

@ -76,6 +76,11 @@ var Marker = function(parentEl) {
for ( var key in this.markers) {
var marker = this.markers[key];
if (!marker.range) {
marker.update(html, this, this.session, config);
continue;
}
var range = marker.range.clipRows(config.firstRow, config.lastRow);
if (range.isEmpty()) continue;

View file

@ -259,8 +259,8 @@ var Text = function(parentEl) {
continue;
var html = [];
var tokens = this.session.getTokens(i, i);
this.$renderLine(html, i, tokens[0].tokens, !this.$useLineGroups());
var tokens = this.session.getTokens(i);
this.$renderLine(html, i, tokens, !this.$useLineGroups());
lineElement = dom.setInnerHtml(lineElement, html.join(""));
i = this.session.getRowFoldEnd(i);
@ -321,11 +321,8 @@ var Text = function(parentEl) {
var html = [];
// Get the tokens per line as there might be some lines in between
// beeing folded.
// OPTIMIZE: If there is a long block of unfolded lines, just make
// this call once for that big block of unfolded lines.
var tokens = this.session.getTokens(row, row);
if (tokens.length == 1)
this.$renderLine(html, row, tokens[0].tokens, false);
var tokens = this.session.getTokens(row);
this.$renderLine(html, row, tokens, false);
// don't use setInnerHtml since we are working with an empty DIV
container.innerHTML = html.join("");
@ -368,11 +365,8 @@ var Text = function(parentEl) {
// Get the tokens per line as there might be some lines in between
// beeing folded.
// OPTIMIZE: If there is a long block of unfolded lines, just make
// this call once for that big block of unfolded lines.
var tokens = this.session.getTokens(row, row);
if (tokens.length == 1)
this.$renderLine(html, row, tokens[0].tokens, false);
var tokens = this.session.getTokens(row);
this.$renderLine(html, row, tokens, false);
if (this.$useLineGroups())
html.push("</div>"); // end the line group
@ -567,12 +561,11 @@ var Text = function(parentEl) {
value: placeholder
});
} else {
if (isNewRow) {
tokens = this.session.getTokens(row, row)[0].tokens;
}
if (tokens.length != 0) {
if (isNewRow)
tokens = this.session.getTokens(row);
if (tokens.length)
addTokens(tokens, lastColumn, column);
}
}
}.bind(this), foldLine.end.row, this.session.getLine(foldLine.end.row).length);

View file

@ -68,13 +68,13 @@ module.exports = {
// row with hard tabs
var row = 0;
var tokens = this.session.getTokens(row, row)[0].tokens;
var tokens = this.session.getTokens(row);
var stringBuilder = [];
this.textLayer.$renderLine(stringBuilder, row, tokens);
// row with soft tabs
row = 1;
tokens = this.session.getTokens(row, row)[0].tokens;
tokens = this.session.getTokens(row);
var stringBuilder2 = [];
this.textLayer.$renderLine(stringBuilder2, row, tokens);
assert.equal(stringBuilder.join(""), stringBuilder2.join(""));
@ -83,7 +83,7 @@ module.exports = {
"test rendering width of ideographic space (U+3000)" : function() {
this.session.setValue("\u3000");
var tokens = this.session.getTokens(0, 0)[0].tokens;
var tokens = this.session.getTokens(0);
var stringBuilder = [];
this.textLayer.$renderLine(stringBuilder, 0, tokens, true);
assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>");

View file

@ -93,7 +93,7 @@ exports.preventDefault = function(e) {
exports.getButton = function(e) {
if (e.type == "dblclick")
return 0;
else if (e.type == "contextmenu")
if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac))
return 2;
// DOM Event
@ -184,32 +184,41 @@ exports.addMouseWheelListener = function(el, callback) {
exports.addListener(el, "mousewheel", listener);
};
exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) {
var clicks = 0;
var startX, startY;
var startX, startY, timer;
var eventNames = {
2: "dblclick",
3: "tripleclick",
4: "quadclick"
};
var listener = function(e) {
clicks += 1;
if (exports.getButton(e) != 0) {
clicks = 0;
} else {
var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
if (!timer || isNewClick)
clicks = 0;
clicks += 1;
if (timer)
clearTimeout(timer)
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
}
if (clicks == 1) {
startX = e.clientX;
startY = e.clientY;
setTimeout(function() {
clicks = 0;
}, timeout || 600);
}
var isButton = exports.getButton(e) == button;
if (!isButton || Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5)
clicks = 0;
eventHandler[callbackName]("mousedown", e);
if (clicks == count) {
if (clicks > 4)
clicks = 0;
callback(e);
}
if (isButton)
return exports.preventDefault(e);
else if (clicks > 1)
return eventHandler[callbackName](eventNames[clicks], e);
};
exports.addListener(el, "mousedown", listener);

View file

@ -116,6 +116,20 @@ exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
};
exports.getMatchOffsets = function(string, regExp) {
var matches = [];
string.replace(regExp, function(str) {
matches.push({
offset: arguments[arguments.length-2],
length: str.length
});
});
return matches;
};
exports.deferredCall = function(fcn) {
var timer = null;

View file

@ -168,7 +168,7 @@ var CstyleBehaviour = function () {
}
// Find what token we're inside.
var tokens = session.getTokens(selection.start.row, selection.start.row)[0].tokens;
var tokens = session.getTokens(selection.start.row);
var col = 0, token;
var quotepos = -1; // Track whether we're inside an open quote.

View file

@ -47,13 +47,13 @@ var C9SearchHighlightRules = function() {
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : ["constant.numeric", "text", "text"],
regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
},
{
token : ["string", "text"], // single line
regex : "(.+)(:$)"
},
{
token : ["constant.numeric", "text"],
regex : "(^\\s*[0-9]+)(:\\s*)"
}
]
};

View file

@ -191,6 +191,10 @@ var ClojureHighlightRules = function() {
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?$',
next: "string"
}, {
token : "string", // symbol
regex : "[:](?:[a-zA-Z]|\\d)+"
@ -210,6 +214,17 @@ var ClojureHighlightRules = function() {
merge : true,
regex : ".+"
}
],
"string" : [
{
token : "string",
merge : true,
regex : "\\\\."
}, {
token : "string",
regex : '[^"\\\\]*?"',
next : "start"
}
]
};
};

View file

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

View file

@ -1,52 +1,58 @@
/* vim:ts=4:sts=4:sw=4:
* ***** 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) {
console.warn("DEPRECATED: 'pilot/canon' is deprecated.");
//return require("ace/lib/dom");
exports.addCommand = function() {
console.warn("DEPRECATED: 'canon.addCommand()' is deprecated. Use 'editor.commands.addCommand(command)' instead.");
console.trace();
}
exports.removeCommand = function() {
console.warn("DEPRECATED: 'canon.removeCommand()' is deprecated. Use 'editor.commands.removeCommand(command)' instead.");
console.trace();
}
});
/* ***** 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):
*
* 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) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
var FoldMode = require("./folding/diff").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new HighlightRules().getRules(), "i");
this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
};
oop.inherits(Mode, TextMode);
(function() {
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,108 @@
/* ***** 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):
*
* 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) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var DiffHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [{
"regex": "^(?:\\*{15}|={67}|-{3}|\\+{3})$",
"token": "punctuation.definition.separator.diff",
"name": "keyword"
}, { //diff.range.unified
"regex": "^(@@)(\\s*.+?\\s*)(@@)(.*)$",
"token": [
"constant",
"constant.numeric",
"constant",
"comment.doc.tag"
]
}, { //diff.range.normal
"regex": "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",
"token": [
"constant.numeric",
"punctuation.definition.range.diff",
"constant.function",
"constant.numeric",
"punctuation.definition.range.diff",
"invalid"
],
"name": "meta."
}, {
"regex": "^(?:(\\-{3}|\\+{3}|\\*{3})( .+))$",
"token": [
"constant.numeric",
"meta.tag"
]
}, { // added
"regex": "^([!+>])(.*?)(\\s*)$",
"token": [
"support.constant",
"text",
"invalid"
],
}, { // removed
"regex": "^([<\\-])(.*?)(\\s*)$",
"token": [
"support.function",
"string",
"invalid"
],
}, {
"regex": "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
"token": ["variable", "variable", "keyword", "variable"]
}, {
"regex": "^Index.+$",
"token": "variable"
}, {
"regex": "^(.*?)(\\s*)$",
"token": ["invisible", "invalid"]
}
]
};
};
oop.inherits(DiffHighlightRules, TextHighlightRules);
exports.DiffHighlightRules = DiffHighlightRules;
});

View file

@ -0,0 +1,76 @@
/* ***** 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) {
"use strict";
var oop = require("../../lib/oop");
var BaseFoldMode = require("./fold_mode").FoldMode;
var Range = require("../../range").Range;
var FoldMode = exports.FoldMode = function(levels, flag) {
this.regExpList = levels;
this.flag = flag;
this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.getFoldWidgetRange = function(session, foldStyle, row) {
var line = session.getLine(row);
var start = {row: row, column: line.length};
var regList = this.regExpList;
for (var i = 1; i <= regList.length; i++) {
var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
if (re.test(line))
break;
}
for (var l = session.getLength(); ++row < l; ) {
line = session.getLine(row);
if (re.test(line))
break
}
if (row == start.row + 1)
return;
return Range.fromPoints(start, {row: row - 1, column: line.length});
};
}).call(FoldMode.prototype);
});

View file

@ -71,7 +71,7 @@ oop.inherits(FoldMode, BaseFoldMode);
};
this._getFirstTagInLine = function(session, row) {
var tokens = session.getTokens(row, row)[0].tokens;
var tokens = session.getTokens(row);
var value = "";
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];

View file

@ -5,10 +5,13 @@ define(function(require, exports, module) {
var Tokenizer = require("../tokenizer").Tokenizer;
var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);

View file

@ -119,6 +119,9 @@ define(function(require, exports, module) {
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
}
oop.inherits(GolangHighlightRules, TextHighlightRules);

View file

@ -73,6 +73,14 @@ var GroovyHighlightRules = function() {
}, {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, {
token : "string",
regex : '"""',
next : "qqstring"
}, {
token : "string",
regex : "'''",
next : "qstring"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
@ -130,6 +138,38 @@ var GroovyHighlightRules = function() {
merge : true,
regex : ".+"
}
],
"qqstring" : [
{
token : "constant.language.escape",
regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
}, {
token : "constant.language.escape",
regex : /\$[\w\d]+/
}, {
token : "constant.language.escape",
regex : /\$\{[^"\}]+\}?/
}, {
token : "string",
regex : '"{3,5}',
next : "start"
}, {
token : "string",
regex : '.+?'
}
],
"qstring" : [
{
token : "constant.language.escape",
regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
}, {
token : "string",
regex : "'{3,5}",
next : "start"
}, {
token : "string",
regex : ".+?"
}
]
};

View file

@ -191,6 +191,22 @@ var JavaScriptHighlightRules = function() {
],
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, { // match stuff like: Sound.play = function play() { }
token : [
"storage.type",
"punctuation.operator",
"entity.name.function",
"text",
"keyword.operator",
"text",
"storage.type",
"text",
"entity.name.function",
"text",
"paren.lparen"
],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
next: "function_arguments"
}, { // match regular function like: function myFunc(arg) { }
token : [
"storage.type",

View file

@ -49,8 +49,12 @@ var JsonHighlightRules = function() {
this.$rules = {
"start" : [
{
token : "variable", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
regex : '"',
next : "string"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
@ -76,6 +80,26 @@ var JsonHighlightRules = function() {
token : "text",
regex : "\\s+"
}
],
"string" : [
{
token : "constant.language.escape",
regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/
}, {
token : "string",
regex : '[^"\\\\]+',
merge : true
}, {
token : "string",
regex : '"',
next : "start",
merge : true
}, {
token : "string",
regex : "",
next : "start",
merge : true
}
]
};

53
lib/ace/mode/jsx.js Normal file
View file

@ -0,0 +1,53 @@
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
function Mode() {
this.$tokenizer = new Tokenizer(new JsxHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
}
oop.inherits(Mode, TextMode);
(function() {
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start") {
var match = line.match(/^.*[\{\(\[]\s*$/);
if (match) {
indent += tab;
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,122 @@
define(function(require, exports, module) {
var oop = require("../lib/oop");
var lang = require("../lib/lang");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var JsxHighlightRules = function() {
var keywords = lang.arrayToMap(
("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
"if|throw|" +
"delete|in|try|" +
"class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
"number|int|string|boolean|variant|" +
"log|assert").split("|")
);
var buildinConstants = lang.arrayToMap(
("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
);
var reserved = lang.arrayToMap(
("debugger|with|" +
"const|export|" +
"let|private|public|yield|protected|" +
"extern|native|as|operator|__fake__|__readonly__").split("|")
);
var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
this.$rules = {
"start" : [
{
token : "comment",
regex : "\\/\\/.*$"
},
DocCommentHighlightRules.getStartRule("doc-start"),
{
token : "comment", // multi line comment
regex : "\\/\\*",
merge : true,
next : "comment"
}, {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "constant.language.boolean",
regex : "(?:true|false)\\b"
}, {
token : [
"storage.type",
"text",
"entity.name.function"
],
regex : "(function)(\\s+)(" + identifierRe + ")"
}, {
token : function(value) {
if (value == "this")
return "variable.language";
else if (value == "function")
return "storage.type";
else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
return "keyword";
else if (buildinConstants.hasOwnProperty(value))
return "constant.language";
else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
return "language.support.class";
else
return "identifier";
},
// TODO: Unicode escape sequences
// TODO: Unicode identifiers
regex : identifierRe
}, {
token : "keyword.operator",
regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
}, {
token : "punctuation.operator",
regex : "\\?|\\:|\\,|\\;|\\."
}, {
token : "paren.lparen",
regex : "[[({<]"
}, {
token : "paren.rparen",
regex : "[\\])}>]"
}, {
token : "text",
regex : "\\s+"
}
],
"comment" : [
{
token : "comment", // closing comment
regex : ".*?\\*\\/",
next : "start"
}, {
token : "comment", // comment spanning whole line
merge : true,
regex : ".+"
}
]
};
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("start") ]);
};
oop.inherits(JsxHighlightRules, TextHighlightRules);
exports.JsxHighlightRules = JsxHighlightRules;
});

View file

@ -80,7 +80,7 @@ var MarkdownHighlightRules = function() {
return "markup.heading." + value.length;
},
regex : "^#{1,6}"
}, github_embed("javascript", "js-"),
}, github_embed("(?:javascript|js)", "js-"),
github_embed("xml", "xml-"),
github_embed("html", "html-"),
github_embed("css", "css-"),

View file

@ -948,18 +948,12 @@ var PhpHighlightRules = function() {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/][gimy]*\\s*(?=[).,;]|$)"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line string start
regex : '["][\\s\\S]*',
token : "string", // " string start
regex : '"',
next : "qqstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "string", // multi line string start
regex : "['][\\s\\S]+",
token : "string", // ' string start
regex : "'",
next : "qstring"
}, {
token : "constant.numeric", // hex
@ -1040,33 +1034,45 @@ var PhpHighlightRules = function() {
],
"qqstring" : [
{
token : "constant.language.escape",
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
}, {
token : "constant.language.escape",
regex : /\$[\w\d]+(?:\[[\w\d]+\])?/
}, {
token : "constant.language.escape",
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
}, {
token : "string",
regex : '"',
next : "start"
}, {
token : "string",
regex : '[^"]+'
regex : '.+?'
}
],
"qstring" : [
{
token : "constant.language.escape",
regex : "\\\\['\\\\]"
}, {
token : "string",
regex : "'",
next : "start"
}, {
token : "string",
regex : "[^']+"
regex : ".+?"
}
],
"htmlcomment" : [
{
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token : "comment",
regex : ".+"
}
{
token : "comment",
regex : ".*?-->",
next : "start"
}, {
token : "comment",
regex : ".+"
}
],
"htmltag" : [
{

View file

@ -75,11 +75,16 @@ var ScalaHighlightRules = function() {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
token : "string",
regex : '"""',
next : "tstring"
}, {
token : "string", // single line
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
token : "string",
regex : '"(?=.)', // " strings can't span multiple lines
next : "string"
}, {
token : "symbol.constant", // single line
regex : "'[\\w\\d_]+"
}, {
token : "constant.numeric", // hex
regex : "0[xX][0-9a-fA-F]+\\b"
@ -131,6 +136,36 @@ var ScalaHighlightRules = function() {
merge : true,
regex : ".+"
}
],
"string" : [
{
token : "escape",
regex : '\\\\"',
}, {
token : "string",
merge : true,
regex : '"',
next : "start"
}, {
token : "string.invalid",
regex : '[^"\\\\]*$',
next : "start"
}, {
token : "string",
regex : '[^"\\\\]+',
merge : true
}
],
"tstring" : [
{
token : "string", // closing comment
regex : '"{3,5}',
next : "start"
}, {
token : "string", // comment spanning whole line
merge : true,
regex : ".+?"
}
]
};

View file

@ -98,68 +98,6 @@ var Mode = function() {
return null;
};
this.highlightSelection = function(editor) {
var session = editor.session;
if (!session.$selectionOccurrences)
session.$selectionOccurrences = [];
if (session.$selectionOccurrences.length)
this.clearSelectionHighlight(editor);
var selection = editor.getSelectionRange();
if (selection.isEmpty() || selection.isMultiLine())
return;
var startOuter = selection.start.column - 1;
var endOuter = selection.end.column + 1;
var line = session.getLine(selection.start.row);
var lineCols = line.length;
var needle = line.substring(Math.max(startOuter, 0),
Math.min(endOuter, lineCols));
// Make sure the outer characters are not part of the word.
if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
(endOuter <= lineCols && /[\w\d]$/.test(needle)))
return;
needle = line.substring(selection.start.column, selection.end.column);
if (!/^[\w\d]+$/.test(needle))
return;
var cursor = editor.getCursorPosition();
var newOptions = {
wrap: true,
wholeWord: true,
caseSensitive: true,
needle: needle
};
var currentOptions = editor.$search.getOptions();
editor.$search.set(newOptions);
var ranges = editor.$search.findAll(session);
ranges.forEach(function(range) {
if (!range.contains(cursor.row, cursor.column)) {
var marker = session.addMarker(range, "ace_selected_word", "text");
session.$selectionOccurrences.push(marker);
}
});
editor.$search.set(currentOptions);
};
this.clearSelectionHighlight = function(editor) {
if (!editor.session.$selectionOccurrences)
return;
editor.session.$selectionOccurrences.forEach(function(marker) {
editor.session.removeMarker(marker);
});
editor.session.$selectionOccurrences = [];
};
this.createModeDelegates = function (mapping) {
if (!this.$embeds) {
return;

View file

@ -1,34 +1,55 @@
/*
* eXide - web-based XQuery IDE
*
* Copyright (C) 2011 Wolfgang Meier
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 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/
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* 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):
* Wolfgang Meier
* William Candillon <wcandillon 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
* 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) {
"use strict";
var WorkerClient = require("../worker/worker_client").WorkerClient;
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
//var XQueryBackgroundHighlighter = require("./xquery_background_highlighter").XQueryBackgroundHighlighter;
var Range = require("../range").Range;
var Mode = function(parent) {
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
this.$behaviour = new XQueryBehaviour(parent);
this.$tokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
this.$behaviour = new XQueryBehaviour(parent);
};
oop.inherits(Mode, TextMode);
@ -96,6 +117,85 @@ oop.inherits(Mode, TextMode);
doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
}
};
this.createWorker = function(session) {
this.$deltas = [];
var worker = new WorkerClient(["ace"], "worker-xquery.js", "ace/mode/xquery_worker", "XQueryWorker");
var that = this;
session.getDocument().on('change', function(evt){
that.$deltas.push(evt.data);
});
worker.attachToDocument(session.getDocument());
worker.on("start", function(e) {
//console.log("start");
that.$deltas = [];
});
worker.on("error", function(e) {
session.setAnnotations([e.data]);
});
worker.on("ok", function(e) {
session.clearAnnotations();
});
worker.on("highlight", function(tokens) {
var firstRow = 0;
var lastRow = session.getLength() - 1;
var lines = tokens.data.lines;
var states = tokens.data.states;
for(var i=0; i < that.$deltas.length; i++)
{
var delta = that.$deltas[i];
if (delta.action === "insertLines")
{
var newLineCount = delta.lines.length;
for (var i = 0; i < newLineCount; i++) {
lines.splice(delta.range.start.row + i, 0, undefined);
states.splice(delta.range.start.row + i, 0, undefined);
}
}
else if (delta.action === "insertText")
{
if (session.getDocument().isNewLine(delta.text))
{
lines.splice(delta.range.end.row, 0, undefined);
states.splice(delta.range.end.row, 0, undefined);
} else {
lines[delta.range.start.row] = undefined;
states[delta.range.start.row] = undefined;
}
} else if (delta.action === "removeLines") {
var oldLineCount = delta.lines.length;
lines.splice(delta.range.start.row, oldLineCount);
states.splice(delta.range.start.row, oldLineCount);
} else if (delta.action === "removeText") {
if (session.getDocument().isNewLine(delta.text))
{
lines[delta.range.start.row] = undefined;
lines.splice(delta.range.end.row, 1);
states[delta.range.start.row] = undefined;
states.splice(delta.range.end.row, 1);
} else {
lines[delta.range.start.row] = undefined;
states[delta.range.start.row] = undefined;
}
}
}
session.bgTokenizer.lines = lines;
session.bgTokenizer.states = states;
session.bgTokenizer.fireUpdateEvent(firstRow, lastRow);
});
return worker;
};
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -1,5 +1,4 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
/* ***** 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
@ -20,7 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* William Candillon <wcandillon 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
@ -32,11 +31,29 @@
* 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.
*
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module){
var Position = exports.Position = function(line, offset, length)
{
this.line = line;
this.offset = offset;
this.length = length;
this.getLine = function()
{
return this.line;
};
define(function(require, exports, module) {
console.warn("DEPRECATED: 'pilot/browser_focus' is deprecated. Use 'ace/lib/browser_focus' instead");
module.exports = require("ace/lib/browser_focus");
});
this.getOffset = function()
{
return this.offset;
};
this.getLength = function()
{
return this.length;
};
};
});

View file

@ -0,0 +1,6 @@
WARNING!
============================
Files in this folder are generated automatically from the xquery.js project (https://github.com/wcandillon/xquery.js).
Instructions on how to generate the XQuery parser are available at https://github.com/wcandillon/xquery.js

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,4 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
/* ***** 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
@ -20,7 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* William Candillon <wcandillon 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
@ -32,11 +31,39 @@
* 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.
*
* the terms of any one of the MPL, the GPL or the LGPL. *
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module){
var org = require("./antlr3-all").org;
var XQDTLexer = exports.XQDTLexer = function(input, state)
{
XQDTLexer.superclass.constructor.call(this, input, state);
};
org.antlr.lang.extend(XQDTLexer, org.antlr.runtime.Lexer, {
comments: [],
addComment: function(start, stop){ this.comments.push({ start: start, stop: stop }); },
isWsExplicit: false,
setIsWsExplicit: function (wsExplicit) {
//console.log("A WS: " + wsExplicit);
this.isWsExplicit = wsExplicit;
//console.log("B WS: " + wsExplicit);
},
addToStack: function (stack) {
stack.push(this);
},
rewindToIndex: function(index) {
var stream = this.input;
stream.seek(index);
}
});
define(function(require, exports, module) {
console.warn("DEPRECATED: 'pilot/event' is deprecated. Use 'ace/lib/event' instead");
module.exports = require("ace/lib/event");
});

View file

@ -0,0 +1,63 @@
/* ***** 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):
* William Candillon <wcandillon 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
* 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 org = require("./antlr3-all").org;
var XQuerySemanticHighlighter = require("./XQuerySemanticHighlighter").XQuerySemanticHighlighter;
var XQDTParser = exports.XQDTParser = function(input, state)
{
this.highlighter = new XQuerySemanticHighlighter();
var that = this;
input.getTokenSource().addComment = function(start, stop) {
var comments = input.getTokenSource().comments;
for(var i in comments)
{
var c = comments[i];
that.highlighter.addToken(c.start, c.stop, "comment");
}
input.getTokenSource().comments = [];
that.highlighter.addToken(start, stop, "comment")
};
XQDTParser.superclass.constructor.call(this, input, state);
};
org.antlr.lang.extend(XQDTParser, org.antlr.runtime.Parser, {
});
});

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,165 @@
/* ***** 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):
* William Candillon <wcandillon 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
* 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 Position = require("./Position").Position;
var XQuerySemanticHighlighter = exports.XQuerySemanticHighlighter = function() {
this.tokenizer = null;
this.plain = null;
this.source = [];
this.lines = [];
this.getTokens = function() {
var resultLines = new Array(this.source.length);
var resultStates = new Array(this.source.length);
var previousState = "start";
for(i in this.source){
var lineTokens = [];
var tokens = [];
if(this.lines[i]) {
tokens = this.lines[i].sort(function(a, b){ return a.position.getOffset() - b.position.getOffset(); });
}
var sourceLine = this.source[i];
var tokenizedLine = "";
var cursor = 0;
for(j in tokens)
{
var token = tokens[j];
var position = token.position;
if(position.getOffset() > cursor) {
var value = sourceLine.substring(cursor, position.getOffset());
tokenizedLine += value;
lineTokens.push({
type: "text",
value: value
});
}
cursor = position.getOffset() + position.getLength();
value = sourceLine.substring(position.getOffset(), cursor);
tokenizedLine += value;
lineTokens.push({
type: token.type,
value: value
});
}
var nextState = "start";
if(lineTokens.length > 0) {
lineTokens[lineTokens.length - 1].type;
}
nextState = (nextState != "comment" && nextState != "string" && nextState != "cdata" && nextState != "tag") ? "start" : nextState;
if(cursor < (sourceLine.length )) {
value = sourceLine.substring(cursor);
lineTokens.push({
type: "text",
value: value
});
tokenizedLine += value;
}
//Check if the tokenized line is equal to the original one:
if(sourceLine == tokenizedLine) {
resultLines[i] = lineTokens;
resultStates[i] = nextState;
//result[i] = { line: sourceLine, startState: previousState, tokens: { tokens: lineTokens, state: nextState } };
} else {
//console.log("sourceLine: " + sourceLine);
//console.log("tokenizedLine: " + tokenizedLine);
resultLines[i] = [{ type: "text", value: sourceLine }];
resultStates[i] = nextState;
//result[i] = { tokens: [ { type: "text", value: sourceLine } ], state: nextState };
}
if(resultLines[i].length === 1 && resultLines[i][0].type === "text" && this.tokenizer instanceof Object) {
var prev = resultStates[i - 1] ? resultStates[i - 1] : "start";
var result = this.tokenizer.getLineTokens(resultLines[i][0].value, prev);
resultLines[i] = result.tokens;
resultStates[i] = result.state;
}
}
return {states: resultStates, lines: resultLines};
};
this.addToken = function(start, stop, type) {
var before = this.plain.substring(0, start);
var startLine = this.plain.substring(0, start).split("\n").length;
startLine = startLine == 0 ? 0 : startLine - 1;
var offset = before.lastIndexOf("\n");
offset = offset == -1 ? start : start - before.lastIndexOf("\n") - 1;
var cursor = start;
var text = this.plain.substring(start, stop);
var currentLine = startLine;
for(var i in text)
{
var c = text[i];
if(c == "\n") {
var s = i;
s = s < stop ? s : stop;
this.addPosition(new Position(currentLine, offset, s), type);
currentLine++;
offset = 0;
cursor = i;
}
};
this.addPosition(new Position(currentLine, offset, stop - cursor + 1), type);
};
this.addPosition = function(position, type)
{
var line = position.getLine();
if(!this.lines[line]) {
this.lines[line] = [];
}
this.lines[line].push({
type: type,
position: position
});
};
this.setSource = function(source)
{
this.plain = source.data;
this.source = this.plain.split("\n");
};
//console.log("Line: " + token.getLine());
//console.log(token.getText());
//console.log(type);
};
});

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,4 @@
/* vim:ts=4:sts=4:sw=4:
* ***** BEGIN LICENSE BLOCK *****
/* ***** 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
@ -20,7 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
* William Candillon <wcandillon 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
@ -35,8 +34,22 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
console.warn("DEPRECATED: 'pilot/dom' is deprecated. Use 'ace/lib/dom' instead");
module.exports = require("ace/lib/dom");
var antlr = require("./antlr3-all");
var org = antlr.org;
var NewLazyTokenStream = antlr.NewLazyTokenStream;
var XQueryLexer = require("./XQueryLexer").XQueryLexer;
var XQueryParser = require("./XQueryParser").XQueryParser;
exports.getParser = function(code) {
var cstream = new org.antlr.runtime.ANTLRStringStream(code);
var lexer = new XQueryLexer(cstream);
var tstream = new NewLazyTokenStream(lexer);
tstream.jumpToFirstValidToken();
var parser = new XQueryParser(tstream);
parser.setSource(cstream);
return parser;
};
});

View file

@ -1,21 +1,39 @@
/*
* eXide - web-based XQuery IDE
*
* Copyright (C) 2011 Wolfgang Meier
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 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/
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* 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):
* William Candillon <wcandillon 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
* 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) {
"use strict";
@ -26,14 +44,9 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var XQueryHighlightRules = function() {
var keywords = lang.arrayToMap(
("return|for|let|where|order|by|declare|function|variable|xquery|version|option|namespace|import|module|when|encoding|" +
"switch|default|try|catch|group|tumbling|sliding|window|start|end|at|only|" +
"using|stemming|" +
"while|" +
"external|" +
"if|then|else|as|and|or|typeswitch|case|ascending|descending|empty|in|count|updating|insert|delete|replace|value|node|attribute|text|element|into|of|with|contains").split("|")
("after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning").split("|")
);
// regexp must not have capturing parentheses
// regexps are ordered -> the first match is used
@ -85,7 +98,7 @@ var XQueryHighlightRules = function() {
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
}, {
token: "keyword.operator",
regex: "\\*|=|<|>|\\-|\\+|and|or|eq|ne|lt|gt"
regex: "\\*|=|<|>|\\-|\\+"
}, {
token: "lparen",
regex: "[[({]"
@ -113,14 +126,14 @@ var XQueryHighlightRules = function() {
} ],
cdata : [ {
token : "text",
token : "comment",
regex : "\\]\\]>",
next : "start"
}, {
token : "text",
token : "comment",
regex : "\\s+"
}, {
token : "text",
token : "comment",
regex : "(?:[^\\]]|\\](?!\\]>))+"
} ],

View file

@ -0,0 +1,86 @@
/* ***** 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):
* William Candillon <wcandillon 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
* 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) {
"use strict";
var oop = require("../lib/oop");
var Mirror = require("../worker/mirror").Mirror;
var xquery = require("../mode/xquery/xquery");
var Tokenizer = require("../tokenizer").Tokenizer;
var XQueryHighlightRules = require("./xquery_highlight_rules").XQueryHighlightRules;
window.addEventListener = function() {};
var XQueryWorker = exports.XQueryWorker = function(sender) {
Mirror.call(this, sender);
this.setTimeout(200);
};
oop.inherits(XQueryWorker, Mirror);
(function() {
this.onUpdate = function() {
this.sender.emit("start");
var value = this.doc.getValue();
var parser = xquery.getParser(value);
var ast = parser.p_Module();
if(parser.hasErrors()) {
var errors = parser.getErrors();
var i = 0;
for(i in errors) {
var error = errors[i];
this.sender.emit("error", {
row: error.line,
column: error.column,
text: error.message,
type: "error"
});
}
} else {
this.sender.emit("ok");
}
parser.highlighter.tokenizer = new Tokenizer(new XQueryHighlightRules().getRules());
var tokens = parser.highlighter.getTokens();
this.sender.emit("highlight", tokens);
};
}).call(XQueryWorker.prototype);
});

64
lib/ace/mode/yaml.js Normal file
View file

@ -0,0 +1,64 @@
/* ***** BEGIN LICENSE BLOCK *****
* The Original Code is Ajax.org Code Editor (ACE).
*
* Contributor(s):
* Meg Sharkey <megshark 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
* 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) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var YamlHighlightRules = require("./yaml_highlight_rules").YamlHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function() {
this.$tokenizer = new Tokenizer(new YamlHighlightRules().getRules());
this.$outdent = new MatchingBraceOutdent();
};
oop.inherits(Mode, TextMode);
(function() {
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
if (state == "start") {
var match = line.match(/^.*[\{\(\[]\s*$/);
if (match) {
indent += tab;
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,116 @@
/* ***** 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):
* Meg Sharkey <megshark 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
* 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) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var YamlHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : "comment",
regex : "#.*$"
}, {
token : "comment",
regex : "^---"
}, {
token: "variable",
regex: "[&\\*][a-zA-Z0-9-_]+"
}, {
token: ["identifier", "text"],
regex: "(\\w+\\s*:)(\\w*)"
}, {
token : "keyword.operator",
regex : "<<\\w*:\\w*"
}, {
token : "keyword.operator",
regex : "-\\s*(?=[{])"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line string start
merge : true,
regex : '[\\|>]\\w*',
next : "qqstring"
}, {
token : "string", // single quoted string
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // float
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
}, {
token : "constant.language.boolean",
regex : "(?:true|false|yes|no)\\b"
}, {
token : "invalid.illegal", // comments are not allowed
regex : "\\/\\/.*$"
}, {
token : "paren.lparen",
regex : "[[({]"
}, {
token : "paren.rparen",
regex : "[\\])}]"
}, {
token : "text",
regex : "\\s+"
}
],
"qqstring" : [
{
token : "string",
regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)',
next : "start"
}, {
token : "string",
merge : true,
regex : '.+'
}
]}
};
oop.inherits(YamlHighlightRules, TextHighlightRules);
exports.YamlHighlightRules = YamlHighlightRules;
});

View file

@ -67,6 +67,7 @@ function GutterHandler(mouseHandler) {
}
mouseHandler.captureMouse(e, "selectByLines");
return e.preventDefault();
});
}

View file

@ -42,16 +42,12 @@ define(function(require, exports, module) {
"use strict";
var dom = require("../lib/dom");
var BrowserFocus = require("../lib/browser_focus").BrowserFocus;
var useragent = require("../lib/useragent");
var DRAG_OFFSET = 5; // pixels
function DefaultHandlers(mouseHandler) {
mouseHandler.$clickSelection = null;
mouseHandler.browserFocus = new BrowserFocus();
var editor = mouseHandler.editor;
editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
@ -61,7 +57,7 @@ function DefaultHandlers(mouseHandler) {
editor.setDefaultHandler("mousewheel", this.onScroll.bind(mouseHandler));
var exports = ["select", "startSelect", "drag", "dragEnd", "dragWait",
"dragWaitEnd", "startDrag"];
"dragWaitEnd", "startDrag", "focusWait"];
exports.forEach(function(x) {
mouseHandler[x] = this[x];
@ -69,44 +65,43 @@ function DefaultHandlers(mouseHandler) {
mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
mouseHandler.$focusWaitTimout = 250;
}
(function() {
this.onMouseDown = function(ev) {
this.mousedownEvent = ev;
var inSelection = ev.inSelection();
var pos = ev.getDocumentPosition();
this.mousedownEvent = ev;
var editor = this.editor;
var _self = this;
this.ev = ev
var selectionRange = editor.getSelectionRange();
var selectionEmpty = selectionRange.isEmpty();
var button = ev.getButton();
if (button !== 0) {
var selectionRange = editor.getSelectionRange();
var selectionEmpty = selectionRange.isEmpty();
if (selectionEmpty) {
editor.moveCursorToPosition(pos);
editor.selection.clearSelection();
}
// 2: contextmenu, 1: linux paste
this.moveTextarea = function() {
editor.textInput.onContextMenu({x: _self.x, y: _self.y});
};
this.moveTextareaEnd = editor.textInput.onContextMenuClose;
editor.textInput.onContextMenu({x: this.x, y: this.y}, selectionEmpty);
this.captureMouse(ev, "moveTextarea");
return;
// 2: contextmenu, 1: linux paste
editor.textInput.onContextMenu(ev.domEvent);
return; // stopping event here breaks contextmenu on ff mac
}
// if this click caused the editor to be focused should not clear the
// selection
if (inSelection && !editor.isFocused()) {
editor.focus();
return;
if (this.$focusWaitTimout && !this.$clickSelection) {
this.setState("focusWait");
this.captureMouse(ev);
return ev.preventDefault();
}
}
if (!inSelection || this.$clickSelection || ev.getShiftKey()) {
@ -114,16 +109,12 @@ function DefaultHandlers(mouseHandler) {
// a selection.
this.startSelect(pos);
} else if (inSelection) {
var e = ev.domEvent;
if ((e.ctrlKey || e.altKey)) {
this.startDrag();
} else {
this.mousedownEvent.time = (new Date()).getTime();
this.setState("dragWait");
}
this.mousedownEvent.time = (new Date()).getTime();
this.setState("dragWait");
}
this.captureMouse(ev)
this.captureMouse(ev);
return ev.preventDefault();
};
this.startSelect = function(pos) {
@ -150,8 +141,9 @@ function DefaultHandlers(mouseHandler) {
} else if (cmp == 1) {
anchor = this.$clickSelection.start;
} else {
cursor = this.$clickSelection.end;
anchor = this.$clickSelection.start;
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
cursor = orientedRange.cursor;
anchor = orientedRange.anchor;
}
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
}
@ -179,8 +171,9 @@ function DefaultHandlers(mouseHandler) {
cursor = range.end;
anchor = range.start;
} else {
cursor = this.$clickSelection.end;
anchor = this.$clickSelection.start;
var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
cursor = orientedRange.cursor;
anchor = orientedRange.anchor;
}
editor.selection.setSelectionAnchor(anchor.row, anchor.column);
}
@ -217,15 +210,23 @@ function DefaultHandlers(mouseHandler) {
editor.keyBinding.addKeyboardHandler(this.$dragKeybinding);
};
this.dragWait = function() {
this.focusWait = function() {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
var time = (new Date()).getTime();
if (distance > DRAG_OFFSET ||time - this.mousedownEvent.time > this.$focusWaitTimout)
this.startSelect();
};
this.dragWait = function(e) {
var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
var time = (new Date()).getTime();
var editor = this.editor;
if (distance > DRAG_OFFSET) {
this.startSelect();
} else if ((time - this.mousedownEvent.time) > editor.getDragDelay()) {
this.startDrag()
} else if (time - this.mousedownEvent.time > editor.getDragDelay()) {
this.startDrag();
}
};
@ -273,12 +274,21 @@ function DefaultHandlers(mouseHandler) {
this.onDoubleClick = function(ev) {
var pos = ev.getDocumentPosition();
var editor = this.editor;
var session = editor.session
var range = session.getBracketRange(pos);
if (range) {
if (range.isEmpty()) {
range.start.column--;
range.end.column++;
}
this.$clickSelection = range;
this.setState("select");
return;
}
this.$clickSelection = editor.selection.getWordRange(pos.row, pos.column);
this.setState("selectByWords");
editor.moveCursorToPosition(pos);
editor.selection.selectWord();
this.$clickSelection = editor.getSelectionRange();
};
this.onTripleClick = function(ev) {
@ -330,4 +340,16 @@ function calcDistance(ax, ay, bx, by) {
return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
}
function calcRangeOrientation(range, cursor) {
if (range.start.row == range.end.row)
var cmp = 2 * cursor.column - range.start.column - range.end.column;
else
var cmp = 2 * cursor.row - range.start.row - range.end.row;
if (cmp < 0)
return {cursor: range.start, anchor: range.end};
else
return {cursor: range.end, anchor: range.start};
}
});

View file

@ -0,0 +1,105 @@
/* vim:ts=4:sts=4:sw=4:
* ***** 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):
*
* 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) {
"use strict";
var event = require("../lib/event");
var DragdropHandler = function(mouseHandler) {
var editor = mouseHandler.editor;
var dragSelectionMarker, x, y;
var timerId, range, isBackwards;
var dragCursor, counter = 0;
var mouseTarget = editor.container;
event.addListener(mouseTarget, "dragenter", function(e) {console.log(e.type, counter,e.target);
counter++;
if (!dragSelectionMarker) {
range = editor.getSelectionRange();
isBackwards = editor.selection.isBackwards();
var style = editor.getSelectionStyle();
dragSelectionMarker = editor.session.addMarker(range, "ace_selection", style);
editor.clearSelection();
clearInterval(timerId);
timerId = setInterval(onDragInterval, 20);
}
return event.preventDefault(e);
});
event.addListener(mouseTarget, "dragover", function(e) {
x = e.clientX;
y = e.clientY;
return event.preventDefault(e);
});
var onDragInterval = function() {
dragCursor = editor.renderer.screenToTextCoordinates(x, y);
editor.moveCursorToPosition(dragCursor);
editor.renderer.scrollCursorIntoView();
};
event.addListener(mouseTarget, "dragleave", function(e) {console.log(e.type, counter,e.target);
counter--;
if (counter > 0)
return;
console.log(e.type, counter,e.target);
clearInterval(timerId);
editor.session.removeMarker(dragSelectionMarker);
dragSelectionMarker = null;
editor.selection.setSelectionRange(range, isBackwards);
return event.preventDefault(e);
});
event.addListener(mouseTarget, "drop", function(e) {
console.log(e.type, counter,e.target);
counter = 0;
clearInterval(timerId);
editor.session.removeMarker(dragSelectionMarker);
dragSelectionMarker = null;
range.end = editor.session.insert(dragCursor, e.dataTransfer.getData('Text'));
range.start = dragCursor;
editor.focus();
editor.selection.setSelectionRange(range);
return event.preventDefault(e);
});
};
exports.DragdropHandler = DragdropHandler;
});

View file

@ -40,6 +40,7 @@ define(function(require, exports, module) {
"use strict";
var event = require("../lib/event");
var useragent = require("../lib/useragent");
/*
* Custom Ace mouse event
@ -130,9 +131,9 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
return this.domEvent.shiftKey;
};
this.getAccelKey = function() {
return this.domEvent.ctrlKey || this.domEvent.metaKey ;
};
this.getAccelKey = useragent.isMac
? function() { return this.domEvent.metaKey; }
: function() { return this.domEvent.ctrlKey; };
}).call(MouseEvent.prototype);

View file

@ -44,28 +44,24 @@ var event = require("../lib/event");
var DefaultHandlers = require("./default_handlers").DefaultHandlers;
var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
var MouseEvent = require("./mouse_event").MouseEvent;
var DragdropHandler = require("./dragdrop").DragdropHandler;
var MouseHandler = function(editor) {
this.editor = editor;
new DefaultHandlers(this);
new DefaultGutterHandler(this);
new DragdropHandler(this);
event.addListener(editor.container, "mousedown", function(e) {
editor.focus();
return event.preventDefault(e);
});
event.addListener(editor.container, "selectstart", function(e) {
return event.preventDefault(e);
});
var mouseTarget = editor.renderer.getMouseEventTarget();
event.addListener(mouseTarget, "mousedown", this.onMouseEvent.bind(this, "mousedown"));
event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseEvent.bind(this, "dblclick"));
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseEvent.bind(this, "tripleclick"));
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseEvent.bind(this, "quadclick"));
event.addMultiMouseDownListener(mouseTarget, [300, 300, 250], this, "onMouseEvent");
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
var gutterEl = editor.renderer.$gutter;
@ -129,31 +125,32 @@ var MouseHandler = function(editor) {
this.y = ev.y;
// do not move textarea during selection
var kt = this.editor.renderer.$keepTextAreaAtCursor;
this.editor.renderer.$keepTextAreaAtCursor = false;
var renderer = this.editor.renderer;
if (renderer.$keepTextAreaAtCursor)
renderer.$keepTextAreaAtCursor = null;
var self = this;
var onMouseSelection = function(e) {
var onMouseMove = function(e) {
self.x = e.clientX;
self.y = e.clientY;
};
var onMouseSelectionEnd = function(e) {
var onCaptureEnd = function(e) {
clearInterval(timerId);
self[self.state + "End"] && self[self.state + "End"](e);
self.$clickSelection = null;
self.editor.renderer.$keepTextAreaAtCursor = kt;
self.editor.renderer.$moveTextAreaToCursor();
if (renderer.$keepTextAreaAtCursor == null) {
renderer.$keepTextAreaAtCursor = true;
renderer.$moveTextAreaToCursor();
}
};
var onSelectionInterval = function() {
var onCaptureInterval = function() {
self[self.state] && self[self.state]();
}
event.capture(this.editor.container, onMouseSelection, onMouseSelectionEnd);
var timerId = setInterval(onSelectionInterval, 20);
ev.preventDefault();
event.capture(this.editor.container, onMouseMove, onCaptureEnd);
var timerId = setInterval(onCaptureInterval, 20);
};
}).call(MouseHandler.prototype);

View file

@ -53,18 +53,14 @@ function onMouseDown(e) {
var ctrl = e.getAccelKey();
var button = e.getButton();
if (e.editor.inMultiSelectMode && button == 2) {
e.editor.textInput.onContextMenu(e.domEvent);
return;
}
if (!ctrl && !alt) {
if (e.editor.inMultiSelectMode) {
if (button == 0) {
e.editor.exitMultiSelectMode();
} else if (button == 2) {
var editor = e.editor;
var selectionEmpty = editor.selection.isEmpty();
editor.textInput.onContextMenu({x: e.clientX, y: e.clientY}, selectionEmpty);
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
e.stop();
}
}
if (button == 0 && e.editor.inMultiSelectMode)
e.editor.exitMultiSelectMode();
return;
}

View file

@ -43,7 +43,8 @@ var Range = require("./range").Range;
var Selection = require("./selection").Selection;
var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
var event = require("./lib/event");
exports.commands = require("./commands/multi_select_commands");
var commands = require("./commands/multi_select_commands");
exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
// Todo: session.find or editor.findVolatile that returns range
var Search = require("./search").Search;
@ -397,7 +398,7 @@ var Editor = require("./editor").Editor;
this.inMultiSelectMode = true;
this.setStyle("multiselect");
this.keyBinding.addKeyboardHandler(exports.commands.keyboardHandler);
this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
this.commands.on("exec", this.$onMultiSelectExec);
this.renderer.updateCursor();
@ -410,7 +411,7 @@ var Editor = require("./editor").Editor;
this.inMultiSelectMode = false;
this.unsetStyle("multiselect");
this.keyBinding.removeKeyboardHandler(exports.commands.keyboardHandler);
this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
this.commands.removeEventListener("exec", this.$onMultiSelectExec);
this.renderer.updateCursor();
@ -420,6 +421,8 @@ var Editor = require("./editor").Editor;
this.$onMultiSelectExec = function(e) {
var command = e.command;
var editor = e.editor;
if (!editor.multiSelect)
return;
if (!command.multiSelectAction) {
command.exec(editor, e.args || {});
editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
@ -724,7 +727,7 @@ function MultiSelect(editor) {
editor.on("changeSession", exports.onSessionChange.bind(editor));
editor.on("mousedown", onMouseDown);
editor.commands.addCommands(exports.commands.defaultCommands);
editor.commands.addCommands(commands.defaultCommands);
addAltCursorListeners(editor);
}

View file

@ -90,7 +90,6 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
* [start.row/start.column] -> [end.row/end.column]
*
**/
this.toString = function() {
return ("Range: [" + this.start.row + "/" + this.start.column +
"] -> [" + this.end.row + "/" + this.end.column + "]");
@ -424,7 +423,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
/**
/**
* Range.compareInside(row, column) -> Number
* - row (Number): A row point to compare with
* - column (Number): A column point to compare with
@ -449,7 +448,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
}
}
/**
/**
* Range.clipRows(firstRow, lastRow) -> Range
* - firstRow (Number): The starting row
* - lastRow (Number): The ending row
@ -488,7 +487,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(start || this.start, end || this.end);
};
/**
/**
* Range.extend(row, column) -> Range
* - row (Number): A new row to extend to
* - column (Number): A new column to extend to
@ -513,7 +512,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return (this.start.row == this.end.row && this.start.column == this.end.column);
};
/**
/**
* Range.isMultiLine() -> Boolean
*
* Returns true if the range spans across multiple lines.
@ -523,7 +522,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return (this.start.row !== this.end.row);
};
/**
/**
* Range.clone() -> Range
*
* Returns a duplicate of the calling range.
@ -533,7 +532,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return Range.fromPoints(this.start, this.end);
};
/**
/**
* Range.collapseRows() -> Range
*
* Returns a range containing the starting and ending rows of the original range, but with a column value of `0`.
@ -546,7 +545,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
return new Range(this.start.row, 0, this.end.row, 0)
};
/**
/**
* Range.toScreenRange(session) -> Range
* - session (EditSession): The `EditSession` to retrieve coordinates from
*

View file

@ -196,10 +196,9 @@ var RangeList = function() {
var lineDif = endRow - startRow;
var colDiff = -start.column + end.column;
var ranges = this.ranges;
for (var i=0, n = ranges.length; i < n; i++) {
for (var i = 0, n = ranges.length; i < n; i++) {
var r = ranges[i];
if (r.end.row < startRow)
continue;

View file

@ -54,35 +54,25 @@ var Range = require("./range").Range;
/**
* new Search()
*
* Creates a new `Search` object. The search options contain the following defaults:
* Creates a new `Search` object. The following search options are avaliable:
*
* * `needle`: `""`
* * `backwards`: `false`
* * `wrap`: `false`
* * `caseSensitive`: `false`
* * `wholeWord`: `false`
* * `scope`: `ALL`
* * `regExp`: `false`
* * needle: string or regular expression
* * backwards: false
* * wrap: false
* * caseSensitive: false
* * wholeWord: false
* * range: Range or null for whole document
* * regExp: false
* * start: Range or position
* * skipCurrent: false
*
**/
var Search = function() {
this.$options = {
needle: "",
backwards: false,
wrap: false,
caseSensitive: false,
wholeWord: false,
scope: Search.ALL,
regExp: false
};
this.$options = {};
};
Search.ALL = 1;
Search.SELECTION = 2;
(function() {
/**
* Search.set(options) -> Search
* - options (Object): An object containing all the new search properties
@ -105,6 +95,9 @@ Search.SELECTION = 2;
return lang.copyObject(this.$options);
};
this.setOptions = function(options) {
this.$options = options;
};
/**
* Search.find(session) -> Range
* - session (EditSession): The session to search with
@ -113,17 +106,18 @@ Search.SELECTION = 2;
*
**/
this.find = function(session) {
if (!this.$options.needle)
return null;
var iterator = this.$matchIterator(session);
var iterator = this.$matchIterator(session, this.$options);
if (!iterator)
return false;
var firstRange = null;
iterator.forEach(function(range) {
firstRange = range;
iterator.forEach(function(range, row, offset) {
if (!range.start) {
var column = range.offset + (offset || 0);
firstRange = new Range(row, column, row, column+range.length);
} else
firstRange = range;
return true;
});
@ -141,23 +135,53 @@ Search.SELECTION = 2;
var options = this.$options;
if (!options.needle)
return [];
this.$assembleRegExp(options);
var iterator = this.$matchIterator(session);
if (!iterator)
return false;
var ignoreCursor = !options.start && options.wrap && options.scope == Search.ALL;
if (ignoreCursor)
options.start = {row: 0, column: 0};
if (options.range) {
var range = options.range;
var lines = session.getLines(range.start.row, range.end.row);
} else
var lines = session.doc.getAllLines();
var ranges = [];
iterator.forEach(function(range) {
ranges.push(range);
});
var re = options.re;
if (options.$isMultiLine) {
var len = re.length;
var maxRow = lines.length - len;
for (var row = re.offset || 0; row < maxRow; row++) {
for (var j = 0; j < re.length; j++)
if (lines[row + j].search(re[j]) == -1)
break;
if (ignoreCursor)
options.start = null;
var startIndex = lines[row + j].match(re[0])[0].length;
var endIndex = line.match(re[len - 1])[0].length;
ranges.push(new Range(
row, startLine.length - startIndex,
row + len - 1, endIndex
));
}
} else {
for (var i = 0; i < lines.length; i++) {
var matches = lang.getMatchOffsets(lines[i], re);
for (var j = 0; j < matches.length; j++) {
var match = matches[j];
ranges.push(new Range(i, match.offset, i, match.offset + match.length));
};
}
}
if (options.range) {
var startColumn = range.start.column;
var endColumn = range.start.column;
var i = 0, j = ranges.length - 1;
while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
i++;
while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
j--;
return ranges.slice(i, j + 1);
}
return ranges;
};
@ -173,252 +197,195 @@ Search.SELECTION = 2;
*
**/
this.replace = function(input, replacement) {
if (!this.$options.regExp)
return input == this.$options.needle ? replacement : null;
var re = this.$assembleRegExp();
var options = this.$options;
var re = this.$assembleRegExp(options);
if (options.$isMultiLine)
return replacement;
if (!re)
return;
var match = re.exec(input);
if (match && match[0].length == input.length) {
return input.replace(re, replacement);
}
else {
if (!match || match[0].length != input.length)
return null;
replacement = input.replace(re, replacement)
if (options.preserveCase) {
replacement = replacement.split("");
for (var i = Math.min(input.length, input.length); i--; ) {
var ch = input[i];
if (ch && ch.toLowerCase() != ch)
replacement[i] = replacement[i].toUpperCase();
else
replacement[i] = replacement[i].toLowerCase();
}
replacement = replacement.join("");
}
return replacement;
};
/** internal, hide
* Search.$matchIterator(session) -> String | Boolean
* - session (EditSession): The session to search with
*
*
*
**/
this.$matchIterator = function(session) {
var re = this.$assembleRegExp();
this.$matchIterator = function(session, options) {
var re = this.$assembleRegExp(options);
if (!re)
return false;
var self = this, callback, backwards = this.$options.backwards;
var self = this, callback, backwards = options.backwards;
if (this.$options.$isMultiLine) {
var matchIterator = function(line, startIndex, row) {
var startLine = line;
if (startIndex)
line = line.substring(startIndex);
var len = re.length;
var part = re[0];
if (line.slice(-part.length) != part)
if (options.$isMultiLine) {
var len = re.length;
var matchIterator = function(line, row, offset) {
var startIndex = line.search(re[0]);
if (startIndex == -1)
return;
for (var i = 1; i < len - 1; i++)
if (re[i] != session.getLine(row + i))
for (var i = 1; i < len; i++) {
line = session.getLine(row + i);
if (line.search(re[i]) == -1)
return;
}
part = re[len - 1];
if (session.getLine(row + len - 1).slice(0, part.length) != part)
return;
var endIndex = line.match(re[len - 1])[0].length;
var range = new Range(row, startIndex, row + len - 1, endIndex);
if (re.offset == 1) {
range.start.row--;
range.start.column = Number.MAX_VALUE;
} else if (offset)
range.start.column += offset;
var range = new Range(
row, startLine.length - re[0].length,
row + len - 1, re[len - 1].length
);
if (callback(range))
return true;
}
} else if (backwards) {
var matchIterator = function(line, startIndex, row) {
if (startIndex)
line = line.substring(startIndex);
var matches = [];
line.replace(re, function(str) {
var offset = arguments[arguments.length-2];
matches.push({
str: str,
offset: startIndex + offset
});
return str;
});
for (var i=matches.length-1; i>= 0; i--) {
var match = matches[i];
var range = self.$rangeFromMatch(row, match.offset, match.str.length);
if (callback(range))
var matchIterator = function(line, row, startIndex) {
var matches = lang.getMatchOffsets(line, re);
for (var i = matches.length-1; i >= 0; i--)
if (callback(matches[i], row, startIndex))
return true;
}
}
} else {
var matchIterator = function(line, startIndex, row) {
if (startIndex)
line = line.substring(startIndex);
var matches = [];
line.replace(re, function(str) {
var offset = arguments[arguments.length-2];
matches.push({
str: str,
offset: startIndex + offset
});
return str;
});
for (var i=0; i<matches.length; i++) {
var match = matches[i];
var range = self.$rangeFromMatch(row, match.offset, match.str.length);
if (callback(range))
var matchIterator = function(line, row, startIndex) {
var matches = lang.getMatchOffsets(line, re);
for (var i = 0; i < matches.length; i++)
if (callback(matches[i], row, startIndex))
return true;
}
}
}
return {forEach: function(_callback) {
callback = _callback;
self.$lineIterator(session).forEach(matchIterator);
}};
};
this.$rangeFromMatch = function(row, column, length) {
return new Range(row, column, row, column+length);
};
this.$assembleRegExp = function() {
if (typeof this.$options.needle != 'string')
return this.$options.needle;
var needle = this.$options.needle;
if (!this.$options.regExp) {
if (/[\n\r]/.test(needle)){
this.$options.$isMultiLine = true;
return needle.split(/\r\n|\r|\n/)
return {
forEach: function(_callback) {
callback = _callback;
self.$lineIterator(session, options).forEach(matchIterator);
}
};
};
this.$assembleRegExp = function(options) {
if (options.needle instanceof RegExp)
return options.re = options.needle;
var needle = options.needle;
if (!options.needle)
return options.re = false;
if (!options.regExp)
needle = lang.escapeRegExp(needle);
}
this.$options.$isMultiLine = false;
if (this.$options.wholeWord) {
if (options.wholeWord)
needle = "\\b" + needle + "\\b";
}
var modifier = "g";
if (!this.$options.caseSensitive) {
modifier += "i";
}
var modifier = options.caseSensitive ? "g" : "gi";
options.$isMultiLine = /[\n\r]/.test(needle);
if (options.$isMultiLine)
return options.re = this.$assembleMultilineRegExp(needle, modifier);
try {
var re = new RegExp(needle, modifier);
} catch(e) {
var re = false;
}
catch(e) {
return options.re = re;
};
this.$assembleMultilineRegExp = function(needle, modifier) {
var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
var re = [];
for (var i = 0; i < parts.length; i++) try {
re.push(new RegExp(parts[i], modifier));
} catch(e) {
return false;
}
if (parts[0] == "") {
re.shift();
re.offset = 1;
} else {
re.offset = 0;
}
return re;
};
this.$lineIterator = function(session) {
var searchSelection = this.$options.scope == Search.SELECTION;
var backwards = this.$options.backwards;
this.$lineIterator = function(session, options) {
var range = options.range;
var backwards = options.backwards == true;
var skipCurrent = options.skipCurrent != false;
var range = this.$options.range || session.getSelection().getRange();
var start = this.$options.start || range[searchSelection != backwards ? "start" : "end"];
var range = options.range;
var start = options.start;
if (!start)
start = range ? range[backwards ? "end" : "start"] : session.selection.getRange();
if (start.start)
start = start[skipCurrent != backwards ? "end" : "start"];
var firstRow = searchSelection ? range.start.row : 0;
var firstColumn = searchSelection ? range.start.column : 0;
var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
var wrap = this.$options.wrap;
var inWrap = false;
function getLine(row) {
var line = session.getLine(row);
if (searchSelection && row == range.end.row) {
line = line.substring(0, range.end.column);
}
if (inWrap && row == start.row) {
line = line.substring(0, start.column);
}
return line;
}
var firstRow = range ? range.start.row : 0;
var firstColumn = range ? range.start.column : 0;
var lastRow = range ? range.end.row : session.getLength() - 1;
if (!backwards) {
var forEach = function(callback) {
var row = start.row;
var line = getLine(row);
var startIndex = start.column;
var line = session.getLine(row).substr(start.column);
if (callback(line, row, start.column))
return;
var stop = false;
inWrap = false;
while (!callback(line, startIndex, row)) {
if (stop)
for (row = row+1; row <= lastRow; row++)
if (callback(session.getLine(row), row))
return;
row++;
startIndex = 0;
if (options.wrap == false)
return;
if (row > lastRow) {
if (wrap) {
row = firstRow;
startIndex = firstColumn;
inWrap = true;
} else {
return;
}
}
if (row == start.row)
stop = true;
line = getLine(row);
}
for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
if (callback(session.getLine(row), row))
return;
}
} else {
var forEach = function(callback) {
var row = start.row;
var line = session.getLine(row).substring(0, start.column);
var startIndex = 0;
var stop = false;
var inWrap = false;
if (callback(line, row))
return;
while (!callback(line, startIndex, row)) {
if (stop)
for (row--; row >= firstRow; row--)
if (callback(session.getLine(row), row))
return;
row--;
startIndex = 0;
if (options.wrap == false)
return;
if (row < firstRow) {
if (wrap) {
row = lastRow;
inWrap = true;
} else {
return;
}
}
if (row == start.row)
stop = true;
line = session.getLine(row);
if (searchSelection) {
if (row == firstRow)
startIndex = firstColumn;
else if (row == lastRow)
line = line.substring(0, range.end.column);
}
if (inWrap && row == start.row)
startIndex = start.column;
}
for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
if (callback(session.getLine(row), row))
return;
}
}

View file

@ -0,0 +1,87 @@
/* vim:ts=4:sts=4:sw=4:
* ***** 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):
* Harutyun Amirjanyan <harutyun@c9.io>
*
* 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) {
"use strict";
var lang = require("./lib/lang");
var oop = require("./lib/oop");
var Range = require("./range").Range;
var SearchHighlight = function(regExp, clazz, type) {
this.setRegexp(regExp);
this.clazz = clazz;
this.type = type || "text";
};
(function() {
this.setRegexp = function(regExp) {
if (this.regExp+"" == regExp+"")
return;
this.regExp = regExp;
this.cache = [];
};
this.update = function(html, markerLayer, session, config) {
if (!this.regExp)
return;
var start = config.firstRow, end = config.lastRow;
for (var i = start; i <= end; i++) {
var ranges = this.cache[i];
if (ranges == null) {
ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);
ranges = ranges.map(function(match) {
return new Range(i, match.offset, i, match.offset + match.length);
});
this.cache[i] = ranges.length ? ranges : "";
}
for (var j = ranges.length; j --; ) {
markerLayer.drawSingleLineMarker(
html, ranges[j].toScreenRange(session), this.clazz, config,
null, this.type
);
}
}
};
}).call(SearchHighlight.prototype);
exports.SearchHighlight = SearchHighlight;
});

View file

@ -52,7 +52,6 @@ module.exports = {
var search = new Search();
search.set({
needle: "juhu",
scope: Search.ALL
});
},
@ -90,7 +89,7 @@ module.exports = {
assert.position(range.end, 1, 12);
},
"test: wrap search is off by default" : function() {
"test: wrap search is on by default" : function() {
var session = new EditSession(["abc", "juhu kinners 123", "456"]);
session.getSelection().moveCursorTo(2, 1);
@ -98,7 +97,7 @@ module.exports = {
needle: "kinners"
});
assert.equal(search.find(session), null);
assert.notEqual(search.find(session), null);
},
"test: wrap search should wrap at file end" : function() {
@ -115,6 +114,20 @@ module.exports = {
assert.position(range.end, 1, 12);
},
"test: wrap search should find needle even if it starts inside it" : function() {
var session = new EditSession(["abc", "juhu kinners 123", "456"]);
session.getSelection().moveCursorTo(6, 1);
var search = new Search().set({
needle: "kinners",
wrap: true
});
var range = search.find(session);
assert.position(range.start, 1, 5);
assert.position(range.end, 1, 12);
},
"test: wrap search with no match should return 'null'": function() {
var session = new EditSession(["abc", "juhu kinners 123", "456"]);
session.getSelection().moveCursorTo(2, 1);
@ -183,13 +196,19 @@ module.exports = {
var search = new Search().set({
needle: "juhu",
wrap: true,
scope: Search.SELECTION
range: session.getSelection().getRange()
});
var range = search.find(session);
assert.position(range.start, 1, 0);
assert.position(range.end, 1, 4);
search = new Search().set({
needle: "juhu",
wrap: true,
range: session.getSelection().getRange()
});
session.getSelection().setSelectionAnchor(0, 2);
session.getSelection().selectTo(3, 2);
@ -201,24 +220,32 @@ module.exports = {
"test: find backwards in selection": function() {
var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]);
session.getSelection().setSelectionAnchor(0, 2);
session.getSelection().selectTo(3, 2);
var search = new Search().set({
needle: "juhu",
wrap: true,
backwards: true,
scope: Search.SELECTION
range: session.getSelection().getRange()
});
session.getSelection().setSelectionAnchor(0, 2);
session.getSelection().selectTo(3, 2);
var range = search.find(session);
assert.position(range.start, 2, 0);
assert.position(range.end, 2, 4);
search = new Search().set({
needle: "juhu",
wrap: true,
range: session.getSelection().getRange()
});
session.getSelection().setSelectionAnchor(0, 2);
session.getSelection().selectTo(1, 2);
assert.equal(search.find(session), null);
var range = search.find(session);
assert.position(range.start, 1, 0);
assert.position(range.end, 1, 4);
},
"test: edge case - match directly before the cursor" : function() {
@ -295,15 +322,15 @@ module.exports = {
"test: find all matches in selection" : function() {
var session = new EditSession(["juhu", "juhu", "juhu", "juhu"]);
session.getSelection().setSelectionAnchor(0, 2);
session.getSelection().selectTo(3, 2);
var search = new Search().set({
needle: "uh",
wrap: true,
scope: Search.SELECTION
range: session.getSelection().getRange()
});
session.getSelection().setSelectionAnchor(0, 2);
session.getSelection().selectTo(3, 2);
var ranges = search.findAll(session);
assert.equal(ranges.length, 2);
@ -322,6 +349,11 @@ module.exports = {
assert.equal(search.replace("", "kinners"), null);
assert.equal(search.replace(" juhu", "kinners"), null);
// case sensitivity
assert.equal(search.replace("Juhu", "kinners"), "kinners");
search.set({caseSensitive: true});
assert.equal(search.replace("Juhu", "kinners"), null);
// regexp replacement
},
@ -356,7 +388,6 @@ module.exports = {
needle: "[ ]+$",
regExp: true,
wrap: true,
scope: Search.ALL
});
session.getSelection().moveCursorTo(1, 2);
@ -404,12 +435,12 @@ module.exports = {
var ranges = search.findAll(session);
assert.equal(ranges.length, 3);
assert.position(ranges[0].start, 0, 23);
assert.position(ranges[0].end, 0, 26);
assert.position(ranges[2].start, 0, 23);
assert.position(ranges[2].end, 0, 26);
assert.position(ranges[1].start, 0, 8);
assert.position(ranges[1].end, 0, 11);
assert.position(ranges[2].start, 0, 0);
assert.position(ranges[2].end, 0, 3);
assert.position(ranges[0].start, 0, 0);
assert.position(ranges[0].end, 0, 3);
},
};

View file

@ -55,7 +55,7 @@ var Range = require("./range").Range;
/**
* new Selection(session)
* - session (EditSession): The session to use
*
*
* Creates a new `Selection` object.
*
**/
@ -88,7 +88,7 @@ var Selection = function(session) {
/**
* Selection.isEmpty() -> Boolean
*
*
* Returns `true` if the selection is empty.
**/
this.isEmpty = function() {
@ -100,7 +100,7 @@ var Selection = function(session) {
/**
* Selection.isMultiLine() -> Boolean
*
*
* Returns `true` if the selection is a multi-line.
**/
this.isMultiLine = function() {
@ -113,7 +113,7 @@ var Selection = function(session) {
/**
* Selection.getCursor() -> Number
*
*
* Gets the current position of the cursor.
**/
this.getCursor = function() {
@ -121,7 +121,7 @@ var Selection = function(session) {
};
/**
* Selection.setSelectionAnchor(row, column)
* Selection.setSelectionAnchor(row, column)
* - row (Number): The new row
* - column (Number): The new column
*
@ -138,7 +138,7 @@ var Selection = function(session) {
/** related to: Anchor.getPosition
* Selection.getSelectionAnchor() -> Object
*
*
* Returns an object containing the `row` and `column` of the calling selection anchor.
*
**/
@ -149,9 +149,9 @@ var Selection = function(session) {
return this.anchor.getPosition();
};
/**
/**
* Selection.getSelectionLead() -> Object
*
*
* Returns an object containing the `row` and `column` of the calling selection lead.
**/
this.getSelectionLead = function() {
@ -159,9 +159,9 @@ var Selection = function(session) {
};
/**
* Selection.shiftSelection(columns)
* Selection.shiftSelection(columns)
* - columns (Number): The number of columns to shift by
*
*
* Shifts the selection up (or down, if [[Selection.isBackwards `isBackwards()`]] is true) the given number of columns.
*
**/
@ -188,7 +188,7 @@ var Selection = function(session) {
/**
* Selection.isBackwards() -> Boolean
*
*
* Returns `true` if the selection is going backwards in the document.
**/
this.isBackwards = function() {
@ -199,7 +199,7 @@ var Selection = function(session) {
/**
* Selection.getRange() -> Range
*
*
* [Returns the [[Range `Range`]] for the selected text.]{: #Selection.getRange}
**/
this.getRange = function() {
@ -218,8 +218,8 @@ var Selection = function(session) {
};
/**
* Selection.clearSelection()
*
* Selection.clearSelection()
*
* [Empties the selection (by de-selecting it). This function also emits the `'changeSelection'` event.]{: #Selection.clearSelection}
**/
this.clearSelection = function() {
@ -230,24 +230,25 @@ var Selection = function(session) {
};
/**
* Selection.selectAll()
*
* Selection.selectAll()
*
* Selects all the text in the document.
**/
this.selectAll = function() {
var lastRow = this.doc.getLength() - 1;
this.setSelectionAnchor(lastRow, this.doc.getLine(lastRow).length);
this.moveCursorTo(0, 0);
this.setSelectionAnchor(0, 0);
this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
};
/**
* Selection.setSelectionRange(range, reverse)
* Selection.setSelectionRange(range, reverse)
* - range (Range): The range of text to select
* - reverse (Boolean): Indicates if the range should go backwards (`true`) or not
*
* Sets the selection to the provided range.
*
**/
this.setRange =
this.setSelectionRange = function(range, reverse) {
if (reverse) {
this.setSelectionAnchor(range.end.row, range.end.column);
@ -268,7 +269,7 @@ var Selection = function(session) {
};
/**
* Selection.selectTo(row, column)
* Selection.selectTo(row, column)
* - row (Number): The row to select to
* - column (Number): The column to select to
*
@ -282,9 +283,9 @@ var Selection = function(session) {
};
/**
* Selection.selectToPosition(pos)
* Selection.selectToPosition(pos)
* - pos (Object): An object containing the row and column
*
*
* Moves the selection cursor to the row and column indicated by `pos`.
*
**/
@ -295,8 +296,8 @@ var Selection = function(session) {
};
/**
* Selection.selectUp()
*
* Selection.selectUp()
*
* Moves the selection up one row.
**/
this.selectUp = function() {
@ -304,8 +305,8 @@ var Selection = function(session) {
};
/**
* Selection.selectDown()
*
* Selection.selectDown()
*
* Moves the selection down one row.
**/
this.selectDown = function() {
@ -313,8 +314,8 @@ var Selection = function(session) {
};
/**
* Selection.selectRight()
*
* Selection.selectRight()
*
* Moves the selection right one column.
**/
this.selectRight = function() {
@ -322,8 +323,8 @@ var Selection = function(session) {
};
/**
* Selection.selectLeft()
*
* Selection.selectLeft()
*
* Moves the selection left one column.
**/
this.selectLeft = function() {
@ -331,8 +332,8 @@ var Selection = function(session) {
};
/**
* Selection.selectLineStart()
*
* Selection.selectLineStart()
*
* Moves the selection to the beginning of the current line.
**/
this.selectLineStart = function() {
@ -340,8 +341,8 @@ var Selection = function(session) {
};
/**
* Selection.selectLineEnd()
*
* Selection.selectLineEnd()
*
* Moves the selection to the end of the current line.
**/
this.selectLineEnd = function() {
@ -349,8 +350,8 @@ var Selection = function(session) {
};
/**
* Selection.selectFileEnd()
*
* Selection.selectFileEnd()
*
* Moves the selection to the end of the file.
**/
this.selectFileEnd = function() {
@ -358,8 +359,8 @@ var Selection = function(session) {
};
/**
* Selection.selectFileStart()
*
* Selection.selectFileStart()
*
* Moves the selection to the start of the file.
**/
this.selectFileStart = function() {
@ -367,8 +368,8 @@ var Selection = function(session) {
};
/**
* Selection.selectWordRight()
*
* Selection.selectWordRight()
*
* Moves the selection to the first word on the right.
**/
this.selectWordRight = function() {
@ -376,8 +377,8 @@ var Selection = function(session) {
};
/**
* Selection.selectWordLeft()
*
* Selection.selectWordLeft()
*
* Moves the selection to the first word on the left.
**/
this.selectWordLeft = function() {
@ -385,8 +386,8 @@ var Selection = function(session) {
};
/** related to: EditSession.getWordRange
* Selection.selectWord()
*
* Selection.selectWord()
*
* Moves the selection to highlight the entire word.
**/
this.getWordRange = function(row, column) {
@ -403,8 +404,8 @@ var Selection = function(session) {
};
/** related to: EditSession.getAWordRange
* Selection.selectAWord()
*
* Selection.selectAWord()
*
* Selects a word, including its right whitespace.
**/
this.selectAWord = function() {
@ -430,9 +431,9 @@ var Selection = function(session) {
return new Range(rowStart, 0, rowEnd + 1, 0);
};
/**
* Selection.selectLine()
*
/**
* Selection.selectLine()
*
* Selects the entire line.
**/
this.selectLine = function() {
@ -440,8 +441,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorUp()
*
* Selection.moveCursorUp()
*
* Moves the cursor up one row.
**/
this.moveCursorUp = function() {
@ -449,8 +450,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorDown()
*
* Selection.moveCursorDown()
*
* Moves the cursor down one row.
**/
this.moveCursorDown = function() {
@ -458,8 +459,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorLeft()
*
* Selection.moveCursorLeft()
*
* Moves the cursor left one column.
**/
this.moveCursorLeft = function() {
@ -484,8 +485,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorRight()
*
* Selection.moveCursorRight()
*
* Moves the cursor right one column.
**/
this.moveCursorRight = function() {
@ -510,8 +511,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorLineStart()
*
* Selection.moveCursorLineStart()
*
* Moves the cursor to the start of the line.
**/
this.moveCursorLineStart = function() {
@ -543,8 +544,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorLineEnd()
*
* Selection.moveCursorLineEnd()
*
* Moves the cursor to the end of the line.
**/
this.moveCursorLineEnd = function() {
@ -558,8 +559,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorFileEnd()
*
* Selection.moveCursorFileEnd()
*
* Moves the cursor to the end of the file.
**/
this.moveCursorFileEnd = function() {
@ -569,8 +570,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorFileStart()
*
* Selection.moveCursorFileStart()
*
* Moves the cursor to the start of the file.
**/
this.moveCursorFileStart = function() {
@ -578,8 +579,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorLongWordRight()
*
* Selection.moveCursorLongWordRight()
*
* Moves the cursor to the word on the right.
**/
this.moveCursorLongWordRight = function() {
@ -598,14 +599,14 @@ var Selection = function(session) {
this.moveCursorTo(fold.end.row, fold.end.column);
return;
}
// first skip space
if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
column += this.session.nonTokenRe.lastIndex;
this.session.nonTokenRe.lastIndex = 0;
rightOfCursor = line.substring(column);
}
// if at line end proceed with next line
if (column >= line.length) {
this.moveCursorTo(row, line.length);
@ -614,7 +615,7 @@ var Selection = function(session) {
this.moveCursorWordRight();
return;
}
// advance to the end of the next token
if (match = this.session.tokenRe.exec(rightOfCursor)) {
column += this.session.tokenRe.lastIndex;
@ -625,8 +626,8 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorLongWordLeft()
*
* Selection.moveCursorLongWordLeft()
*
* Moves the cursor to the word on the left.
**/
this.moveCursorLongWordLeft = function() {
@ -644,19 +645,19 @@ var Selection = function(session) {
if (str == null) {
str = this.doc.getLine(row).substring(0, column)
}
var leftOfCursor = lang.stringReverse(str);
var match;
this.session.nonTokenRe.lastIndex = 0;
this.session.tokenRe.lastIndex = 0;
// skip whitespace
if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
column -= this.session.nonTokenRe.lastIndex;
leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
this.session.nonTokenRe.lastIndex = 0;
}
// if at begin of the line proceed in line above
if (column <= 0) {
this.moveCursorTo(row, 0);
@ -721,8 +722,17 @@ var Selection = function(session) {
if (fold)
return this.moveCursorTo(fold.end.row, fold.end.column);
if (column == line.length)
return this.moveCursorRight();
if (column == line.length) {
var l = this.doc.getLength();
do {
row++;
rightOfCursor = this.doc.getLine(row)
} while (row < l && /^\s*$/.test(rightOfCursor))
if (!/^\s+/.test(rightOfCursor))
rightOfCursor = ""
column = 0;
}
var index = this.$shortWordEndIndex(rightOfCursor);
@ -737,11 +747,19 @@ var Selection = function(session) {
if (fold = this.session.getFoldAt(row, column, -1))
return this.moveCursorTo(fold.start.row, fold.start.column);
if (column == 0)
return this.moveCursorLeft();
var line = this.session.getLine(row).substring(0, column);
if (column == 0) {
do {
row--;
line = this.doc.getLine(row);
} while (row > 0 && /^\s*$/.test(line))
column = line.length;
if (!/\s+$/.test(line))
line = ""
}
var str = this.session.getLine(row).substring(0, column);
var leftOfCursor = lang.stringReverse(str);
var leftOfCursor = lang.stringReverse(line);
var index = this.$shortWordEndIndex(leftOfCursor);
return this.moveCursorTo(row, column - index);
@ -762,7 +780,7 @@ var Selection = function(session) {
};
/** related to: EditSession.documentToScreenPosition
* Selection.moveCursorBy(rows, chars)
* Selection.moveCursorBy(rows, chars)
* - rows (Number): The number of rows to move by
* - chars (Number): The number of characters to move by
*
@ -788,9 +806,9 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorToPosition(position)
* Selection.moveCursorToPosition(position)
* - position (Object): The position to move to
*
*
* Moves the selection to the position indicated by its `row` and `column`.
**/
this.moveCursorToPosition = function(position) {
@ -798,7 +816,7 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorTo(row, column, keepDesiredColumn)
* Selection.moveCursorTo(row, column, keepDesiredColumn)
* - row (Number): The row to move to
* - column (Number): The column to move to
* - keepDesiredColumn (Boolean): [If `true`, the cursor move does not respect the previous column]{: #preventUpdateBool}
@ -822,7 +840,7 @@ var Selection = function(session) {
};
/**
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
* Selection.moveCursorToScreen(row, column, keepDesiredColumn)
* - row (Number): The row to move to
* - column (Number): The column to move to
* - keepDesiredColumn (Boolean): {:preventUpdateBool}

View file

@ -11,6 +11,7 @@ var log = document.getElementById("log")
var testNames = [
"ace/anchor_test",
"ace/background_tokenizer_test",
"ace/commands/command_manager_test",
"ace/document_test",
"ace/edit_session_test",
@ -65,7 +66,11 @@ if (location.search)
testNames = location.search.substr(1).split(",")
require(testNames, function() {
var tests = testNames.map(require);
var tests = testNames.map(function(x) {
var module = require(x);
module.href = x;
return module;
});
async.list(tests)
.expand(function(test) {
@ -73,6 +78,12 @@ require(testNames, function() {
}, AsyncTest.TestGenerator)
.run()
.each(function(test, next) {
if (test.index == 1 && test.context.href) {
var href = test.context.href;
var node = document.createElement("div");
node.innerHTML = "<a href='?" + href + "'>" + href.replace(/^ace\//, "") + "</a>";
log.appendChild(node);
}
var node = document.createElement("div");
node.className = test.passed ? "passed" : "failed";

View file

@ -163,7 +163,7 @@ MockRenderer.prototype.updateBackMarkers = function() {
MockRenderer.prototype.updateFrontMarkers = function() {
};
MockRenderer.prototype.setBreakpoints = function() {
MockRenderer.prototype.updateBreakpoints = function() {
};
MockRenderer.prototype.onResize = function() {

157
lib/ace/theme/chrome.css Normal file
View file

@ -0,0 +1,157 @@
.ace-chrome .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-chrome .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-chrome .ace_gutter {
background: #e8e8e8;
color: #333;
overflow : hidden;
}
.ace-chrome .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-chrome .ace_text-layer {
cursor: text;
}
.ace-chrome .ace_cursor {
border-left: 2px solid black;
}
.ace-chrome .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid black;
}
.ace-chrome .ace_line .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-chrome .ace_line .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-chrome .ace_line .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-chrome .ace_line .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_line .ace_invalid {
background-color: rgb(153, 0, 0);
color: white;
}
.ace-chrome .ace_line .ace_fold {
}
.ace-chrome .ace_line .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-chrome .ace_line .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_line .ace_support.ace_type,
.ace-chrome .ace_line .ace_support.ace_class {
color: rgb(109, 121, 222);
}
.ace-chrome .ace_variable.ace_parameter {
font-style:italic;
color:#FD971F;
}
.ace-chrome .ace_line .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-chrome .ace_line .ace_comment {
color: #236e24;
}
.ace-chrome .ace_line .ace_comment.ace_doc {
color: #236e24;
}
.ace-chrome .ace_line .ace_comment.ace_doc.ace_tag {
color: #236e24;
}
.ace-chrome .ace_line .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-chrome .ace_line .ace_variable {
color: rgb(49, 132, 149);
}
.ace-chrome .ace_line .ace_xml_pe {
color: rgb(104, 104, 91);
}
.ace-chrome .ace_entity.ace_name.ace_function {
color: #0000A2;
}
.ace-chrome .ace_markup.ace_markupine {
text-decoration:underline;
}
.ace-chrome .ace_markup.ace_heading {
color: rgb(12, 7, 255);
}
.ace-chrome .ace_markup.ace_list {
color:rgb(185, 6, 144);
}
.ace-chrome .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-chrome .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
}
.ace-chrome .ace_marker-layer .ace_stack {
background: rgb(164, 229, 101);
}
.ace-chrome .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-chrome .ace_marker-layer .ace_active_line {
background: rgba(0, 0, 0, 0.07);
}
.ace-chrome .ace_marker-layer .ace_selected_word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-chrome .ace_storage,
.ace-chrome .ace_line .ace_keyword,
.ace-chrome .ace_meta.ace_tag {
color: rgb(147, 15, 128);
}
.ace-chrome .ace_string.ace_regex {
color: rgb(255, 0, 0)
}
.ace-chrome .ace_line .ace_string,
.ace-chrome .ace_entity.ace_other.ace_attribute-name{
color: #994409;
}

View file

@ -38,168 +38,7 @@
define(function(require, exports, module) {
exports.cssClass = "ace-chrome";
exports.cssText = ".ace-chrome .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-chrome .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-chrome .ace_gutter {\
background: #e8e8e8;\
color: #333;\
overflow : hidden;\
}\
\
.ace-chrome .ace_gutter-layer {\
width: 100%;\
text-align: right;\
}\
\
.ace-chrome .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-chrome .ace_text-layer {\
cursor: text;\
}\
\
.ace-chrome .ace_cursor {\
border-left: 2px solid black;\
}\
\
.ace-chrome .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid black;\
}\
\
.ace-chrome .ace_line .ace_invisible {\
color: rgb(191, 191, 191);\
}\
\
.ace-chrome .ace_line .ace_constant.ace_buildin {\
color: rgb(88, 72, 246);\
}\
\
.ace-chrome .ace_line .ace_constant.ace_language {\
color: rgb(88, 92, 246);\
}\
\
.ace-chrome .ace_line .ace_constant.ace_library {\
color: rgb(6, 150, 14);\
}\
\
.ace-chrome .ace_line .ace_invalid {\
background-color: rgb(153, 0, 0);\
color: white;\
}\
\
.ace-chrome .ace_line .ace_fold {\
}\
\
.ace-chrome .ace_line .ace_support.ace_function {\
color: rgb(60, 76, 114);\
}\
\
.ace-chrome .ace_line .ace_support.ace_constant {\
color: rgb(6, 150, 14);\
}\
\
.ace-chrome .ace_line .ace_support.ace_type,\
.ace-chrome .ace_line .ace_support.ace_class {\
color: rgb(109, 121, 222);\
}\
\
.ace-chrome .ace_variable.ace_parameter {\
font-style:italic;\
color:#FD971F;\
}\
.ace-chrome .ace_line .ace_keyword.ace_operator {\
color: rgb(104, 118, 135);\
}\
\
.ace-chrome .ace_line .ace_comment {\
color: #236e24;\
}\
\
.ace-chrome .ace_line .ace_comment.ace_doc {\
color: #236e24;\
}\
\
.ace-chrome .ace_line .ace_comment.ace_doc.ace_tag {\
color: #236e24;\
}\
\
.ace-chrome .ace_line .ace_constant.ace_numeric {\
color: rgb(0, 0, 205);\
}\
\
.ace-chrome .ace_line .ace_variable {\
color: rgb(49, 132, 149);\
}\
\
.ace-chrome .ace_line .ace_xml_pe {\
color: rgb(104, 104, 91);\
}\
\
.ace-chrome .ace_entity.ace_name.ace_function {\
color: #0000A2;\
}\
\
.ace-chrome .ace_markup.ace_markupine {\
text-decoration:underline;\
}\
\
.ace-chrome .ace_markup.ace_heading {\
color: rgb(12, 7, 255);\
}\
\
.ace-chrome .ace_markup.ace_list {\
color:rgb(185, 6, 144);\
}\
\
.ace-chrome .ace_marker-layer .ace_selection {\
background: rgb(181, 213, 255);\
}\
\
.ace-chrome .ace_marker-layer .ace_step {\
background: rgb(252, 255, 0);\
}\
\
.ace-chrome .ace_marker-layer .ace_stack {\
background: rgb(164, 229, 101);\
}\
\
.ace-chrome .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgb(192, 192, 192);\
}\
\
.ace-chrome .ace_marker-layer .ace_active_line {\
background: rgba(0, 0, 0, 0.07);\
}\
\
.ace-chrome .ace_marker-layer .ace_selected_word {\
background: rgb(250, 250, 255);\
border: 1px solid rgb(200, 200, 250);\
}\
\
.ace-chrome .ace_storage,\
.ace-chrome .ace_line .ace_keyword,\
.ace-chrome .ace_meta.ace_tag {\
color: rgb(147, 15, 128);\
}\
\
.ace-chrome .ace_string.ace_regex {\
color: rgb(255, 0, 0)\
}\
\
.ace-chrome .ace_line .ace_string,\
.ace-chrome .ace_entity.ace_other.ace_attribute-name{\
color: #994409;\
}";
exports.cssText = require('ace/requirejs/text!./chrome.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

119
lib/ace/theme/clouds.css Normal file
View file

@ -0,0 +1,119 @@
.ace-clouds .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-clouds .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-clouds .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-clouds .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-clouds .ace_scroller {
background-color: #FFFFFF;
}
.ace-clouds .ace_text-layer {
cursor: text;
color: #000000;
}
.ace-clouds .ace_cursor {
border-left: 2px solid #000000;
}
.ace-clouds .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #000000;
}
.ace-clouds .ace_marker-layer .ace_selection {
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 {
background: rgb(255, 255, 0);
}
.ace-clouds .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #BFBFBF;
}
.ace-clouds .ace_marker-layer .ace_active_line {
background: #FFFBD1;
}
.ace-clouds .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-clouds .ace_marker-layer .ace_selected_word {
border: 1px solid #BDD5FC;
}
.ace-clouds .ace_invisible {
color: #BFBFBF;
}
.ace-clouds .ace_keyword, .ace-clouds .ace_meta {
color:#AF956F;
}
.ace-clouds .ace_keyword.ace_operator {
color:#484848;
}
.ace-clouds .ace_constant.ace_language {
color:#39946A;
}
.ace-clouds .ace_constant.ace_numeric {
color:#46A609;
}
.ace-clouds .ace_invalid {
background-color:#FF002A;
}
.ace-clouds .ace_fold {
background-color: #AF956F;
border-color: #000000;
}
.ace-clouds .ace_support.ace_function {
color:#C52727;
}
.ace-clouds .ace_storage {
color:#C52727;
}
.ace-clouds .ace_string {
color:#5D90CD;
}
.ace-clouds .ace_comment {
color:#BCC8BA;
}
.ace-clouds .ace_entity.ace_other.ace_attribute-name {
color:#606060;
}
.ace-clouds .ace_markup.ace_underline {
text-decoration:underline;
}

View file

@ -39,121 +39,7 @@ define(function(require, exports, module) {
exports.isDark = false;
exports.cssClass = "ace-clouds";
exports.cssText = "\
.ace-clouds .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-clouds .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-clouds .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-clouds .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-clouds .ace_scroller {\
background-color: #FFFFFF;\
}\
\
.ace-clouds .ace_text-layer {\
cursor: text;\
color: #000000;\
}\
\
.ace-clouds .ace_cursor {\
border-left: 2px solid #000000;\
}\
\
.ace-clouds .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #000000;\
}\
\
.ace-clouds .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-clouds .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #BFBFBF;\
}\
\
.ace-clouds .ace_marker-layer .ace_active_line {\
background: #FFFBD1;\
}\
\
.ace-clouds .ace_marker-layer .ace_selected_word {\
border: 1px solid #BDD5FC;\
}\
\
.ace-clouds .ace_invisible {\
color: #BFBFBF;\
}\
\
.ace-clouds .ace_keyword, .ace-clouds .ace_meta {\
color:#AF956F;\
}\
\
.ace-clouds .ace_keyword.ace_operator {\
color:#484848;\
}\
\
.ace-clouds .ace_constant.ace_language {\
color:#39946A;\
}\
\
.ace-clouds .ace_constant.ace_numeric {\
color:#46A609;\
}\
\
.ace-clouds .ace_invalid {\
background-color:#FF002A;\
}\
\
.ace-clouds .ace_fold {\
background-color: #AF956F;\
border-color: #000000;\
}\
\
.ace-clouds .ace_support.ace_function {\
color:#C52727;\
}\
\
.ace-clouds .ace_storage {\
color:#C52727;\
}\
\
.ace-clouds .ace_string {\
color:#5D90CD;\
}\
\
.ace-clouds .ace_comment {\
color:#BCC8BA;\
}\
\
.ace-clouds .ace_entity.ace_other.ace_attribute-name {\
color:#606060;\
}\
\
.ace-clouds .ace_markup.ace_underline {\
text-decoration:underline;\
}";
exports.cssText = require('ace/requirejs/text!./clouds.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

View file

@ -0,0 +1,120 @@
.ace-clouds-midnight .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-clouds-midnight .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-clouds-midnight .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-clouds-midnight .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-clouds-midnight .ace_scroller {
background-color: #191919;
}
.ace-clouds-midnight .ace_text-layer {
cursor: text;
color: #929292;
}
.ace-clouds-midnight .ace_cursor {
border-left: 2px solid #7DA5DC;
}
.ace-clouds-midnight .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #7DA5DC;
}
.ace-clouds-midnight .ace_marker-layer .ace_selection {
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 {
background: rgb(102, 82, 0);
}
.ace-clouds-midnight .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #BFBFBF;
}
.ace-clouds-midnight .ace_marker-layer .ace_active_line {
background: rgba(215, 215, 215, 0.031);
}
.ace-clouds-midnight .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-clouds-midnight .ace_marker-layer .ace_selected_word {
border: 1px solid #000000;
}
.ace-clouds-midnight .ace_invisible {
color: #BFBFBF;
}
.ace-clouds-midnight .ace_keyword, .ace-clouds-midnight .ace_meta {
color:#927C5D;
}
.ace-clouds-midnight .ace_keyword.ace_operator {
color:#4B4B4B;
}
.ace-clouds-midnight .ace_constant.ace_language {
color:#39946A;
}
.ace-clouds-midnight .ace_constant.ace_numeric {
color:#46A609;
}
.ace-clouds-midnight .ace_invalid {
color:#FFFFFF;
background-color:#E92E2E;
}
.ace-clouds-midnight .ace_fold {
background-color: #927C5D;
border-color: #929292;
}
.ace-clouds-midnight .ace_support.ace_function {
color:#E92E2E;
}
.ace-clouds-midnight .ace_storage {
color:#E92E2E;
}
.ace-clouds-midnight .ace_string {
color:#5D90CD;
}
.ace-clouds-midnight .ace_comment {
color:#3C403B;
}
.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {
color:#606060;
}
.ace-clouds-midnight .ace_markup.ace_underline {
text-decoration:underline;
}

View file

@ -39,122 +39,7 @@ define(function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-clouds-midnight";
exports.cssText = "\
.ace-clouds-midnight .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-clouds-midnight .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-clouds-midnight .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-clouds-midnight .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-clouds-midnight .ace_scroller {\
background-color: #191919;\
}\
\
.ace-clouds-midnight .ace_text-layer {\
cursor: text;\
color: #929292;\
}\
\
.ace-clouds-midnight .ace_cursor {\
border-left: 2px solid #7DA5DC;\
}\
\
.ace-clouds-midnight .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #7DA5DC;\
}\
\
.ace-clouds-midnight .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-clouds-midnight .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #BFBFBF;\
}\
\
.ace-clouds-midnight .ace_marker-layer .ace_active_line {\
background: rgba(215, 215, 215, 0.031);\
}\
\
.ace-clouds-midnight .ace_marker-layer .ace_selected_word {\
border: 1px solid #000000;\
}\
\
.ace-clouds-midnight .ace_invisible {\
color: #BFBFBF;\
}\
\
.ace-clouds-midnight .ace_keyword, .ace-clouds-midnight .ace_meta {\
color:#927C5D;\
}\
\
.ace-clouds-midnight .ace_keyword.ace_operator {\
color:#4B4B4B;\
}\
\
.ace-clouds-midnight .ace_constant.ace_language {\
color:#39946A;\
}\
\
.ace-clouds-midnight .ace_constant.ace_numeric {\
color:#46A609;\
}\
\
.ace-clouds-midnight .ace_invalid {\
color:#FFFFFF;\
background-color:#E92E2E;\
}\
\
.ace-clouds-midnight .ace_fold {\
background-color: #927C5D;\
border-color: #929292;\
}\
\
.ace-clouds-midnight .ace_support.ace_function {\
color:#E92E2E;\
}\
\
.ace-clouds-midnight .ace_storage {\
color:#E92E2E;\
}\
\
.ace-clouds-midnight .ace_string {\
color:#5D90CD;\
}\
\
.ace-clouds-midnight .ace_comment {\
color:#3C403B;\
}\
\
.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {\
color:#606060;\
}\
\
.ace-clouds-midnight .ace_markup.ace_underline {\
text-decoration:underline;\
}";
exports.cssText = require('ace/requirejs/text!./clouds_midnight.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

146
lib/ace/theme/cobalt.css Normal file
View file

@ -0,0 +1,146 @@
.ace-cobalt .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-cobalt .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-cobalt .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-cobalt .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-cobalt .ace_scroller {
background-color: #002240;
}
.ace-cobalt .ace_text-layer {
cursor: text;
color: #FFFFFF;
}
.ace-cobalt .ace_cursor {
border-left: 2px solid #FFFFFF;
}
.ace-cobalt .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #FFFFFF;
}
.ace-cobalt .ace_marker-layer .ace_selection {
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 {
background: rgb(127, 111, 19);
}
.ace-cobalt .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgba(255, 255, 255, 0.15);
}
.ace-cobalt .ace_marker-layer .ace_active_line {
background: rgba(0, 0, 0, 0.35);
}
.ace-cobalt .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-cobalt .ace_marker-layer .ace_selected_word {
border: 1px solid rgba(179, 101, 57, 0.75);
}
.ace-cobalt .ace_invisible {
color: rgba(255, 255, 255, 0.15);
}
.ace-cobalt .ace_keyword, .ace-cobalt .ace_meta {
color:#FF9D00;
}
.ace-cobalt .ace_constant, .ace-cobalt .ace_constant.ace_other {
color:#FF628C;
}
.ace-cobalt .ace_constant.ace_character, {
color:#FF628C;
}
.ace-cobalt .ace_constant.ace_character.ace_escape, {
color:#FF628C;
}
.ace-cobalt .ace_invalid {
color:#F8F8F8;
background-color:#800F00;
}
.ace-cobalt .ace_support {
color:#80FFBB;
}
.ace-cobalt .ace_support.ace_constant {
color:#EB939A;
}
.ace-cobalt .ace_fold {
background-color: #FF9D00;
border-color: #FFFFFF;
}
.ace-cobalt .ace_support.ace_function {
color:#FFB054;
}
.ace-cobalt .ace_storage {
color:#FFEE80;
}
.ace-cobalt .ace_string.ace_regexp {
color:#80FFC2;
}
.ace-cobalt .ace_comment {
font-style:italic;
color:#0088FF;
}
.ace-cobalt .ace_variable {
color:#CCCCCC;
}
.ace-cobalt .ace_variable.ace_language {
color:#FF80E1;
}
.ace-cobalt .ace_meta.ace_tag {
color:#9EFFFF;
}
.ace-cobalt .ace_markup.ace_underline {
text-decoration:underline;
}
.ace-cobalt .ace_markup.ace_heading {
color:#C8E4FD;
background-color:#001221;
}
.ace-cobalt .ace_markup.ace_list {
background-color:#130D26;
}

View file

@ -39,148 +39,7 @@ define(function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-cobalt";
exports.cssText = "\
.ace-cobalt .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-cobalt .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-cobalt .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-cobalt .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-cobalt .ace_scroller {\
background-color: #002240;\
}\
\
.ace-cobalt .ace_text-layer {\
cursor: text;\
color: #FFFFFF;\
}\
\
.ace-cobalt .ace_cursor {\
border-left: 2px solid #FFFFFF;\
}\
\
.ace-cobalt .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #FFFFFF;\
}\
\
.ace-cobalt .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-cobalt .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgba(255, 255, 255, 0.15);\
}\
\
.ace-cobalt .ace_marker-layer .ace_active_line {\
background: rgba(0, 0, 0, 0.35);\
}\
\
.ace-cobalt .ace_marker-layer .ace_selected_word {\
border: 1px solid rgba(179, 101, 57, 0.75);\
}\
\
.ace-cobalt .ace_invisible {\
color: rgba(255, 255, 255, 0.15);\
}\
\
.ace-cobalt .ace_keyword, .ace-cobalt .ace_meta {\
color:#FF9D00;\
}\
\
.ace-cobalt .ace_constant, .ace-cobalt .ace_constant.ace_other {\
color:#FF628C;\
}\
\
.ace-cobalt .ace_constant.ace_character, {\
color:#FF628C;\
}\
\
.ace-cobalt .ace_constant.ace_character.ace_escape, {\
color:#FF628C;\
}\
\
.ace-cobalt .ace_invalid {\
color:#F8F8F8;\
background-color:#800F00;\
}\
\
.ace-cobalt .ace_support {\
color:#80FFBB;\
}\
\
.ace-cobalt .ace_support.ace_constant {\
color:#EB939A;\
}\
\
.ace-cobalt .ace_fold {\
background-color: #FF9D00;\
border-color: #FFFFFF;\
}\
\
.ace-cobalt .ace_support.ace_function {\
color:#FFB054;\
}\
\
.ace-cobalt .ace_storage {\
color:#FFEE80;\
}\
\
.ace-cobalt .ace_string.ace_regexp {\
color:#80FFC2;\
}\
\
.ace-cobalt .ace_comment {\
font-style:italic;\
color:#0088FF;\
}\
\
.ace-cobalt .ace_variable {\
color:#CCCCCC;\
}\
\
.ace-cobalt .ace_variable.ace_language {\
color:#FF80E1;\
}\
\
.ace-cobalt .ace_meta.ace_tag {\
color:#9EFFFF;\
}\
\
.ace-cobalt .ace_markup.ace_underline {\
text-decoration:underline;\
}\
\
.ace-cobalt .ace_markup.ace_heading {\
color:#C8E4FD;\
background-color:#001221;\
}\
\
.ace-cobalt .ace_markup.ace_list {\
background-color:#130D26;\
}";
exports.cssText = require('ace/requirejs/text!./cobalt.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

View file

@ -0,0 +1,148 @@
.ace-crimson-editor .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-crimson-editor .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-crimson-editor .ace_gutter {
background: #e8e8e8;
color: #333;
overflow : hidden;
}
.ace-crimson-editor .ace_gutter-layer {
width: 100%;
text-align: right;
}
.ace-crimson-editor .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-crimson-editor .ace_text-layer {
cursor: text;
color: rgb(64, 64, 64);
}
.ace-crimson-editor .ace_cursor {
border-left: 2px solid black;
}
.ace-crimson-editor .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid black;
}
.ace-crimson-editor .ace_line .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-crimson-editor .ace_line .ace_identifier {
color: black;
}
.ace-crimson-editor .ace_line .ace_keyword {
color: blue;
}
.ace-crimson-editor .ace_line .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-crimson-editor .ace_line .ace_constant.ace_language {
color: rgb(255, 156, 0);
}
.ace-crimson-editor .ace_line .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-crimson-editor .ace_line .ace_invalid {
text-decoration: line-through;
color: rgb(224, 0, 0);
}
.ace-crimson-editor .ace_line .ace_fold {
}
.ace-crimson-editor .ace_line .ace_support.ace_function {
color: rgb(192, 0, 0);
}
.ace-crimson-editor .ace_line .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-crimson-editor .ace_line .ace_support.ace_type,
.ace-crimson-editor .ace_line .ace_support.ace_class {
color: rgb(109, 121, 222);
}
.ace-crimson-editor .ace_line .ace_keyword.ace_operator {
color: rgb(49, 132, 149);
}
.ace-crimson-editor .ace_line .ace_string {
color: rgb(128, 0, 128);
}
.ace-crimson-editor .ace_line .ace_comment {
color: rgb(76, 136, 107);
}
.ace-crimson-editor .ace_line .ace_comment.ace_doc {
color: rgb(0, 102, 255);
}
.ace-crimson-editor .ace_line .ace_comment.ace_doc.ace_tag {
color: rgb(128, 159, 191);
}
.ace-crimson-editor .ace_line .ace_constant.ace_numeric {
color: rgb(0, 0, 64);
}
.ace-crimson-editor .ace_line .ace_variable {
color: rgb(0, 64, 128);
}
.ace-crimson-editor .ace_line .ace_xml_pe {
color: rgb(104, 104, 91);
}
.ace-crimson-editor .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-crimson-editor .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
}
.ace-crimson-editor .ace_marker-layer .ace_stack {
background: rgb(164, 229, 101);
}
.ace-crimson-editor .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-crimson-editor .ace_marker-layer .ace_active_line {
background: rgb(232, 242, 254);
}
.ace-crimson-editor .ace_meta.ace_tag {
color:rgb(28, 2, 255);
}
.ace-crimson-editor .ace_marker-layer .ace_selected_word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-crimson-editor .ace_string.ace_regex {
color: rgb(192, 0, 192);
}

View file

@ -37,159 +37,7 @@
define(function(require, exports, module) {
exports.isDark = false;
exports.cssText = ".ace-crimson-editor .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-crimson-editor .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-crimson-editor .ace_gutter {\
width: 50px;\
background: #e8e8e8;\
color: #333;\
overflow : hidden;\
}\
\
.ace-crimson-editor .ace_gutter-layer {\
width: 100%;\
text-align: right;\
}\
\
.ace-crimson-editor .ace_gutter-layer .ace_gutter-cell {\
padding-right: 6px;\
}\
\
.ace-crimson-editor .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-crimson-editor .ace_text-layer {\
cursor: text;\
color: rgb(64, 64, 64);\
}\
\
.ace-crimson-editor .ace_cursor {\
border-left: 2px solid black;\
}\
\
.ace-crimson-editor .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid black;\
}\
\
.ace-crimson-editor .ace_line .ace_invisible {\
color: rgb(191, 191, 191);\
}\
\
.ace-crimson-editor .ace_line .ace_identifier {\
color: black;\
}\
\
.ace-crimson-editor .ace_line .ace_keyword {\
color: blue;\
}\
\
.ace-crimson-editor .ace_line .ace_constant.ace_buildin {\
color: rgb(88, 72, 246);\
}\
\
.ace-crimson-editor .ace_line .ace_constant.ace_language {\
color: rgb(255, 156, 0);\
}\
\
.ace-crimson-editor .ace_line .ace_constant.ace_library {\
color: rgb(6, 150, 14);\
}\
\
.ace-crimson-editor .ace_line .ace_invalid {\
text-decoration: line-through;\
color: rgb(224, 0, 0);\
}\
\
.ace-crimson-editor .ace_line .ace_fold {\
}\
\
.ace-crimson-editor .ace_line .ace_support.ace_function {\
color: rgb(192, 0, 0);\
}\
\
.ace-crimson-editor .ace_line .ace_support.ace_constant {\
color: rgb(6, 150, 14);\
}\
\
.ace-crimson-editor .ace_line .ace_support.ace_type,\
.ace-crimson-editor .ace_line .ace_support.ace_class {\
color: rgb(109, 121, 222);\
}\
\
.ace-crimson-editor .ace_line .ace_keyword.ace_operator {\
color: rgb(49, 132, 149);\
}\
\
.ace-crimson-editor .ace_line .ace_string {\
color: rgb(128, 0, 128);\
}\
\
.ace-crimson-editor .ace_line .ace_comment {\
color: rgb(76, 136, 107);\
}\
\
.ace-crimson-editor .ace_line .ace_comment.ace_doc {\
color: rgb(0, 102, 255);\
}\
\
.ace-crimson-editor .ace_line .ace_comment.ace_doc.ace_tag {\
color: rgb(128, 159, 191);\
}\
\
.ace-crimson-editor .ace_line .ace_constant.ace_numeric {\
color: rgb(0, 0, 64);\
}\
\
.ace-crimson-editor .ace_line .ace_variable {\
color: rgb(0, 64, 128);\
}\
\
.ace-crimson-editor .ace_line .ace_xml_pe {\
color: rgb(104, 104, 91);\
}\
\
.ace-crimson-editor .ace_marker-layer .ace_selection {\
background: rgb(181, 213, 255);\
}\
\
.ace-crimson-editor .ace_marker-layer .ace_step {\
background: rgb(252, 255, 0);\
}\
\
.ace-crimson-editor .ace_marker-layer .ace_stack {\
background: rgb(164, 229, 101);\
}\
\
.ace-crimson-editor .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgb(192, 192, 192);\
}\
\
.ace-crimson-editor .ace_marker-layer .ace_active_line {\
background: rgb(232, 242, 254);\
}\
\
.ace-crimson-editor .ace_meta.ace_tag {\
color:rgb(28, 2, 255);\
}\
\
.ace-crimson-editor .ace_marker-layer .ace_selected_word {\
background: rgb(250, 250, 255);\
border: 1px solid rgb(200, 200, 250);\
}\
\
.ace-crimson-editor .ace_string.ace_regex {\
color: rgb(192, 0, 192);\
}";
exports.cssText = require('ace/requirejs/text!./crimson_editor.css');
exports.cssClass = "ace-crimson-editor";

150
lib/ace/theme/dawn.css Normal file
View file

@ -0,0 +1,150 @@
.ace-dawn .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-dawn .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-dawn .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-dawn .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-dawn .ace_scroller {
background-color: #F9F9F9;
}
.ace-dawn .ace_text-layer {
cursor: text;
color: #080808;
}
.ace-dawn .ace_cursor {
border-left: 2px solid #000000;
}
.ace-dawn .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #000000;
}
.ace-dawn .ace_marker-layer .ace_selection {
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 {
background: rgb(255, 255, 0);
}
.ace-dawn .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgba(75, 75, 126, 0.50);
}
.ace-dawn .ace_marker-layer .ace_active_line {
background: rgba(36, 99, 180, 0.12);
}
.ace-dawn .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-dawn .ace_marker-layer .ace_selected_word {
border: 1px solid rgba(39, 95, 255, 0.30);
}
.ace-dawn .ace_invisible {
color: rgba(75, 75, 126, 0.50);
}
.ace-dawn .ace_keyword, .ace-dawn .ace_meta {
color:#794938;
}
.ace-dawn .ace_constant, .ace-dawn .ace_constant.ace_other {
color:#811F24;
}
.ace-dawn .ace_constant.ace_character, {
color:#811F24;
}
.ace-dawn .ace_constant.ace_character.ace_escape, {
color:#811F24;
}
.ace-dawn .ace_invalid.ace_illegal {
text-decoration:underline;
font-style:italic;
color:#F8F8F8;
background-color:#B52A1D;
}
.ace-dawn .ace_invalid.ace_deprecated {
text-decoration:underline;
font-style:italic;
color:#B52A1D;
}
.ace-dawn .ace_support {
color:#691C97;
}
.ace-dawn .ace_support.ace_constant {
color:#B4371F;
}
.ace-dawn .ace_fold {
background-color: #794938;
border-color: #080808;
}
.ace-dawn .ace_support.ace_function {
color:#693A17;
}
.ace-dawn .ace_storage {
font-style:italic;
color:#A71D5D;
}
.ace-dawn .ace_string {
color:#0B6125;
}
.ace-dawn .ace_string.ace_regexp {
color:#CF5628;
}
.ace-dawn .ace_comment {
font-style:italic;
color:#5A525F;
}
.ace-dawn .ace_variable {
color:#234A97;
}
.ace-dawn .ace_markup.ace_underline {
text-decoration:underline;
}
.ace-dawn .ace_markup.ace_heading {
color:#19356D;
}
.ace-dawn .ace_markup.ace_list {
color:#693A17;
}

View file

@ -39,152 +39,7 @@ define(function(require, exports, module) {
exports.isDark = false;
exports.cssClass = "ace-dawn";
exports.cssText = "\
.ace-dawn .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-dawn .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-dawn .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-dawn .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-dawn .ace_scroller {\
background-color: #F9F9F9;\
}\
\
.ace-dawn .ace_text-layer {\
cursor: text;\
color: #080808;\
}\
\
.ace-dawn .ace_cursor {\
border-left: 2px solid #000000;\
}\
\
.ace-dawn .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #000000;\
}\
\
.ace-dawn .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-dawn .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgba(75, 75, 126, 0.50);\
}\
\
.ace-dawn .ace_marker-layer .ace_active_line {\
background: rgba(36, 99, 180, 0.12);\
}\
\
.ace-dawn .ace_marker-layer .ace_selected_word {\
border: 1px solid rgba(39, 95, 255, 0.30);\
}\
\
.ace-dawn .ace_invisible {\
color: rgba(75, 75, 126, 0.50);\
}\
\
.ace-dawn .ace_keyword, .ace-dawn .ace_meta {\
color:#794938;\
}\
\
.ace-dawn .ace_constant, .ace-dawn .ace_constant.ace_other {\
color:#811F24;\
}\
\
.ace-dawn .ace_constant.ace_character, {\
color:#811F24;\
}\
\
.ace-dawn .ace_constant.ace_character.ace_escape, {\
color:#811F24;\
}\
\
.ace-dawn .ace_invalid.ace_illegal {\
text-decoration:underline;\
font-style:italic;\
color:#F8F8F8;\
background-color:#B52A1D;\
}\
\
.ace-dawn .ace_invalid.ace_deprecated {\
text-decoration:underline;\
font-style:italic;\
color:#B52A1D;\
}\
\
.ace-dawn .ace_support {\
color:#691C97;\
}\
\
.ace-dawn .ace_support.ace_constant {\
color:#B4371F;\
}\
\
.ace-dawn .ace_fold {\
background-color: #794938;\
border-color: #080808;\
}\
\
.ace-dawn .ace_support.ace_function {\
color:#693A17;\
}\
\
.ace-dawn .ace_storage {\
font-style:italic;\
color:#A71D5D;\
}\
\
.ace-dawn .ace_string {\
color:#0B6125;\
}\
\
.ace-dawn .ace_string.ace_regexp {\
color:#CF5628;\
}\
\
.ace-dawn .ace_comment {\
font-style:italic;\
color:#5A525F;\
}\
\
.ace-dawn .ace_variable {\
color:#234A97;\
}\
\
.ace-dawn .ace_markup.ace_underline {\
text-decoration:underline;\
}\
\
.ace-dawn .ace_markup.ace_heading {\
color:#19356D;\
}\
\
.ace-dawn .ace_markup.ace_list {\
color:#693A17;\
}";
exports.cssText = require('ace/requirejs/text!./dawn.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

View file

@ -0,0 +1,183 @@
.ace-dreamweaver .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-dreamweaver .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-dreamweaver .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-dreamweaver .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-dreamweaver .ace_fold {
background-color: #00F;
}
.ace-dreamweaver .ace_text-layer {
cursor: text;
}
.ace-dreamweaver .ace_cursor {
border-left: 2px solid black;
}
.ace-dreamweaver .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid black;
}
.ace-dreamweaver .ace_line .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-dreamweaver .ace_line .ace_storage,
.ace-dreamweaver .ace_line .ace_keyword {
color: blue;
}
.ace-dreamweaver .ace_line .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-dreamweaver .ace_line .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-dreamweaver .ace_line .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-dreamweaver .ace_line .ace_invalid {
background-color: rgb(153, 0, 0);
color: white;
}
.ace-dreamweaver .ace_line .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-dreamweaver .ace_line .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-dreamweaver .ace_line .ace_support.ace_type,
.ace-dreamweaver .ace_line .ace_support.ace_class {
color: #009;
}
.ace-dreamweaver .ace_line .ace_support.ace_php_tag {
color: #f00;
}
.ace-dreamweaver .ace_line .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-dreamweaver .ace_line .ace_string {
color: #00F;
}
.ace-dreamweaver .ace_line .ace_comment {
color: rgb(76, 136, 107);
}
.ace-dreamweaver .ace_line .ace_comment.ace_doc {
color: rgb(0, 102, 255);
}
.ace-dreamweaver .ace_line .ace_comment.ace_doc.ace_tag {
color: rgb(128, 159, 191);
}
.ace-dreamweaver .ace_line .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-dreamweaver .ace_line .ace_variable {
color: #06F
}
.ace-dreamweaver .ace_line .ace_xml_pe {
color: rgb(104, 104, 91);
}
.ace-dreamweaver .ace_entity.ace_name.ace_function {
color: #00F;
}
.ace-dreamweaver .ace_markup.ace_markupine {
text-decoration:underline;
}
.ace-dreamweaver .ace_markup.ace_heading {
color: rgb(12, 7, 255);
}
.ace-dreamweaver .ace_markup.ace_list {
color:rgb(185, 6, 144);
}
.ace-dreamweaver .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-dreamweaver .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
}
.ace-dreamweaver .ace_marker-layer .ace_stack {
background: rgb(164, 229, 101);
}
.ace-dreamweaver .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-dreamweaver .ace_marker-layer .ace_active_line {
background: rgba(0, 0, 0, 0.07);
}
.ace-dreamweaver .ace_marker-layer .ace_selected_word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-dreamweaver .ace_meta.ace_tag {
color:#009;
}
.ace-dreamweaver .ace_meta.ace_tag.ace_anchor {
color:#060;
}
.ace-dreamweaver .ace_meta.ace_tag.ace_form {
color:#F90;
}
.ace-dreamweaver .ace_meta.ace_tag.ace_image {
color:#909;
}
.ace-dreamweaver .ace_meta.ace_tag.ace_script {
color:#900;
}
.ace-dreamweaver .ace_meta.ace_tag.ace_style {
color:#909;
}
.ace-dreamweaver .ace_meta.ace_tag.ace_table {
color:#099;
}
.ace-dreamweaver .ace_string.ace_regex {
color: rgb(255, 0, 0)
}

View file

@ -38,189 +38,7 @@
define(function(require, exports, module) {
exports.isDark = false;
exports.cssClass = "ace-dreamweaver";
exports.cssText = ".ace-dreamweaver .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-dreamweaver .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-dreamweaver .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-dreamweaver .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-dreamweaver .ace_fold {\
background-color: #00F;\
}\
\
.ace-dreamweaver .ace_text-layer {\
cursor: text;\
}\
\
.ace-dreamweaver .ace_cursor {\
border-left: 2px solid black;\
}\
\
.ace-dreamweaver .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid black;\
}\
\
.ace-dreamweaver .ace_line .ace_invisible {\
color: rgb(191, 191, 191);\
}\
\
.ace-dreamweaver .ace_line .ace_storage,\
.ace-dreamweaver .ace_line .ace_keyword {\
color: blue;\
}\
\
.ace-dreamweaver .ace_line .ace_constant.ace_buildin {\
color: rgb(88, 72, 246);\
}\
\
.ace-dreamweaver .ace_line .ace_constant.ace_language {\
color: rgb(88, 92, 246);\
}\
\
.ace-dreamweaver .ace_line .ace_constant.ace_library {\
color: rgb(6, 150, 14);\
}\
\
.ace-dreamweaver .ace_line .ace_invalid {\
background-color: rgb(153, 0, 0);\
color: white;\
}\
\
.ace-dreamweaver .ace_line .ace_support.ace_function {\
color: rgb(60, 76, 114);\
}\
\
.ace-dreamweaver .ace_line .ace_support.ace_constant {\
color: rgb(6, 150, 14);\
}\
\
.ace-dreamweaver .ace_line .ace_support.ace_type,\
.ace-dreamweaver .ace_line .ace_support.ace_class {\
color: #009;\
}\
\
.ace-dreamweaver .ace_line .ace_support.ace_php_tag {\
color: #f00;\
}\
\
.ace-dreamweaver .ace_line .ace_keyword.ace_operator {\
color: rgb(104, 118, 135);\
}\
\
.ace-dreamweaver .ace_line .ace_string {\
color: #00F;\
}\
\
.ace-dreamweaver .ace_line .ace_comment {\
color: rgb(76, 136, 107);\
}\
\
.ace-dreamweaver .ace_line .ace_comment.ace_doc {\
color: rgb(0, 102, 255);\
}\
\
.ace-dreamweaver .ace_line .ace_comment.ace_doc.ace_tag {\
color: rgb(128, 159, 191);\
}\
\
.ace-dreamweaver .ace_line .ace_constant.ace_numeric {\
color: rgb(0, 0, 205);\
}\
\
.ace-dreamweaver .ace_line .ace_variable {\
color: #06F\
}\
\
.ace-dreamweaver .ace_line .ace_xml_pe {\
color: rgb(104, 104, 91);\
}\
\
.ace-dreamweaver .ace_entity.ace_name.ace_function {\
color: #00F;\
}\
\
.ace-dreamweaver .ace_markup.ace_markupine {\
text-decoration:underline;\
}\
\
.ace-dreamweaver .ace_markup.ace_heading {\
color: rgb(12, 7, 255);\
}\
\
.ace-dreamweaver .ace_markup.ace_list {\
color:rgb(185, 6, 144);\
}\
\
.ace-dreamweaver .ace_marker-layer .ace_selection {\
background: rgb(181, 213, 255);\
}\
\
.ace-dreamweaver .ace_marker-layer .ace_step {\
background: rgb(252, 255, 0);\
}\
\
.ace-dreamweaver .ace_marker-layer .ace_stack {\
background: rgb(164, 229, 101);\
}\
\
.ace-dreamweaver .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgb(192, 192, 192);\
}\
\
.ace-dreamweaver .ace_marker-layer .ace_active_line {\
background: rgba(0, 0, 0, 0.07);\
}\
\
.ace-dreamweaver .ace_marker-layer .ace_selected_word {\
background: rgb(250, 250, 255);\
border: 1px solid rgb(200, 200, 250);\
}\
\
.ace-dreamweaver .ace_meta.ace_tag {\
color:#009;\
}\
\
.ace-dreamweaver .ace_meta.ace_tag.ace_anchor {\
color:#060;\
}\
\
.ace-dreamweaver .ace_meta.ace_tag.ace_form {\
color:#F90;\
}\
\
.ace-dreamweaver .ace_meta.ace_tag.ace_image {\
color:#909;\
}\
\
.ace-dreamweaver .ace_meta.ace_tag.ace_script {\
color:#900;\
}\
\
.ace-dreamweaver .ace_meta.ace_tag.ace_style {\
color:#909;\
}\
\
.ace-dreamweaver .ace_meta.ace_tag.ace_table {\
color:#099;\
}\
\
.ace-dreamweaver .ace_string.ace_regex {\
color: rgb(255, 0, 0)\
}";
exports.cssText = require('ace/requirejs/text!./dreamweaver.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

103
lib/ace/theme/eclipse.css Normal file
View file

@ -0,0 +1,103 @@
.ace-eclipse .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-eclipse .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-eclipse .ace_gutter {
background: rgb(227, 227, 227);
border-right: 1px solid rgb(159, 159, 159);
color: rgb(136, 136, 136);
}
.ace-eclipse .ace_print_margin {
width: 1px;
background: #b1b4ba;
}
.ace-eclipse .ace_fold {
background-color: rgb(60, 76, 114);
}
.ace-eclipse .ace_text-layer {
cursor: text;
}
.ace-eclipse .ace_cursor {
border-left: 2px solid black;
}
.ace-eclipse .ace_line .ace_storage,
.ace-eclipse .ace_line .ace_keyword,
.ace-eclipse .ace_line .ace_variable {
color: rgb(127, 0, 85);
}
.ace-eclipse .ace_line .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-eclipse .ace_line .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-eclipse .ace_line .ace_function {
color: rgb(60, 76, 114);
}
.ace-eclipse .ace_line .ace_string {
color: rgb(42, 0, 255);
}
.ace-eclipse .ace_line .ace_comment {
color: rgb(63, 127, 95);
}
.ace-eclipse .ace_line .ace_comment.ace_doc {
color: rgb(63, 95, 191);
}
.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {
color: rgb(127, 159, 191);
}
.ace-eclipse .ace_line .ace_constant.ace_numeric {
}
.ace-eclipse .ace_line .ace_tag {
color: rgb(63, 127, 127);
}
.ace-eclipse .ace_line .ace_type {
color: rgb(127, 0, 127);
}
.ace-eclipse .ace_line .ace_xml_pe {
color: rgb(104, 104, 91);
}
.ace-eclipse .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-eclipse .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-eclipse .ace_line .ace_meta.ace_tag {
color:rgb(63, 127, 127);
}
.ace-eclipse .ace_entity.ace_other.ace_attribute-name {
color:rgb(127, 0, 127);
}
.ace-eclipse .ace_marker-layer .ace_step {
background: rgb(255, 255, 0);
}
.ace-eclipse .ace_marker-layer .ace_active_line {
background: rgb(232, 242, 254);
}

View file

@ -39,106 +39,7 @@ define(function(require, exports, module) {
"use strict";
exports.isDark = false;
exports.cssText = ".ace-eclipse .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-eclipse .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-eclipse .ace_gutter {\
background: rgb(227, 227, 227);\
border-right: 1px solid rgb(159, 159, 159);\
color: rgb(136, 136, 136);\
}\
\
.ace-eclipse .ace_print_margin {\
width: 1px;\
background: #b1b4ba;\
}\
\
.ace-eclipse .ace_fold {\
background-color: rgb(60, 76, 114);\
}\
\
.ace-eclipse .ace_text-layer {\
cursor: text;\
}\
\
.ace-eclipse .ace_cursor {\
border-left: 2px solid black;\
}\
\
.ace-eclipse .ace_line .ace_storage,\
.ace-eclipse .ace_line .ace_keyword,\
.ace-eclipse .ace_line .ace_variable {\
color: rgb(127, 0, 85);\
}\
\
.ace-eclipse .ace_line .ace_constant.ace_buildin {\
color: rgb(88, 72, 246);\
}\
\
.ace-eclipse .ace_line .ace_constant.ace_library {\
color: rgb(6, 150, 14);\
}\
\
.ace-eclipse .ace_line .ace_function {\
color: rgb(60, 76, 114);\
}\
\
.ace-eclipse .ace_line .ace_string {\
color: rgb(42, 0, 255);\
}\
\
.ace-eclipse .ace_line .ace_comment {\
color: rgb(63, 127, 95);\
}\
\
.ace-eclipse .ace_line .ace_comment.ace_doc {\
color: rgb(63, 95, 191);\
}\
\
.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\
color: rgb(127, 159, 191);\
}\
\
.ace-eclipse .ace_line .ace_constant.ace_numeric {\
}\
\
.ace-eclipse .ace_line .ace_tag {\
color: rgb(63, 127, 127);\
}\
\
.ace-eclipse .ace_line .ace_type {\
color: rgb(127, 0, 127);\
}\
\
.ace-eclipse .ace_line .ace_xml_pe {\
color: rgb(104, 104, 91);\
}\
\
.ace-eclipse .ace_marker-layer .ace_selection {\
background: rgb(181, 213, 255);\
}\
\
.ace-eclipse .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgb(192, 192, 192);\
}\
\
.ace-eclipse .ace_line .ace_meta.ace_tag {\
color:rgb(63, 127, 127);\
}\
\
.ace-eclipse .ace_entity.ace_other.ace_attribute-name {\
color:rgb(127, 0, 127);\
}\
\
.ace-eclipse .ace_marker-layer .ace_active_line {\
background: rgb(232, 242, 254);\
}";
exports.cssText = require('ace/requirejs/text!./eclipse.css');
exports.cssClass = "ace-eclipse";

View file

@ -0,0 +1,138 @@
.ace-idle-fingers .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-idle-fingers .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-idle-fingers .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-idle-fingers .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-idle-fingers .ace_scroller {
background-color: #323232;
}
.ace-idle-fingers .ace_text-layer {
cursor: text;
color: #FFFFFF;
}
.ace-idle-fingers .ace_cursor {
border-left: 2px solid #91FF00;
}
.ace-idle-fingers .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #91FF00;
}
.ace-idle-fingers .ace_marker-layer .ace_selection {
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 {
background: rgb(102, 82, 0);
}
.ace-idle-fingers .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #404040;
}
.ace-idle-fingers .ace_marker-layer .ace_active_line {
background: #353637;
}
.ace-idle-fingers .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-idle-fingers .ace_marker-layer .ace_selected_word {
border: 1px solid rgba(90, 100, 126, 0.88);
}
.ace-idle-fingers .ace_invisible {
color: #404040;
}
.ace-idle-fingers .ace_keyword, .ace-idle-fingers .ace_meta {
color:#CC7833;
}
.ace-idle-fingers .ace_constant, .ace-idle-fingers .ace_constant.ace_other {
color:#6C99BB;
}
.ace-idle-fingers .ace_constant.ace_character, {
color:#6C99BB;
}
.ace-idle-fingers .ace_constant.ace_character.ace_escape, {
color:#6C99BB;
}
.ace-idle-fingers .ace_invalid {
color:#FFFFFF;
background-color:#FF0000;
}
.ace-idle-fingers .ace_support.ace_constant {
color:#6C99BB;
}
.ace-idle-fingers .ace_fold {
background-color: #CC7833;
border-color: #FFFFFF;
}
.ace-idle-fingers .ace_support.ace_function {
color:#B83426;
}
.ace-idle-fingers .ace_variable.ace_parameter {
font-style:italic;
}
.ace-idle-fingers .ace_string {
color:#A5C261;
}
.ace-idle-fingers .ace_string.ace_regexp {
color:#CCCC33;
}
.ace-idle-fingers .ace_comment {
font-style:italic;
color:#BC9458;
}
.ace-idle-fingers .ace_meta.ace_tag {
color:#FFE5BB;
}
.ace-idle-fingers .ace_entity.ace_name {
color:#FFC66D;
}
.ace-idle-fingers .ace_markup.ace_underline {
text-decoration:underline;
}
.ace-idle-fingers .ace_collab.ace_user1 {
color:#323232;
background-color:#FFF980;
}

View file

@ -39,140 +39,7 @@ define(function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-idle-fingers";
exports.cssText = "\
.ace-idle-fingers .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-idle-fingers .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-idle-fingers .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-idle-fingers .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-idle-fingers .ace_scroller {\
background-color: #323232;\
}\
\
.ace-idle-fingers .ace_text-layer {\
cursor: text;\
color: #FFFFFF;\
}\
\
.ace-idle-fingers .ace_cursor {\
border-left: 2px solid #91FF00;\
}\
\
.ace-idle-fingers .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #91FF00;\
}\
\
.ace-idle-fingers .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-idle-fingers .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #404040;\
}\
\
.ace-idle-fingers .ace_marker-layer .ace_active_line {\
background: #353637;\
}\
\
.ace-idle-fingers .ace_marker-layer .ace_selected_word {\
border: 1px solid rgba(90, 100, 126, 0.88);\
}\
\
.ace-idle-fingers .ace_invisible {\
color: #404040;\
}\
\
.ace-idle-fingers .ace_keyword, .ace-idle-fingers .ace_meta {\
color:#CC7833;\
}\
\
.ace-idle-fingers .ace_constant, .ace-idle-fingers .ace_constant.ace_other {\
color:#6C99BB;\
}\
\
.ace-idle-fingers .ace_constant.ace_character, {\
color:#6C99BB;\
}\
\
.ace-idle-fingers .ace_constant.ace_character.ace_escape, {\
color:#6C99BB;\
}\
\
.ace-idle-fingers .ace_invalid {\
color:#FFFFFF;\
background-color:#FF0000;\
}\
\
.ace-idle-fingers .ace_support.ace_constant {\
color:#6C99BB;\
}\
\
.ace-idle-fingers .ace_fold {\
background-color: #CC7833;\
border-color: #FFFFFF;\
}\
\
.ace-idle-fingers .ace_support.ace_function {\
color:#B83426;\
}\
\
.ace-idle-fingers .ace_variable.ace_parameter {\
font-style:italic;\
}\
\
.ace-idle-fingers .ace_string {\
color:#A5C261;\
}\
\
.ace-idle-fingers .ace_string.ace_regexp {\
color:#CCCC33;\
}\
\
.ace-idle-fingers .ace_comment {\
font-style:italic;\
color:#BC9458;\
}\
\
.ace-idle-fingers .ace_meta.ace_tag {\
color:#FFE5BB;\
}\
\
.ace-idle-fingers .ace_entity.ace_name {\
color:#FFC66D;\
}\
\
.ace-idle-fingers .ace_markup.ace_underline {\
text-decoration:underline;\
}\
\
.ace-idle-fingers .ace_collab.ace_user1 {\
color:#323232;\
background-color:#FFF980;\
}";
exports.cssText = require('ace/requirejs/text!./idle_fingers.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

141
lib/ace/theme/kr_theme.css Normal file
View file

@ -0,0 +1,141 @@
.ace-kr-theme .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-kr-theme .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-kr-theme .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-kr-theme .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-kr-theme .ace_scroller {
background-color: #0B0A09;
}
.ace-kr-theme .ace_text-layer {
cursor: text;
color: #FCFFE0;
}
.ace-kr-theme .ace_cursor {
border-left: 2px solid #FF9900;
}
.ace-kr-theme .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #FF9900;
}
.ace-kr-theme .ace_marker-layer .ace_selection {
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 {
background: rgb(102, 82, 0);
}
.ace-kr-theme .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgba(255, 177, 111, 0.32);
}
.ace-kr-theme .ace_marker-layer .ace_active_line {
background: #38403D;
}
.ace-kr-theme .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-kr-theme .ace_marker-layer .ace_selected_word {
border: 1px solid rgba(170, 0, 255, 0.45);
}
.ace-kr-theme .ace_invisible {
color: rgba(255, 177, 111, 0.32);
}
.ace-kr-theme .ace_keyword, .ace-kr-theme .ace_meta {
color:#949C8B;
}
.ace-kr-theme .ace_constant, .ace-kr-theme .ace_constant.ace_other {
color:rgba(210, 117, 24, 0.76);
}
.ace-kr-theme .ace_constant.ace_character, {
color:rgba(210, 117, 24, 0.76);
}
.ace-kr-theme .ace_constant.ace_character.ace_escape, {
color:rgba(210, 117, 24, 0.76);
}
.ace-kr-theme .ace_invalid {
color:#F8F8F8;
background-color:#A41300;
}
.ace-kr-theme .ace_support {
color:#9FC28A;
}
.ace-kr-theme .ace_support.ace_constant {
color:#C27E66;
}
.ace-kr-theme .ace_fold {
background-color: #949C8B;
border-color: #FCFFE0;
}
.ace-kr-theme .ace_support.ace_function {
color:#85873A;
}
.ace-kr-theme .ace_storage {
color:#FFEE80;
}
.ace-kr-theme .ace_string.ace_regexp {
color:rgba(125, 255, 192, 0.65);
}
.ace-kr-theme .ace_comment {
font-style:italic;
color:#706D5B;
}
.ace-kr-theme .ace_variable {
color:#D1A796;
}
.ace-kr-theme .ace_variable.ace_language {
color:#FF80E1;
}
.ace-kr-theme .ace_meta.ace_tag {
color:#BABD9C;
}
.ace-kr-theme .ace_markup.ace_underline {
text-decoration:underline;
}
.ace-kr-theme .ace_markup.ace_list {
background-color:#0F0040;
}

View file

@ -39,143 +39,7 @@ define(function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-kr-theme";
exports.cssText = "\
.ace-kr-theme .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-kr-theme .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-kr-theme .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-kr-theme .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-kr-theme .ace_scroller {\
background-color: #0B0A09;\
}\
\
.ace-kr-theme .ace_text-layer {\
cursor: text;\
color: #FCFFE0;\
}\
\
.ace-kr-theme .ace_cursor {\
border-left: 2px solid #FF9900;\
}\
\
.ace-kr-theme .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #FF9900;\
}\
\
.ace-kr-theme .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-kr-theme .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid rgba(255, 177, 111, 0.32);\
}\
\
.ace-kr-theme .ace_marker-layer .ace_active_line {\
background: #38403D;\
}\
\
.ace-kr-theme .ace_marker-layer .ace_selected_word {\
border: 1px solid rgba(170, 0, 255, 0.45);\
}\
\
.ace-kr-theme .ace_invisible {\
color: rgba(255, 177, 111, 0.32);\
}\
\
.ace-kr-theme .ace_keyword, .ace-kr-theme .ace_meta {\
color:#949C8B;\
}\
\
.ace-kr-theme .ace_constant, .ace-kr-theme .ace_constant.ace_other {\
color:rgba(210, 117, 24, 0.76);\
}\
\
.ace-kr-theme .ace_constant.ace_character, {\
color:rgba(210, 117, 24, 0.76);\
}\
\
.ace-kr-theme .ace_constant.ace_character.ace_escape, {\
color:rgba(210, 117, 24, 0.76);\
}\
\
.ace-kr-theme .ace_invalid {\
color:#F8F8F8;\
background-color:#A41300;\
}\
\
.ace-kr-theme .ace_support {\
color:#9FC28A;\
}\
\
.ace-kr-theme .ace_support.ace_constant {\
color:#C27E66;\
}\
\
.ace-kr-theme .ace_fold {\
background-color: #949C8B;\
border-color: #FCFFE0;\
}\
\
.ace-kr-theme .ace_support.ace_function {\
color:#85873A;\
}\
\
.ace-kr-theme .ace_storage {\
color:#FFEE80;\
}\
\
.ace-kr-theme .ace_string.ace_regexp {\
color:rgba(125, 255, 192, 0.65);\
}\
\
.ace-kr-theme .ace_comment {\
font-style:italic;\
color:#706D5B;\
}\
\
.ace-kr-theme .ace_variable {\
color:#D1A796;\
}\
\
.ace-kr-theme .ace_variable.ace_language {\
color:#FF80E1;\
}\
\
.ace-kr-theme .ace_meta.ace_tag {\
color:#BABD9C;\
}\
\
.ace-kr-theme .ace_markup.ace_underline {\
text-decoration:underline;\
}\
\
.ace-kr-theme .ace_markup.ace_list {\
background-color:#0F0040;\
}";
exports.cssText = require('ace/requirejs/text!./kr_theme.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

141
lib/ace/theme/merbivore.css Normal file
View file

@ -0,0 +1,141 @@
.ace-merbivore .ace_editor {
border: 2px solid rgb(159, 159, 159);
}
.ace-merbivore .ace_editor.ace_focus {
border: 2px solid #327fbd;
}
.ace-merbivore .ace_gutter {
background: #e8e8e8;
color: #333;
}
.ace-merbivore .ace_print_margin {
width: 1px;
background: #e8e8e8;
}
.ace-merbivore .ace_scroller {
background-color: #161616;
}
.ace-merbivore .ace_text-layer {
cursor: text;
color: #E6E1DC;
}
.ace-merbivore .ace_cursor {
border-left: 2px solid #FFFFFF;
}
.ace-merbivore .ace_cursor.ace_overwrite {
border-left: 0px;
border-bottom: 1px solid #FFFFFF;
}
.ace-merbivore .ace_marker-layer .ace_selection {
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 {
background: rgb(102, 82, 0);
}
.ace-merbivore .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #404040;
}
.ace-merbivore .ace_marker-layer .ace_active_line {
background: #333435;
}
.ace-merbivore .ace_gutter_active_line {
background-color : #dcdcdc;
}
.ace-merbivore .ace_marker-layer .ace_selected_word {
border: 1px solid #454545;
}
.ace-merbivore .ace_invisible {
color: #404040;
}
.ace-merbivore .ace_keyword, .ace-merbivore .ace_meta {
color:#FC6F09;
}
.ace-merbivore .ace_constant, .ace-merbivore .ace_constant.ace_other {
color:#1EDAFB;
}
.ace-merbivore .ace_constant.ace_character, {
color:#1EDAFB;
}
.ace-merbivore .ace_constant.ace_character.ace_escape, {
color:#1EDAFB;
}
.ace-merbivore .ace_constant.ace_language {
color:#FDC251;
}
.ace-merbivore .ace_constant.ace_library {
color:#8DFF0A;
}
.ace-merbivore .ace_constant.ace_numeric {
color:#58C554;
}
.ace-merbivore .ace_invalid {
color:#FFFFFF;
background-color:#990000;
}
.ace-merbivore .ace_support.ace_constant {
color:#8DFF0A;
}
.ace-merbivore .ace_fold {
background-color: #FC6F09;
border-color: #E6E1DC;
}
.ace-merbivore .ace_support.ace_function {
color:#FC6F09;
}
.ace-merbivore .ace_storage {
color:#FC6F09;
}
.ace-merbivore .ace_string {
color:#8DFF0A;
}
.ace-merbivore .ace_comment {
font-style:italic;
color:#AD2EA4;
}
.ace-merbivore .ace_meta.ace_tag {
color:#FC6F09;
}
.ace-merbivore .ace_entity.ace_other.ace_attribute-name {
color:#FFFF89;
}
.ace-merbivore .ace_markup.ace_underline {
text-decoration:underline;
}

View file

@ -39,143 +39,7 @@ define(function(require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-merbivore";
exports.cssText = "\
.ace-merbivore .ace_editor {\
border: 2px solid rgb(159, 159, 159);\
}\
\
.ace-merbivore .ace_editor.ace_focus {\
border: 2px solid #327fbd;\
}\
\
.ace-merbivore .ace_gutter {\
background: #e8e8e8;\
color: #333;\
}\
\
.ace-merbivore .ace_print_margin {\
width: 1px;\
background: #e8e8e8;\
}\
\
.ace-merbivore .ace_scroller {\
background-color: #161616;\
}\
\
.ace-merbivore .ace_text-layer {\
cursor: text;\
color: #E6E1DC;\
}\
\
.ace-merbivore .ace_cursor {\
border-left: 2px solid #FFFFFF;\
}\
\
.ace-merbivore .ace_cursor.ace_overwrite {\
border-left: 0px;\
border-bottom: 1px solid #FFFFFF;\
}\
\
.ace-merbivore .ace_marker-layer .ace_selection {\
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 {\
background: rgb(198, 219, 174);\
}\
\
.ace-merbivore .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #404040;\
}\
\
.ace-merbivore .ace_marker-layer .ace_active_line {\
background: #333435;\
}\
\
.ace-merbivore .ace_marker-layer .ace_selected_word {\
border: 1px solid #454545;\
}\
\
.ace-merbivore .ace_invisible {\
color: #404040;\
}\
\
.ace-merbivore .ace_keyword, .ace-merbivore .ace_meta {\
color:#FC6F09;\
}\
\
.ace-merbivore .ace_constant, .ace-merbivore .ace_constant.ace_other {\
color:#1EDAFB;\
}\
\
.ace-merbivore .ace_constant.ace_character, {\
color:#1EDAFB;\
}\
\
.ace-merbivore .ace_constant.ace_character.ace_escape, {\
color:#1EDAFB;\
}\
\
.ace-merbivore .ace_constant.ace_language {\
color:#FDC251;\
}\
\
.ace-merbivore .ace_constant.ace_library {\
color:#8DFF0A;\
}\
\
.ace-merbivore .ace_constant.ace_numeric {\
color:#58C554;\
}\
\
.ace-merbivore .ace_invalid {\
color:#FFFFFF;\
background-color:#990000;\
}\
\
.ace-merbivore .ace_support.ace_constant {\
color:#8DFF0A;\
}\
\
.ace-merbivore .ace_fold {\
background-color: #FC6F09;\
border-color: #E6E1DC;\
}\
\
.ace-merbivore .ace_support.ace_function {\
color:#FC6F09;\
}\
\
.ace-merbivore .ace_storage {\
color:#FC6F09;\
}\
\
.ace-merbivore .ace_string {\
color:#8DFF0A;\
}\
\
.ace-merbivore .ace_comment {\
font-style:italic;\
color:#AD2EA4;\
}\
\
.ace-merbivore .ace_meta.ace_tag {\
color:#FC6F09;\
}\
\
.ace-merbivore .ace_entity.ace_other.ace_attribute-name {\
color:#FFFF89;\
}\
\
.ace-merbivore .ace_markup.ace_underline {\
text-decoration:underline;\
}";
exports.cssText = require('ace/requirejs/text!./merbivore.css');
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);

Some files were not shown because too many files have changed in this diff Show more