mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
update ace
Loading is now visibly more janky, but I think
d3ba5b8111
fixes a lot of our problems.
I tested this on split-panes-2.0 and a major bug (no input
after resizing) is now gone. Poof.
This commit is contained in:
33
vendor/ace/ace.js
vendored
33
vendor/ace/ace.js
vendored
@@ -37,18 +37,15 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
require("pilot/index");
|
||||
require("pilot/fixoldbrowsers");
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins([ "pilot/index" ]);
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
var Dom = require("pilot/dom");
|
||||
var Event = require("pilot/event");
|
||||
var Dom = require("./lib/dom");
|
||||
var Event = require("./lib/event");
|
||||
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
var Editor = require("./editor").Editor;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var UndoManager = require("./undomanager").UndoManager;
|
||||
var Renderer = require("./virtual_renderer").VirtualRenderer;
|
||||
|
||||
exports.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
@@ -62,19 +59,17 @@ define(function(require, exports, module) {
|
||||
var editor = new Editor(new Renderer(el, require("ace/theme/textmate")));
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = require("pilot/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
env.document = doc;
|
||||
env.editor = editor;
|
||||
var env = {};
|
||||
env.document = doc;
|
||||
env.editor = editor;
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
});
|
||||
el.env = env;
|
||||
});
|
||||
el.env = env;
|
||||
// Store env on editor such that it can be accessed later on from
|
||||
// the returned object.
|
||||
editor.env = env;
|
||||
return editor;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
4
vendor/ace/anchor.js
vendored
4
vendor/ace/anchor.js
vendored
@@ -37,8 +37,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var oop = require("./lib/oop");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* An Anchor is a floating pointer in the document. Whenever text is inserted or
|
||||
|
||||
10
vendor/ace/anchor_test.js
vendored
10
vendor/ace/anchor_test.js
vendored
@@ -36,15 +36,15 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Document = require("ace/document").Document;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
var Range = require("ace/range").Range;
|
||||
var assert = require("ace/test/assertions");
|
||||
var Document = require("./document").Document;
|
||||
var Anchor = require("./anchor").Anchor;
|
||||
var Range = require("./range").Range;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
4
vendor/ace/background_tokenizer.js
vendored
4
vendor/ace/background_tokenizer.js
vendored
@@ -37,8 +37,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var oop = require("./lib/oop");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
this.running = false;
|
||||
|
||||
194
vendor/ace/commands/command_manager.js
vendored
Normal file
194
vendor/ace/commands/command_manager.js
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var keyUtil = require("../lib/keys");
|
||||
|
||||
var CommandManager = function(platform, commands) {
|
||||
if (typeof platform !== "string")
|
||||
throw new TypeError("'platform' argument must be either 'mac' or 'win'");
|
||||
|
||||
this.platform = platform;
|
||||
this.commands = {};
|
||||
this.commmandKeyBinding = {};
|
||||
|
||||
if (commands)
|
||||
commands.forEach(this.addCommand, this);
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.addCommand = function(command) {
|
||||
if (this.commands[command.name])
|
||||
this.removeCommand(command);
|
||||
|
||||
this.commands[command.name] = command;
|
||||
|
||||
if (command.bindKey) {
|
||||
this._buildKeyHash(command);
|
||||
}
|
||||
};
|
||||
|
||||
this.removeCommand = function(command) {
|
||||
var name = (typeof command === 'string' ? command : command.name);
|
||||
command = this.commands[name];
|
||||
delete this.commands[name];
|
||||
|
||||
// exaustive search is brute force but since removeCommand is
|
||||
// not a performance critical operation this should be OK
|
||||
var ckb = this.commmandKeyBinding;
|
||||
for (var hashId in ckb) {
|
||||
for (var key in ckb[hashId]) {
|
||||
if (ckb[hashId][key] == command)
|
||||
delete ckb[hashId][key];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.addCommands = function(commands) {
|
||||
Object.keys(commands).forEach(function(name) {
|
||||
var command = commands[name];
|
||||
if (typeof command === "string")
|
||||
return this.bindKey(command, name);
|
||||
|
||||
if (typeof command === "function")
|
||||
command = { exec: command };
|
||||
|
||||
if (!command.name)
|
||||
command.name = name;
|
||||
|
||||
this.addCommand(command);
|
||||
}, this);
|
||||
};
|
||||
|
||||
this.removeCommands = function(commands) {
|
||||
Object.keys(commands).forEach(function(name) {
|
||||
this.removeCommand(commands[name]);
|
||||
}, this);
|
||||
};
|
||||
|
||||
this.bindKey = function(key, command) {
|
||||
if(!key)
|
||||
return;
|
||||
|
||||
var ckb = this.commmandKeyBinding;
|
||||
key.split("|").forEach(function(keyPart) {
|
||||
var binding = parseKeys(keyPart, command);
|
||||
var hashId = binding.hashId;
|
||||
(ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
|
||||
});
|
||||
};
|
||||
|
||||
this.bindKeys = function(keyList) {
|
||||
Object.keys(keyList).forEach(function(key) {
|
||||
this.bindKey(key, keyList[key]);
|
||||
}, this);
|
||||
};
|
||||
|
||||
this._buildKeyHash = function(command) {
|
||||
var binding = command.bindKey;
|
||||
if (!binding)
|
||||
return;
|
||||
|
||||
var key = typeof binding == "string" ? binding: binding[this.platform];
|
||||
this.bindKey(key, command);
|
||||
}
|
||||
|
||||
function parseKeys(keys, val, ret) {
|
||||
var key;
|
||||
var hashId = 0;
|
||||
var parts = splitSafe(keys);
|
||||
|
||||
for (var i=0, l = parts.length; i < l; i++) {
|
||||
if (keyUtil.KEY_MODS[parts[i]])
|
||||
hashId = hashId | keyUtil.KEY_MODS[parts[i]];
|
||||
else
|
||||
key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
|
||||
}
|
||||
|
||||
return {
|
||||
key: key,
|
||||
hashId: hashId
|
||||
}
|
||||
}
|
||||
|
||||
function splitSafe(s, separator) {
|
||||
return (s.toLowerCase()
|
||||
.trim()
|
||||
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
|
||||
}
|
||||
|
||||
this.findKeyCommand = function findKeyCommand(hashId, textOrKey) {
|
||||
// Convert keyCode to the string representation.
|
||||
if (typeof textOrKey == "number") {
|
||||
textOrKey = keyUtil.keyCodeToString(textOrKey);
|
||||
}
|
||||
|
||||
var ckbr = this.commmandKeyBinding;
|
||||
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
|
||||
}
|
||||
|
||||
this.exec = function(command, editor, args) {
|
||||
if (typeof command === 'string')
|
||||
command = this.commands[command];
|
||||
|
||||
if (!command)
|
||||
return false;
|
||||
|
||||
if (editor && editor.$readOnly && !command.readOnly)
|
||||
return false;
|
||||
|
||||
command.exec(editor, args || {});
|
||||
return true;
|
||||
};
|
||||
|
||||
this.toggleRecording = function() {
|
||||
if (this.$inReplay)
|
||||
return;
|
||||
if (this.recording) {
|
||||
this.macro.pop();
|
||||
this.exec = this.normal_exec;
|
||||
return this.recording = false;
|
||||
}
|
||||
this.macro = [];
|
||||
this.normal_exec = this.exec;
|
||||
this.exec = function(command, editor, args) {
|
||||
this.macro.push([command, args]);
|
||||
return this.normal_exec(command, editor, args);
|
||||
};
|
||||
return this.recording = true;
|
||||
};
|
||||
|
||||
this.replay = function(editor) {
|
||||
if (this.$inReplay)
|
||||
return;
|
||||
|
||||
if (!this.macro || this.recording)
|
||||
return this.toggleRecording();
|
||||
|
||||
try {
|
||||
this.$inReplay = true;
|
||||
this.macro.forEach(function(x) {
|
||||
if (typeof x == "string")
|
||||
this.exec(x, editor);
|
||||
else
|
||||
this.exec(x[0], editor, x[1]);
|
||||
}, this)
|
||||
} finally {
|
||||
this.$inReplay = false;
|
||||
}
|
||||
};
|
||||
|
||||
this.trimMacro = function(m) {
|
||||
return m.map(function(x){
|
||||
if (typeof x[0] != "string")
|
||||
x[0] = x[0].name;
|
||||
if (!x[1])
|
||||
x = x[0];
|
||||
return x
|
||||
})
|
||||
}
|
||||
|
||||
}).call(CommandManager.prototype);
|
||||
|
||||
exports.CommandManager = CommandManager;
|
||||
|
||||
});
|
||||
192
vendor/ace/commands/command_manager_test.js
vendored
Normal file
192
vendor/ace/commands/command_manager_test.js
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
/* ***** 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 ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var CommandManager = require("./command_manager").CommandManager;
|
||||
var keys = require("../lib/keys");
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
setUp: function() {
|
||||
this.command = {
|
||||
name: "gotoline",
|
||||
bindKey: {
|
||||
mac: "Command-L",
|
||||
win: "Ctrl-L"
|
||||
},
|
||||
called: false,
|
||||
exec: function(editor) { this.called = true; }
|
||||
}
|
||||
|
||||
this.cm = new CommandManager("mac", [this.command]);
|
||||
},
|
||||
|
||||
"test: register command": function() {
|
||||
this.cm.exec("gotoline");
|
||||
assert.ok(this.command.called);
|
||||
},
|
||||
|
||||
"test: mac hotkeys": function() {
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
assert.equal(command, this.command);
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "L");
|
||||
assert.equal(command, undefined);
|
||||
},
|
||||
|
||||
"test: win hotkeys": function() {
|
||||
var cm = new CommandManager("win", [this.command]);
|
||||
|
||||
var command = cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
assert.equal(command, undefined);
|
||||
|
||||
var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "L");
|
||||
assert.equal(command, this.command);
|
||||
},
|
||||
|
||||
"test: remove command by object": function() {
|
||||
this.cm.removeCommand(this.command);
|
||||
|
||||
this.cm.exec("gotoline");
|
||||
assert.ok(!this.command.called);
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
assert.equal(command, null);
|
||||
},
|
||||
|
||||
"test: remove command by name": function() {
|
||||
this.cm.removeCommand("gotoline");
|
||||
|
||||
this.cm.exec("gotoline");
|
||||
assert.ok(!this.command.called);
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L");
|
||||
assert.equal(command, null);
|
||||
},
|
||||
|
||||
"test: adding a new command with the same name as an existing one should remove the old one first": function() {
|
||||
var command = {
|
||||
name: "gotoline",
|
||||
bindKey: {
|
||||
mac: "Command-L",
|
||||
win: "Ctrl-L"
|
||||
},
|
||||
called: false,
|
||||
exec: function(editor) { this.called = true; }
|
||||
}
|
||||
this.cm.addCommand(command);
|
||||
|
||||
this.cm.exec("gotoline");
|
||||
assert.ok(command.called);
|
||||
assert.ok(!this.command.called);
|
||||
|
||||
assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "L"), command);
|
||||
},
|
||||
|
||||
"test: adding commands and recording a macro": function() {
|
||||
var called = "";
|
||||
this.cm.addCommands({
|
||||
togglerecording: function(editor) {
|
||||
editor.cm.toggleRecording()
|
||||
},
|
||||
replay: function(editor) {
|
||||
editor.cm.replay()
|
||||
},
|
||||
cm1: function(editor, arg) {
|
||||
called += "1" + (arg || "")
|
||||
},
|
||||
cm2: function(editor) {
|
||||
called += "2"
|
||||
}
|
||||
});
|
||||
|
||||
this.cm.exec("togglerecording", this);
|
||||
assert.ok(this.cm.recording);
|
||||
|
||||
this.cm.exec("cm1", this, "-");
|
||||
this.cm.exec("cm2");
|
||||
this.cm.exec("replay", this);
|
||||
assert.ok(!this.cm.recording);
|
||||
assert.equal(called, "1-2");
|
||||
|
||||
called = "";
|
||||
this.cm.exec("replay", this);
|
||||
assert.equal(called, "1-2");
|
||||
},
|
||||
|
||||
"test: bindkeys": function() {
|
||||
var called = "";
|
||||
this.cm.addCommands({
|
||||
cm1: function(editor, arg) {
|
||||
called += "1" + (arg || "")
|
||||
},
|
||||
cm2: function(editor) {
|
||||
called += "2"
|
||||
}
|
||||
});
|
||||
|
||||
this.cm.bindKeys({
|
||||
"Ctrl-L|Command-C": "cm1",
|
||||
"Ctrl-R": "cm2",
|
||||
})
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "C");
|
||||
assert.equal(command, "cm1");
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R");
|
||||
assert.equal(command, "cm2");
|
||||
|
||||
this.cm.bindKeys({
|
||||
"Ctrl-R": null
|
||||
})
|
||||
|
||||
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R");
|
||||
assert.equal(command, null);
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec()
|
||||
}
|
||||
546
vendor/ace/commands/default_commands.js
vendored
546
vendor/ace/commands/default_commands.js
vendored
@@ -40,358 +40,346 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var lang = require("pilot/lang");
|
||||
var canon = require("pilot/canon");
|
||||
var lang = require("../lib/lang");
|
||||
|
||||
function bindKey(win, mac) {
|
||||
return {
|
||||
win: win,
|
||||
mac: mac,
|
||||
sender: "editor"
|
||||
mac: mac
|
||||
};
|
||||
}
|
||||
|
||||
canon.addCommand({
|
||||
name: "null",
|
||||
exec: function(env, args, request) { }
|
||||
});
|
||||
|
||||
canon.addCommand({
|
||||
exports.commands = [{
|
||||
name: "selectall",
|
||||
bindKey: bindKey("Ctrl-A", "Command-A"),
|
||||
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removeline",
|
||||
bindKey: bindKey("Ctrl-D", "Command-D"),
|
||||
exec: function(env, args, request) { env.editor.removeLines(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.selectAll(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "centerselection",
|
||||
bindKey: bindKey(null, "Ctrl-L"),
|
||||
exec: function(editor) { editor.centerSelection(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotoline",
|
||||
bindKey: bindKey("Ctrl-L", "Command-L"),
|
||||
exec: function(env, args, request) {
|
||||
exec: function(editor) {
|
||||
var line = parseInt(prompt("Enter line number:"));
|
||||
if (!isNaN(line)) {
|
||||
env.editor.gotoLine(line);
|
||||
editor.gotoLine(line);
|
||||
}
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "togglecomment",
|
||||
bindKey: bindKey("Ctrl-7", "Command-7"),
|
||||
exec: function(env, args, request) { env.editor.toggleCommentLines(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "fold",
|
||||
bindKey: bindKey("Alt-L", "Alt-L"),
|
||||
exec: function(editor) { editor.session.toggleFold(false); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "unfold",
|
||||
bindKey: bindKey("Alt-Shift-L", "Alt-Shift-L"),
|
||||
exec: function(editor) { editor.session.toggleFold(true); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "foldall",
|
||||
bindKey: bindKey("Alt-0", "Alt-0"),
|
||||
exec: function(editor) { editor.session.foldAll(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "unfoldall",
|
||||
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
|
||||
exec: function(editor) { editor.session.unfold(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "findnext",
|
||||
bindKey: bindKey("Ctrl-K", "Command-G"),
|
||||
exec: function(env, args, request) { env.editor.findNext(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.findNext(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "findprevious",
|
||||
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
||||
exec: function(env, args, request) { env.editor.findPrevious(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.findPrevious(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "find",
|
||||
bindKey: bindKey("Ctrl-F", "Command-F"),
|
||||
exec: function(env, args, request) {
|
||||
var needle = prompt("Find:", env.editor.getCopyText());
|
||||
env.editor.find(needle);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) {
|
||||
var needle = prompt("Find:", editor.getCopyText());
|
||||
editor.find(needle);
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "overwrite",
|
||||
bindKey: bindKey("Insert", "Insert"),
|
||||
exec: function(editor) { editor.toggleOverwrite(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selecttostart",
|
||||
bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
|
||||
exec: function(editor) { editor.getSelection().selectFileStart(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
|
||||
exec: function(editor) { editor.navigateFileStart(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectup",
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||
exec: function(editor) { editor.getSelection().selectUp(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "golineup",
|
||||
bindKey: bindKey("Up", "Up|Ctrl-P"),
|
||||
exec: function(editor, args) { editor.navigateUp(args.times); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selecttoend",
|
||||
bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
|
||||
exec: function(editor) { editor.getSelection().selectFileEnd(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotoend",
|
||||
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
|
||||
exec: function(editor) { editor.navigateFileEnd(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectdown",
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||
exec: function(editor) { editor.getSelection().selectDown(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "golinedown",
|
||||
bindKey: bindKey("Down", "Down|Ctrl-N"),
|
||||
exec: function(editor, args) { editor.navigateDown(args.times); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectwordleft",
|
||||
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
|
||||
exec: function(editor) { editor.getSelection().selectWordLeft(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotowordleft",
|
||||
bindKey: bindKey("Ctrl-Left", "Option-Left"),
|
||||
exec: function(editor) { editor.navigateWordLeft(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selecttolinestart",
|
||||
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
|
||||
exec: function(editor) { editor.getSelection().selectLineStart(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotolinestart",
|
||||
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
|
||||
exec: function(editor) { editor.navigateLineStart(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectleft",
|
||||
bindKey: bindKey("Shift-Left", "Shift-Left"),
|
||||
exec: function(editor) { editor.getSelection().selectLeft(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotoleft",
|
||||
bindKey: bindKey("Left", "Left|Ctrl-B"),
|
||||
exec: function(editor, args) { editor.navigateLeft(args.times); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectwordright",
|
||||
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
|
||||
exec: function(editor) { editor.getSelection().selectWordRight(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotowordright",
|
||||
bindKey: bindKey("Ctrl-Right", "Option-Right"),
|
||||
exec: function(editor) { editor.navigateWordRight(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selecttolineend",
|
||||
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
|
||||
exec: function(editor) { editor.getSelection().selectLineEnd(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotolineend",
|
||||
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
|
||||
exec: function(editor) { editor.navigateLineEnd(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectright",
|
||||
bindKey: bindKey("Shift-Right", "Shift-Right"),
|
||||
exec: function(editor) { editor.getSelection().selectRight(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotoright",
|
||||
bindKey: bindKey("Right", "Right|Ctrl-F"),
|
||||
exec: function(editor, args) { editor.navigateRight(args.times); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectpagedown",
|
||||
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
|
||||
exec: function(editor) { editor.selectPageDown(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "pagedown",
|
||||
bindKey: bindKey(null, "PageDown"),
|
||||
exec: function(editor) { editor.scrollPageDown(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotopagedown",
|
||||
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
|
||||
exec: function(editor) { editor.gotoPageDown(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectpageup",
|
||||
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
|
||||
exec: function(editor) { editor.selectPageUp(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "pageup",
|
||||
bindKey: bindKey(null, "PageUp"),
|
||||
exec: function(editor) { editor.scrollPageUp(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "gotopageup",
|
||||
bindKey: bindKey("PageUp", "Option-PageUp"),
|
||||
exec: function(editor) { editor.gotoPageUp(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectlinestart",
|
||||
bindKey: bindKey("Shift-Home", "Shift-Home"),
|
||||
exec: function(editor) { editor.getSelection().selectLineStart(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectlineend",
|
||||
bindKey: bindKey("Shift-End", "Shift-End"),
|
||||
exec: function(editor) { editor.getSelection().selectLineEnd(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "togglerecording",
|
||||
bindKey: bindKey("Ctrl-Shift-E", "Ctrl-Shift-E"),
|
||||
exec: function(editor) { editor.commands.toggleRecording(); },
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "replaymacro",
|
||||
bindKey: bindKey("Ctrl-E", "Ctrl-E"),
|
||||
exec: function(editor) { editor.commands.replay(editor); },
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
// commands disabled in readOnly mode
|
||||
{
|
||||
name: "removeline",
|
||||
bindKey: bindKey("Ctrl-D", "Command-D"),
|
||||
exec: function(editor) { editor.removeLines(); }
|
||||
}, {
|
||||
name: "togglecomment",
|
||||
bindKey: bindKey("Ctrl-7", "Command-7"),
|
||||
exec: function(editor) { editor.toggleCommentLines(); }
|
||||
}, {
|
||||
name: "replace",
|
||||
bindKey: bindKey("Ctrl-R", "Command-Option-F"),
|
||||
exec: function(env, args, request) {
|
||||
var needle = prompt("Find:", env.editor.getCopyText());
|
||||
exec: function(editor) {
|
||||
var needle = prompt("Find:", editor.getCopyText());
|
||||
if (!needle)
|
||||
return;
|
||||
var replacement = prompt("Replacement:");
|
||||
if (!replacement)
|
||||
return;
|
||||
env.editor.replace(replacement, {needle: needle});
|
||||
editor.replace(replacement, {needle: needle});
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "replaceall",
|
||||
bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
|
||||
exec: function(env, args, request) {
|
||||
exec: function(editor) {
|
||||
var needle = prompt("Find:");
|
||||
if (!needle)
|
||||
return;
|
||||
var replacement = prompt("Replacement:");
|
||||
if (!replacement)
|
||||
return;
|
||||
env.editor.replaceAll(replacement, {needle: needle});
|
||||
editor.replaceAll(replacement, {needle: needle});
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "undo",
|
||||
bindKey: bindKey("Ctrl-Z", "Command-Z"),
|
||||
exec: function(env, args, request) { env.editor.undo(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.undo(); }
|
||||
}, {
|
||||
name: "redo",
|
||||
bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
|
||||
exec: function(env, args, request) { env.editor.redo(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "overwrite",
|
||||
bindKey: bindKey("Insert", "Insert"),
|
||||
exec: function(env, args, request) { env.editor.toggleOverwrite(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.redo(); }
|
||||
}, {
|
||||
name: "copylinesup",
|
||||
bindKey: bindKey("Ctrl-Alt-Up", "Command-Option-Up"),
|
||||
exec: function(env, args, request) { env.editor.copyLinesUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.copyLinesUp(); }
|
||||
}, {
|
||||
name: "movelinesup",
|
||||
bindKey: bindKey("Alt-Up", "Option-Up"),
|
||||
exec: function(env, args, request) { env.editor.moveLinesUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selecttostart",
|
||||
bindKey: bindKey("Ctrl-Shift-Home|Alt-Shift-Up", "Command-Shift-Up"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectFileStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotostart",
|
||||
bindKey: bindKey("Ctrl-Home|Ctrl-Up", "Command-Home|Command-Up"),
|
||||
exec: function(env, args, request) { env.editor.navigateFileStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectup",
|
||||
bindKey: bindKey("Shift-Up", "Shift-Up"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "golineup",
|
||||
bindKey: bindKey("Up", "Up|Ctrl-P"),
|
||||
exec: function(env, args, request) { env.editor.navigateUp(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.moveLinesUp(); }
|
||||
}, {
|
||||
name: "copylinesdown",
|
||||
bindKey: bindKey("Ctrl-Alt-Down", "Command-Option-Down"),
|
||||
exec: function(env, args, request) { env.editor.copyLinesDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.copyLinesDown(); }
|
||||
}, {
|
||||
name: "movelinesdown",
|
||||
bindKey: bindKey("Alt-Down", "Option-Down"),
|
||||
exec: function(env, args, request) { env.editor.moveLinesDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selecttoend",
|
||||
bindKey: bindKey("Ctrl-Shift-End|Alt-Shift-Down", "Command-Shift-Down"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectFileEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotoend",
|
||||
bindKey: bindKey("Ctrl-End|Ctrl-Down", "Command-End|Command-Down"),
|
||||
exec: function(env, args, request) { env.editor.navigateFileEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectdown",
|
||||
bindKey: bindKey("Shift-Down", "Shift-Down"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "golinedown",
|
||||
bindKey: bindKey("Down", "Down|Ctrl-N"),
|
||||
exec: function(env, args, request) { env.editor.navigateDown(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectwordleft",
|
||||
bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotowordleft",
|
||||
bindKey: bindKey("Ctrl-Left", "Option-Left"),
|
||||
exec: function(env, args, request) { env.editor.navigateWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selecttolinestart",
|
||||
bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotolinestart",
|
||||
bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
|
||||
exec: function(env, args, request) { env.editor.navigateLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectleft",
|
||||
bindKey: bindKey("Shift-Left", "Shift-Left"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotoleft",
|
||||
bindKey: bindKey("Left", "Left|Ctrl-B"),
|
||||
exec: function(env, args, request) { env.editor.navigateLeft(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectwordright",
|
||||
bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotowordright",
|
||||
bindKey: bindKey("Ctrl-Right", "Option-Right"),
|
||||
exec: function(env, args, request) { env.editor.navigateWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selecttolineend",
|
||||
bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotolineend",
|
||||
bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
|
||||
exec: function(env, args, request) { env.editor.navigateLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectright",
|
||||
bindKey: bindKey("Shift-Right", "Shift-Right"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotoright",
|
||||
bindKey: bindKey("Right", "Right|Ctrl-F"),
|
||||
exec: function(env, args, request) { env.editor.navigateRight(args.times); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectpagedown",
|
||||
bindKey: bindKey("Shift-PageDown", "Shift-PageDown"),
|
||||
exec: function(env, args, request) { env.editor.selectPageDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "pagedown",
|
||||
bindKey: bindKey(null, "PageDown"),
|
||||
exec: function(env, args, request) { env.editor.scrollPageDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotopagedown",
|
||||
bindKey: bindKey("PageDown", "Option-PageDown|Ctrl-V"),
|
||||
exec: function(env, args, request) { env.editor.gotoPageDown(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectpageup",
|
||||
bindKey: bindKey("Shift-PageUp", "Shift-PageUp"),
|
||||
exec: function(env, args, request) { env.editor.selectPageUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "pageup",
|
||||
bindKey: bindKey(null, "PageUp"),
|
||||
exec: function(env, args, request) { env.editor.scrollPageUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "gotopageup",
|
||||
bindKey: bindKey("PageUp", "Option-PageUp"),
|
||||
exec: function(env, args, request) { env.editor.gotoPageUp(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectlinestart",
|
||||
bindKey: bindKey("Shift-Home", "Shift-Home"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "selectlineend",
|
||||
bindKey: bindKey("Shift-End", "Shift-End"),
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.moveLinesDown(); }
|
||||
}, {
|
||||
name: "del",
|
||||
bindKey: bindKey("Delete", "Delete|Ctrl-D"),
|
||||
exec: function(env, args, request) { env.editor.remove("right"); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.remove("right"); }
|
||||
}, {
|
||||
name: "backspace",
|
||||
bindKey: bindKey(
|
||||
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
|
||||
),
|
||||
exec: function(env, args, request) { env.editor.remove("left"); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.remove("left"); }
|
||||
}, {
|
||||
name: "removetolinestart",
|
||||
bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeToLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.removeToLineStart(); }
|
||||
}, {
|
||||
name: "removetolineend",
|
||||
bindKey: bindKey("Alt-Delete", "Ctrl-K"),
|
||||
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.removeToLineEnd(); }
|
||||
}, {
|
||||
name: "removewordleft",
|
||||
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.removeWordLeft(); }
|
||||
}, {
|
||||
name: "removewordright",
|
||||
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
|
||||
exec: function(env, args, request) { env.editor.removeWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.removeWordRight(); }
|
||||
}, {
|
||||
name: "outdent",
|
||||
bindKey: bindKey("Shift-Tab", "Shift-Tab"),
|
||||
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.blockOutdent(); }
|
||||
}, {
|
||||
name: "indent",
|
||||
bindKey: bindKey("Tab", "Tab"),
|
||||
exec: function(env, args, request) { env.editor.indent(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.indent(); }
|
||||
}, {
|
||||
name: "insertstring",
|
||||
exec: function(editor, str) { editor.insert(str); }
|
||||
}, {
|
||||
name: "inserttext",
|
||||
exec: function(env, args, request) {
|
||||
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
exec: function(editor, args) {
|
||||
editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "centerselection",
|
||||
bindKey: bindKey(null, "Ctrl-L"),
|
||||
exec: function(env, args, request) { env.editor.centerSelection(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
}, {
|
||||
name: "splitline",
|
||||
bindKey: bindKey(null, "Ctrl-O"),
|
||||
exec: function(env, args, request) { env.editor.splitLine(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
exec: function(editor) { editor.splitLine(); }
|
||||
}, {
|
||||
name: "transposeletters",
|
||||
bindKey: bindKey("Ctrl-T", "Ctrl-T"),
|
||||
exec: function(env, args, request) { env.editor.transposeLetters(); }
|
||||
});
|
||||
|
||||
canon.addCommand({
|
||||
name: "fold",
|
||||
bindKey: bindKey("Alt-L", "Alt-L"),
|
||||
exec: function(env) {
|
||||
env.editor.session.toggleFold(false);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "unfold",
|
||||
bindKey: bindKey("Alt-Shift-L", "Alt-Shift-L"),
|
||||
exec: function(env) {
|
||||
env.editor.session.toggleFold(true);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "foldall",
|
||||
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
|
||||
exec: function(env) {
|
||||
env.editor.session.foldAll();
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "unfoldall",
|
||||
bindKey: bindKey("Alt-Shift-0", "Alt-Shift-0"),
|
||||
exec: function(env) {
|
||||
env.editor.session.unFoldAll();
|
||||
}
|
||||
});
|
||||
exec: function(editor) { editor.transposeLetters(); }
|
||||
}, {
|
||||
name: "touppercase",
|
||||
bindKey: bindKey("Ctrl-U", "Ctrl-U"),
|
||||
exec: function(editor) { editor.toUpperCase(); }
|
||||
}, {
|
||||
name: "tolowercase",
|
||||
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
|
||||
exec: function(editor) { editor.toLowerCase(); }
|
||||
}];
|
||||
|
||||
});
|
||||
|
||||
19
vendor/ace/css/editor.css
vendored
19
vendor/ace/css/editor.css
vendored
@@ -1,10 +1,10 @@
|
||||
/*@import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono);*/
|
||||
/* @import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono); */
|
||||
|
||||
|
||||
.ace_editor {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
font-family: 'Monaco', 'Menlo', 'Droid Sans Mono', 'Courier New', monospace;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Courier New', monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
height: 100%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ace_gutter-cell.ace_error {
|
||||
@@ -162,8 +163,18 @@
|
||||
|
||||
.ace_line .ace_fold {
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
color: darkred;
|
||||
color: darkred;
|
||||
-moz-outline-radius: 4px;
|
||||
outline-radius: 4px;
|
||||
border-radius: 4px;
|
||||
outline: 1px solid #1C00FF;
|
||||
outline-offset: -2px;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.ace_dark .ace_fold {
|
||||
color: #E6E1DC;
|
||||
outline-color: #FC6F09;
|
||||
}
|
||||
|
||||
.ace_fold:hover{
|
||||
|
||||
8
vendor/ace/document.js
vendored
8
vendor/ace/document.js
vendored
@@ -37,10 +37,10 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var Range = require("ace/range").Range;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
var oop = require("./lib/oop");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var Range = require("./range").Range;
|
||||
var Anchor = require("./anchor").Anchor;
|
||||
|
||||
var Document = function(text) {
|
||||
this.$lines = [];
|
||||
|
||||
10
vendor/ace/document_test.js
vendored
10
vendor/ace/document_test.js
vendored
@@ -37,15 +37,15 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("./test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Document = require("ace/document").Document;
|
||||
var Range = require("ace/range").Range;
|
||||
var assert = require("ace/test/assertions");
|
||||
var Document = require("./document").Document;
|
||||
var Range = require("./range").Range;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
190
vendor/ace/edit_session.js
vendored
190
vendor/ace/edit_session.js
vendored
@@ -40,14 +40,14 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var Selection = require("ace/selection").Selection;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Range = require("ace/range").Range;
|
||||
var Document = require("ace/document").Document;
|
||||
var BackgroundTokenizer = require("ace/background_tokenizer").BackgroundTokenizer;
|
||||
var oop = require("./lib/oop");
|
||||
var lang = require("./lib/lang");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var Selection = require("./selection").Selection;
|
||||
var TextMode = require("./mode/text").Mode;
|
||||
var Range = require("./range").Range;
|
||||
var Document = require("./document").Document;
|
||||
var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
|
||||
|
||||
var EditSession = function(text, mode) {
|
||||
this.$modified = true;
|
||||
@@ -393,7 +393,7 @@ var EditSession = function(text, mode) {
|
||||
};
|
||||
|
||||
this.getAnnotations = function() {
|
||||
return this.$annotations;
|
||||
return this.$annotations || {};
|
||||
};
|
||||
|
||||
this.clearAnnotations = function() {
|
||||
@@ -441,6 +441,17 @@ var EditSession = function(text, mode) {
|
||||
return new Range(row, start, row, end);
|
||||
};
|
||||
|
||||
// Gets the range of a word including its right whitespace
|
||||
this.getAWordRange = function(row, column) {
|
||||
var wordRange = this.getWordRange(row, column);
|
||||
var line = this.getLine(wordRange.end.row);
|
||||
|
||||
while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
|
||||
wordRange.end.column += 1;
|
||||
}
|
||||
return wordRange;
|
||||
};
|
||||
|
||||
this.setNewLineMode = function(newLineMode) {
|
||||
this.doc.setNewLineMode(newLineMode);
|
||||
};
|
||||
@@ -612,98 +623,6 @@ var EditSession = function(text, mode) {
|
||||
return this.doc.getTextRange(range);
|
||||
};
|
||||
|
||||
this.findMatchingBracket = function(position) {
|
||||
if (position.column == 0) return null;
|
||||
|
||||
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
|
||||
if (charBeforeCursor == "") return null;
|
||||
|
||||
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (match[1]) {
|
||||
return this.$findClosingBracket(match[1], position);
|
||||
} else {
|
||||
return this.$findOpeningBracket(match[2], position);
|
||||
}
|
||||
};
|
||||
|
||||
this.$brackets = {
|
||||
")": "(",
|
||||
"(": ")",
|
||||
"]": "[",
|
||||
"[": "]",
|
||||
"{": "}",
|
||||
"}": "{"
|
||||
};
|
||||
|
||||
this.$findOpeningBracket = function(bracket, position) {
|
||||
var openBracket = this.$brackets[bracket];
|
||||
|
||||
var column = position.column - 2;
|
||||
var row = position.row;
|
||||
var depth = 1;
|
||||
|
||||
var line = this.getLine(row);
|
||||
|
||||
while (true) {
|
||||
while(column >= 0) {
|
||||
var ch = line.charAt(column);
|
||||
if (ch == openBracket) {
|
||||
depth -= 1;
|
||||
if (depth == 0) {
|
||||
return {row: row, column: column};
|
||||
}
|
||||
}
|
||||
else if (ch == bracket) {
|
||||
depth +=1;
|
||||
}
|
||||
column -= 1;
|
||||
}
|
||||
row -=1;
|
||||
if (row < 0) break;
|
||||
|
||||
var line = this.getLine(row);
|
||||
var column = line.length-1;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.$findClosingBracket = function(bracket, position) {
|
||||
var closingBracket = this.$brackets[bracket];
|
||||
|
||||
var column = position.column;
|
||||
var row = position.row;
|
||||
var depth = 1;
|
||||
|
||||
var line = this.getLine(row);
|
||||
var lineCount = this.getLength();
|
||||
|
||||
while (true) {
|
||||
while(column < line.length) {
|
||||
var ch = line.charAt(column);
|
||||
if (ch == closingBracket) {
|
||||
depth -= 1;
|
||||
if (depth == 0) {
|
||||
return {row: row, column: column};
|
||||
}
|
||||
}
|
||||
else if (ch == bracket) {
|
||||
depth +=1;
|
||||
}
|
||||
column += 1;
|
||||
}
|
||||
row +=1;
|
||||
if (row >= lineCount) break;
|
||||
|
||||
var line = this.getLine(row);
|
||||
var column = 0;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
this.insert = function(position, text) {
|
||||
return this.doc.insert(position, text);
|
||||
};
|
||||
@@ -1153,9 +1072,11 @@ var EditSession = function(text, mode) {
|
||||
var row = firstRow;
|
||||
lastRow = Math.min(lastRow, lines.length - 1);
|
||||
while (row <= lastRow) {
|
||||
foldLine = this.getFoldLine(row);
|
||||
foldLine = this.getFoldLine(row, foldLine);
|
||||
if (!foldLine) {
|
||||
tokens = this.$getDisplayTokens(lang.stringTrimRight(lines[row]));
|
||||
wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
|
||||
row ++;
|
||||
} else {
|
||||
tokens = [];
|
||||
foldLine.walk(
|
||||
@@ -1179,16 +1100,13 @@ var EditSession = function(text, mode) {
|
||||
lines[foldLine.end.row].length + 1
|
||||
);
|
||||
// Remove spaces/tabs from the back of the token array.
|
||||
while (tokens.length != 0
|
||||
&& tokens[tokens.length - 1] >= SPACE)
|
||||
{
|
||||
while (tokens.length != 0 && tokens[tokens.length - 1] >= SPACE)
|
||||
tokens.pop();
|
||||
}
|
||||
}
|
||||
wrapData[row] =
|
||||
this.$computeWrapSplits(tokens, wrapLimit, tabSize);
|
||||
|
||||
row = this.getRowFoldEnd(row) + 1;
|
||||
wrapData[foldLine.start.row]
|
||||
= this.$computeWrapSplits(tokens, wrapLimit, tabSize);
|
||||
row = foldLine.end.row + 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1479,9 +1397,7 @@ var EditSession = function(text, mode) {
|
||||
}
|
||||
var doCache = !rowCache.length || i == rowCache.length;
|
||||
|
||||
// clamp row before clamping column, for selection on last line
|
||||
var maxRow = this.getLength() - 1;
|
||||
|
||||
var foldLine = this.getNextFoldLine(docRow);
|
||||
var foldStart = foldLine ? foldLine.start.row : Infinity;
|
||||
|
||||
@@ -1506,18 +1422,24 @@ var EditSession = function(text, mode) {
|
||||
}
|
||||
}
|
||||
|
||||
if (foldLine && foldLine.start.row <= docRow)
|
||||
if (foldLine && foldLine.start.row <= docRow) {
|
||||
line = this.getFoldDisplayLine(foldLine);
|
||||
else {
|
||||
docRow = foldLine.start.row;
|
||||
} else if (row + rowLength <= screenRow || docRow > maxRow) {
|
||||
// clip at the end of the document
|
||||
return {
|
||||
row: maxRow,
|
||||
column: this.getLine(maxRow).length
|
||||
}
|
||||
} else {
|
||||
line = this.getLine(docRow);
|
||||
foldLine = null;
|
||||
}
|
||||
|
||||
var splits = [];
|
||||
if (this.$useWrapMode) {
|
||||
splits = this.$wrapData[docRow];
|
||||
var splits = this.$wrapData[docRow];
|
||||
if (splits) {
|
||||
column = splits[screenRow - row]
|
||||
column = splits[screenRow - row];
|
||||
if(screenRow > row && splits.length) {
|
||||
docColumn = splits[screenRow - row - 1] || splits[splits.length - 1];
|
||||
line = line.substring(docColumn);
|
||||
@@ -1527,10 +1449,6 @@ var EditSession = function(text, mode) {
|
||||
|
||||
docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
|
||||
|
||||
// clip row at the end of the document
|
||||
if (row + splits.length < screenRow)
|
||||
docColumn = Number.MAX_VALUE;
|
||||
|
||||
// Need to do some clamping action here.
|
||||
if (this.$useWrapMode) {
|
||||
if (docColumn >= column) {
|
||||
@@ -1669,24 +1587,29 @@ var EditSession = function(text, mode) {
|
||||
|
||||
this.getScreenLength = function() {
|
||||
var screenRows = 0;
|
||||
var lastFoldLine = null;
|
||||
var foldLine = null;
|
||||
var fold = null;
|
||||
if (!this.$useWrapMode) {
|
||||
screenRows = this.getLength();
|
||||
|
||||
// Remove the folded lines again.
|
||||
var foldData = this.$foldData;
|
||||
for (var i = 0; i < foldData.length; i++) {
|
||||
foldLine = foldData[i];
|
||||
screenRows -= foldLine.end.row - foldLine.start.row;
|
||||
fold = foldData[i];
|
||||
screenRows -= fold.end.row - fold.start.row;
|
||||
}
|
||||
} else {
|
||||
for (var row = 0; row < this.$wrapData.length; row++) {
|
||||
if (foldLine = this.getFoldLine(row, lastFoldLine)) {
|
||||
row = foldLine.end.row;
|
||||
screenRows += 1;
|
||||
} else {
|
||||
screenRows += this.$wrapData[row].length + 1;
|
||||
var lastRow = this.$wrapData.length;
|
||||
var row = 0, i = 0;
|
||||
var fold = this.$foldData[i++];
|
||||
var foldStart = fold ? fold.start.row :Infinity;
|
||||
|
||||
while (row < lastRow) {
|
||||
screenRows += this.$wrapData[row].length + 1;
|
||||
row ++;
|
||||
if (row > foldStart) {
|
||||
row = fold.end.row+1;
|
||||
fold = this.$foldData[i++];
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1735,7 +1658,8 @@ var EditSession = function(text, mode) {
|
||||
|
||||
}).call(EditSession.prototype);
|
||||
|
||||
require("ace/edit_session/folding").Folding.call(EditSession.prototype);
|
||||
require("./edit_session/folding").Folding.call(EditSession.prototype);
|
||||
require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
|
||||
|
||||
exports.EditSession = EditSession;
|
||||
});
|
||||
});
|
||||
|
||||
180
vendor/ace/edit_session/bracket_match.js
vendored
Normal file
180
vendor/ace/edit_session/bracket_match.js
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
/* 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) {
|
||||
|
||||
var TokenIterator = require("../token_iterator").TokenIterator;
|
||||
|
||||
function BracketMatch() {
|
||||
|
||||
this.findMatchingBracket = function(position) {
|
||||
if (position.column == 0) return null;
|
||||
|
||||
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
|
||||
if (charBeforeCursor == "") return null;
|
||||
|
||||
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (match[1]) {
|
||||
return this.$findClosingBracket(match[1], position);
|
||||
} else {
|
||||
return this.$findOpeningBracket(match[2], position);
|
||||
}
|
||||
};
|
||||
|
||||
this.$brackets = {
|
||||
")": "(",
|
||||
"(": ")",
|
||||
"]": "[",
|
||||
"[": "]",
|
||||
"{": "}",
|
||||
"}": "{"
|
||||
};
|
||||
|
||||
this.$findOpeningBracket = function(bracket, position) {
|
||||
var openBracket = this.$brackets[bracket];
|
||||
var depth = 1;
|
||||
|
||||
var iterator = new TokenIterator(this, position.row, position.column);
|
||||
var token = iterator.getCurrentToken();
|
||||
if (!token) return null;
|
||||
|
||||
// token.type contains a period-delimited list of token identifiers
|
||||
// (e.g.: "constant.numeric" or "paren.lparen"). Create a pattern that
|
||||
// matches any token containing the same identifiers or a subset. In
|
||||
// addition, if token.type includes "rparen", then also match "lparen".
|
||||
// So if type.token is "paren.rparen", then typeRe will match "lparen.paren".
|
||||
var typeRe = new RegExp("(\\.?" +
|
||||
token.type.replace(".", "|").replace("rparen", "lparen|rparen") + ")+");
|
||||
|
||||
// Start searching in token, just before the character at position.column
|
||||
var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
|
||||
var value = token.value;
|
||||
|
||||
while (true) {
|
||||
|
||||
while (valueIndex >= 0) {
|
||||
var char = value.charAt(valueIndex);
|
||||
if (char == openBracket) {
|
||||
depth -= 1;
|
||||
if (depth == 0) {
|
||||
return {row: iterator.getCurrentTokenRow(),
|
||||
column: valueIndex + iterator.getCurrentTokenColumn()};
|
||||
}
|
||||
}
|
||||
else if (char == bracket) {
|
||||
depth += 1;
|
||||
}
|
||||
valueIndex -= 1;
|
||||
}
|
||||
|
||||
// Scan backward through the document, looking for the next token
|
||||
// whose type matches typeRe
|
||||
do {
|
||||
token = iterator.stepBackward();
|
||||
} while (token && !typeRe.test(token.type));
|
||||
|
||||
if (token == null)
|
||||
break;
|
||||
|
||||
value = token.value;
|
||||
valueIndex = value.length - 1;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
this.$findClosingBracket = function(bracket, position) {
|
||||
var closingBracket = this.$brackets[bracket];
|
||||
var depth = 1;
|
||||
|
||||
var iterator = new TokenIterator(this, position.row, position.column);
|
||||
var token = iterator.getCurrentToken();
|
||||
if (!token) return null;
|
||||
|
||||
// token.type contains a period-delimited list of token identifiers
|
||||
// (e.g.: "constant.numeric" or "paren.lparen"). Create a pattern that
|
||||
// matches any token containing the same identifiers or a subset. In
|
||||
// addition, if token.type includes "lparen", then also match "rparen".
|
||||
// So if type.token is "lparen.paren", then typeRe will match "paren.rparen".
|
||||
var typeRe = new RegExp("(\\.?" +
|
||||
token.type.replace(".", "|").replace("lparen", "lparen|rparen") + ")+");
|
||||
|
||||
// Start searching in token, after the character at position.column
|
||||
var valueIndex = position.column - iterator.getCurrentTokenColumn();
|
||||
|
||||
while (true) {
|
||||
|
||||
var value = token.value;
|
||||
var valueLength = value.length;
|
||||
while (valueIndex < valueLength) {
|
||||
var char = value.charAt(valueIndex);
|
||||
if (char == closingBracket) {
|
||||
depth -= 1;
|
||||
if (depth == 0) {
|
||||
return {row: iterator.getCurrentTokenRow(),
|
||||
column: valueIndex + iterator.getCurrentTokenColumn()};
|
||||
}
|
||||
}
|
||||
else if (char == bracket) {
|
||||
depth += 1;
|
||||
}
|
||||
valueIndex += 1;
|
||||
}
|
||||
|
||||
// Scan forward through the document, looking for the next token
|
||||
// whose type matches typeRe
|
||||
do {
|
||||
token = iterator.stepForward();
|
||||
} while (token && !typeRe.test(token.type));
|
||||
|
||||
if (token == null)
|
||||
break;
|
||||
|
||||
valueIndex = 0;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
exports.BracketMatch = BracketMatch;
|
||||
|
||||
});
|
||||
2
vendor/ace/edit_session/fold_line.js
vendored
2
vendor/ace/edit_session/fold_line.js
vendored
@@ -38,7 +38,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Range = require("ace/range").Range;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
/**
|
||||
* If the an array is passed in, the folds are expected to be sorted already.
|
||||
|
||||
40
vendor/ace/edit_session/folding.js
vendored
40
vendor/ace/edit_session/folding.js
vendored
@@ -38,9 +38,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Range = require("ace/range").Range;
|
||||
var FoldLine = require("ace/edit_session/fold_line").FoldLine;
|
||||
var Fold = require("ace/edit_session/fold").Fold;
|
||||
var Range = require("../range").Range;
|
||||
var FoldLine = require("./fold_line").FoldLine;
|
||||
var Fold = require("./fold").Fold;
|
||||
|
||||
function Folding() {
|
||||
/**
|
||||
@@ -368,13 +368,13 @@ function Folding() {
|
||||
folds.splice(folds.indexOf(fold), 1);
|
||||
} else
|
||||
// The fold goes over more then one row. This means remvoing this fold
|
||||
// will cause the fold line to get splitted up.
|
||||
// will cause the fold line to get splitted up. newFoldLine is the second part
|
||||
{
|
||||
var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
|
||||
newFoldLine.folds.shift();
|
||||
foldLine.start.row = folds[0].start.row;
|
||||
foldLine.start.column = folds[0].start.column;
|
||||
this.$addFoldLine(newFoldLine);
|
||||
folds = newFoldLine.folds;
|
||||
folds.shift();
|
||||
newFoldLine.start.row = folds[0].start.row;
|
||||
newFoldLine.start.column = folds[0].start.column;
|
||||
}
|
||||
|
||||
if (this.$useWrapMode) {
|
||||
@@ -415,6 +415,30 @@ function Folding() {
|
||||
}, this);
|
||||
}
|
||||
|
||||
this.unfold = function(location, expandInner) {
|
||||
var range, folds;
|
||||
if (location == null)
|
||||
range = new Range(0, 0, this.getLength(), 0);
|
||||
else if (typeof location == "number")
|
||||
range = new Range(location, 0, location, this.getLine(location).length);
|
||||
else if ("row" in location)
|
||||
range = Range.fromPoints(location, location);
|
||||
else
|
||||
range = location;
|
||||
|
||||
var folds = this.getFoldsInRange(range);
|
||||
if (expandInner) {
|
||||
this.removeFolds(folds);
|
||||
} else {
|
||||
// TODO: might need to remove and add folds in one go instead of using
|
||||
// expandFolds several times.
|
||||
while (folds.length) {
|
||||
this.expandFolds(folds);
|
||||
folds = this.getFoldsInRange(range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given documentRow is folded. This is true if there are some
|
||||
* folded parts such that some parts of the line is still visible.
|
||||
|
||||
92
vendor/ace/edit_session_test.js
vendored
92
vendor/ace/edit_session_test.js
vendored
@@ -37,19 +37,20 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("./test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var lang = require("pilot/lang");
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var MockRenderer = require("ace/test/mockrenderer").MockRenderer;
|
||||
var Range = require("ace/range").Range;
|
||||
var assert = require("ace/test/assertions");
|
||||
var lang = require("./lib/lang");
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var Editor = require("./editor").Editor;
|
||||
var UndoManager = require("./undomanager").UndoManager;
|
||||
var MockRenderer = require("./test/mockrenderer").MockRenderer;
|
||||
var Range = require("./range").Range;
|
||||
var assert = require("./test/assertions");
|
||||
var JavaScriptMode = require("./mode/javascript").Mode;
|
||||
|
||||
function createFoldTestSession() {
|
||||
var lines = [
|
||||
@@ -69,7 +70,7 @@ function createFoldTestSession() {
|
||||
|
||||
module.exports = {
|
||||
|
||||
"test: find matching opening bracket" : function() {
|
||||
"test: find matching opening bracket in Text mode" : function() {
|
||||
var session = new EditSession(["(()(", "())))"]);
|
||||
|
||||
assert.position(session.findMatchingBracket({row: 0, column: 3}), 0, 1);
|
||||
@@ -79,7 +80,7 @@ module.exports = {
|
||||
assert.equal(session.findMatchingBracket({row: 1, column: 5}), null);
|
||||
},
|
||||
|
||||
"test: find matching closing bracket" : function() {
|
||||
"test: find matching closing bracket in Text mode" : function() {
|
||||
var session = new EditSession(["(()(", "())))"]);
|
||||
|
||||
assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
|
||||
@@ -90,6 +91,67 @@ module.exports = {
|
||||
assert.equal(session.findMatchingBracket({row: 0, column: 0}), null);
|
||||
},
|
||||
|
||||
"test: find matching opening bracket in JavaScript mode" : function() {
|
||||
var lines = [
|
||||
"function foo() {",
|
||||
" var str = \"{ foo()\";",
|
||||
" if (debug) {",
|
||||
" // write str (a string) to the console",
|
||||
" console.log(str);",
|
||||
" }",
|
||||
" str += \" bar() }\";",
|
||||
"}"
|
||||
];
|
||||
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
|
||||
|
||||
assert.position(session.findMatchingBracket({row: 0, column: 14}), 0, 12);
|
||||
assert.position(session.findMatchingBracket({row: 7, column: 1}), 0, 15);
|
||||
assert.position(session.findMatchingBracket({row: 6, column: 20}), 1, 15);
|
||||
assert.position(session.findMatchingBracket({row: 1, column: 22}), 1, 20);
|
||||
assert.position(session.findMatchingBracket({row: 3, column: 31}), 3, 21);
|
||||
assert.position(session.findMatchingBracket({row: 4, column: 24}), 4, 19);
|
||||
assert.equal(session.findMatchingBracket({row: 0, column: 1}), null);
|
||||
},
|
||||
|
||||
"test: find matching closing bracket in JavaScript mode" : function() {
|
||||
var lines = [
|
||||
"function foo() {",
|
||||
" var str = \"{ foo()\";",
|
||||
" if (debug) {",
|
||||
" // write str (a string) to the console",
|
||||
" console.log(str);",
|
||||
" }",
|
||||
" str += \" bar() }\";",
|
||||
"}"
|
||||
];
|
||||
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
|
||||
|
||||
assert.position(session.findMatchingBracket({row: 0, column: 13}), 0, 13);
|
||||
assert.position(session.findMatchingBracket({row: 0, column: 16}), 7, 0);
|
||||
assert.position(session.findMatchingBracket({row: 1, column: 16}), 6, 19);
|
||||
assert.position(session.findMatchingBracket({row: 1, column: 21}), 1, 21);
|
||||
assert.position(session.findMatchingBracket({row: 3, column: 22}), 3, 30);
|
||||
assert.position(session.findMatchingBracket({row: 4, column: 20}), 4, 23);
|
||||
},
|
||||
|
||||
"test: handle unbalanced brackets in JavaScript mode" : function() {
|
||||
var lines = [
|
||||
"function foo() {",
|
||||
" var str = \"{ foo()\";",
|
||||
" if (debug) {",
|
||||
" // write str a string) to the console",
|
||||
" console.log(str);",
|
||||
" ",
|
||||
" str += \" bar() \";",
|
||||
"}"
|
||||
];
|
||||
var session = new EditSession(lines.join("\n"), new JavaScriptMode());
|
||||
|
||||
assert.equal(session.findMatchingBracket({row: 0, column: 16}), null);
|
||||
assert.equal(session.findMatchingBracket({row: 3, column: 30}), null);
|
||||
assert.equal(session.findMatchingBracket({row: 1, column: 16}), null);
|
||||
},
|
||||
|
||||
"test: match different bracket types" : function() {
|
||||
var session = new EditSession(["({[", ")]}"]);
|
||||
|
||||
@@ -301,6 +363,14 @@ module.exports = {
|
||||
assert.position(session.screenToDocumentPosition(1, 30), 1, 12);
|
||||
assert.position(session.screenToDocumentPosition(20, 50), 1, 12);
|
||||
assert.position(session.screenToDocumentPosition(20, 5), 1, 12);
|
||||
|
||||
// and the same for folded rows
|
||||
session.addFold("...", new Range(0,1,1,3));
|
||||
assert.position(session.screenToDocumentPosition(1, 2), 1, 12);
|
||||
// for wrapped rows
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(5,5);
|
||||
assert.position(session.screenToDocumentPosition(4, 1), 1, 12);
|
||||
},
|
||||
|
||||
"test: wrapLine split function" : function() {
|
||||
|
||||
167
vendor/ace/editor.js
vendored
167
vendor/ace/editor.js
vendored
@@ -40,22 +40,24 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
require("./lib/fixoldbrowsers");
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var event = require("pilot/event");
|
||||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var TextInput = require("ace/keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("ace/mouse/mouse_handler").MouseHandler;
|
||||
//var TouchHandler = require("ace/touch_handler").TouchHandler;
|
||||
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Search = require("ace/search").Search;
|
||||
var Range = require("ace/range").Range;
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var oop = require("./lib/oop");
|
||||
var event = require("./lib/event");
|
||||
var lang = require("./lib/lang");
|
||||
var useragent = require("./lib/useragent");
|
||||
var TextInput = require("./keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
|
||||
//var TouchHandler = require("./touch_handler").TouchHandler;
|
||||
var KeyBinding = require("./keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var Search = require("./search").Search;
|
||||
var Range = require("./range").Range;
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var CommandManager = require("./commands/command_manager").CommandManager;
|
||||
var defaultCommands = require("./commands/default_commands").commands;
|
||||
|
||||
var Editor =function(renderer, session) {
|
||||
var Editor = function(renderer, session) {
|
||||
var container = renderer.getContainerElement();
|
||||
this.container = container;
|
||||
this.renderer = renderer;
|
||||
@@ -75,6 +77,7 @@ var Editor =function(renderer, session) {
|
||||
wrap: true
|
||||
});
|
||||
|
||||
this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
|
||||
this.setSession(session || new EditSession(""));
|
||||
};
|
||||
|
||||
@@ -303,7 +306,7 @@ var Editor =function(renderer, session) {
|
||||
this._dispatchEvent("change", e);
|
||||
|
||||
// update cursor because tab characters can influence the cursor position
|
||||
this.renderer.updateCursor();
|
||||
this.onCursorChange();
|
||||
};
|
||||
|
||||
this.onTokenizerUpdate = function(e) {
|
||||
@@ -426,9 +429,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.insert = function(text) {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
var session = this.session;
|
||||
var mode = session.getMode();
|
||||
|
||||
@@ -520,30 +520,11 @@ var Editor =function(renderer, session) {
|
||||
mode.autoOutdent(lineState, session, cursor.row);
|
||||
};
|
||||
|
||||
this.onTextInput = function(text, notPasted) {
|
||||
if (!notPasted)
|
||||
this.onTextInput = function(text, pasted) {
|
||||
if (pasted)
|
||||
this._emit("paste", text);
|
||||
|
||||
// In case the text was not pasted and we got only one character, then
|
||||
// handel it as a command key stroke.
|
||||
if (notPasted && text.length == 1) {
|
||||
// Note: The `null` as `keyCode` is important here, as there are
|
||||
// some checks in the code for `keyCode == 0` meaning the text comes
|
||||
// from the keyBinding.onTextInput code path.
|
||||
var handled = this.keyBinding.onCommandKey({}, 0, null, text);
|
||||
|
||||
// Check if the text was handled. If not, then handled it as "normal"
|
||||
// text and insert it to the editor directly. This shouldn't be done
|
||||
// using the this.keyBinding.onTextInput(text) function, as it would
|
||||
// make the `text` get sent to the keyboardHandler twice, which might
|
||||
// turn out to be a bad thing in case there is a custome keyboard
|
||||
// handler like the StateHandler.
|
||||
if (!handled) {
|
||||
this.insert(text);
|
||||
}
|
||||
} else {
|
||||
this.keyBinding.onTextInput(text);
|
||||
}
|
||||
this.keyBinding.onTextInput(text, pasted);
|
||||
};
|
||||
|
||||
this.onCommandKey = function(e, hashId, keyCode) {
|
||||
@@ -657,9 +638,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.remove = function(dir) {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty()){
|
||||
if(dir == "left")
|
||||
this.selection.selectLeft();
|
||||
@@ -681,9 +659,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.removeWordRight = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectWordRight();
|
||||
|
||||
@@ -692,9 +667,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.removeWordLeft = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectWordLeft();
|
||||
|
||||
@@ -703,9 +675,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.removeToLineStart = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectLineStart();
|
||||
|
||||
@@ -714,9 +683,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.removeToLineEnd = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectLineEnd();
|
||||
|
||||
@@ -731,9 +697,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.splitLine = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
@@ -745,9 +708,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.transposeLetters = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@@ -770,10 +730,31 @@ var Editor =function(renderer, session) {
|
||||
this.session.replace(range, swap);
|
||||
};
|
||||
|
||||
this.indent = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
this.toLowerCase = function() {
|
||||
var originalRange = this.getSelectionRange();
|
||||
if (this.selection.isEmpty()) {
|
||||
this.selection.selectWord();
|
||||
}
|
||||
|
||||
var range = this.getSelectionRange();
|
||||
var text = this.session.getTextRange(range);
|
||||
this.session.replace(range, text.toLowerCase());
|
||||
this.selection.setSelectionRange(originalRange);
|
||||
};
|
||||
|
||||
this.toUpperCase = function() {
|
||||
var originalRange = this.getSelectionRange();
|
||||
if (this.selection.isEmpty()) {
|
||||
this.selection.selectWord();
|
||||
}
|
||||
|
||||
var range = this.getSelectionRange();
|
||||
var text = this.session.getTextRange(range);
|
||||
this.session.replace(range, text.toUpperCase());
|
||||
this.selection.setSelectionRange(originalRange);
|
||||
};
|
||||
|
||||
this.indent = function() {
|
||||
var session = this.session;
|
||||
var range = this.getSelectionRange();
|
||||
|
||||
@@ -792,34 +773,25 @@ var Editor =function(renderer, session) {
|
||||
indentString = lang.stringRepeat(" ", count);
|
||||
} else
|
||||
indentString = "\t";
|
||||
return this.onTextInput(indentString, true);
|
||||
return this.insert(indentString);
|
||||
}
|
||||
};
|
||||
|
||||
this.blockOutdent = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
var selection = this.session.getSelection();
|
||||
this.session.outdentRows(selection.getRange());
|
||||
};
|
||||
|
||||
this.toggleCommentLines = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
var state = this.session.getState(this.getCursorPosition().row);
|
||||
var rows = this.$getSelectedRows();
|
||||
this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
|
||||
};
|
||||
|
||||
this.removeLines = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
var rows = this.$getSelectedRows();
|
||||
var range;
|
||||
if (rows.last == 0 || rows.last+1 < this.session.getLength())
|
||||
if (rows.first == 0 || rows.last+1 < this.session.getLength())
|
||||
range = new Range(rows.first, 0, rows.last+1, 0);
|
||||
else
|
||||
range = new Range(
|
||||
@@ -831,18 +803,12 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.moveLinesDown = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
this.$moveLines(function(firstRow, lastRow) {
|
||||
return this.session.moveLinesDown(firstRow, lastRow);
|
||||
});
|
||||
};
|
||||
|
||||
this.moveLinesUp = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
this.$moveLines(function(firstRow, lastRow) {
|
||||
return this.session.moveLinesUp(firstRow, lastRow);
|
||||
});
|
||||
@@ -856,9 +822,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.copyLinesUp = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
this.$moveLines(function(firstRow, lastRow) {
|
||||
this.session.duplicateLines(firstRow, lastRow);
|
||||
return 0;
|
||||
@@ -866,9 +829,6 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.copyLinesDown = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
this.$moveLines(function(firstRow, lastRow) {
|
||||
return this.session.duplicateLines(firstRow, lastRow);
|
||||
});
|
||||
@@ -877,14 +837,24 @@ var Editor =function(renderer, session) {
|
||||
|
||||
this.$moveLines = function(mover) {
|
||||
var rows = this.$getSelectedRows();
|
||||
var selection = this.selection;
|
||||
if (!selection.isMultiLine()) {
|
||||
var range = selection.getRange();
|
||||
var reverse = selection.isBackwards();
|
||||
}
|
||||
|
||||
var linesMoved = mover.call(this, rows.first, rows.last);
|
||||
|
||||
var selection = this.selection;
|
||||
selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
|
||||
selection.$moveSelection(function() {
|
||||
selection.moveCursorTo(rows.first+linesMoved, 0);
|
||||
});
|
||||
if (range) {
|
||||
range.start.row += linesMoved;
|
||||
range.end.row += linesMoved;
|
||||
selection.setSelectionRange(range, reverse);
|
||||
} else {
|
||||
selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
|
||||
selection.$moveSelection(function() {
|
||||
selection.moveCursorTo(rows.first+linesMoved, 0);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.$getSelectedRows = function() {
|
||||
@@ -920,6 +890,10 @@ var Editor =function(renderer, session) {
|
||||
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
||||
};
|
||||
|
||||
this.isRowFullyVisible = function(row) {
|
||||
return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
|
||||
};
|
||||
|
||||
this.$getVisibleRowCount = function() {
|
||||
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
|
||||
};
|
||||
@@ -1030,14 +1004,13 @@ var Editor =function(renderer, session) {
|
||||
|
||||
this.gotoLine = function(lineNumber, column) {
|
||||
this.selection.clearSelection();
|
||||
this.session.unfold({row: lineNumber - 1, column: column || 0})
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
this.moveCursorTo(lineNumber-1, column || 0);
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||
if (!this.isRowFullyVisible(this.getCursorPosition().row))
|
||||
this.scrollToLine(lineNumber, true);
|
||||
}
|
||||
};
|
||||
|
||||
this.navigateTo = function(row, column) {
|
||||
@@ -1189,15 +1162,15 @@ var Editor =function(renderer, session) {
|
||||
};
|
||||
|
||||
this.$find = function(backwards) {
|
||||
if (!this.selection.isEmpty()) {
|
||||
if (!this.selection.isEmpty())
|
||||
this.$search.set({needle: this.session.getTextRange(this.getSelectionRange())});
|
||||
}
|
||||
|
||||
if (typeof backwards != "undefined")
|
||||
this.$search.set({backwards: backwards});
|
||||
|
||||
var range = this.$search.find(this.session);
|
||||
if (range) {
|
||||
this.session.unfold(range);
|
||||
this.gotoLine(range.end.row+1, range.end.column);
|
||||
this.selection.setSelectionRange(range);
|
||||
}
|
||||
|
||||
43
vendor/ace/editor_change_document_test.js
vendored
43
vendor/ace/editor_change_document_test.js
vendored
@@ -36,18 +36,20 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("./test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var Text = require("ace/mode/text").Mode;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var MockRenderer = require("ace/test/mockrenderer").MockRenderer;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var Editor = require("./editor").Editor;
|
||||
var Text = require("./mode/text").Mode;
|
||||
var JavaScriptMode = require("./mode/javascript").Mode;
|
||||
var CssMode = require("./mode/css").Mode;
|
||||
var HtmlMode = require("./mode/html").Mode;
|
||||
var MockRenderer = require("./test/mockrenderer").MockRenderer;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -157,6 +159,31 @@ module.exports = {
|
||||
|
||||
this.session2.setMode(new JavaScriptMode());
|
||||
assert.ok(called);
|
||||
},
|
||||
|
||||
"test: should use stop worker of old document" : function(next) {
|
||||
var self = this;
|
||||
|
||||
// 1. Open an editor and set the session to CssMode
|
||||
self.editor.setSession(self.session1);
|
||||
self.session1.setMode(new CssMode());
|
||||
|
||||
// 2. Add a line or two of valid CSS.
|
||||
self.session1.setValue("DIV { color: red; }");
|
||||
|
||||
// 3. Clear the session value.
|
||||
self.session1.setValue("");
|
||||
|
||||
// 4. Set the session to HtmlMode
|
||||
self.session1.setMode(new HtmlMode());
|
||||
|
||||
// 5. Try to type valid HTML
|
||||
self.session1.insert({row: 0, column: 0}, "<html></html>");
|
||||
|
||||
setTimeout(function() {
|
||||
assert.equal(Object.keys(self.session1.getAnnotations()).length, 0);
|
||||
next();
|
||||
}, 600);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -37,17 +37,17 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("./test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var MockRenderer = require("ace/test/mockrenderer").MockRenderer;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var Editor = require("./editor").Editor;
|
||||
var MockRenderer = require("./test/mockrenderer").MockRenderer;
|
||||
var TextMode = require("./mode/text").Mode;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
|
||||
"Mauris at arcu mi, eu lobortis mauris. Quisque ut libero eget " +
|
||||
|
||||
12
vendor/ace/editor_navigation_test.js
vendored
12
vendor/ace/editor_navigation_test.js
vendored
@@ -36,16 +36,16 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("./test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var MockRenderer = require("ace/test/mockrenderer").MockRenderer;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var Editor = require("./editor").Editor;
|
||||
var MockRenderer = require("./test/mockrenderer").MockRenderer;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
createEditSession : function(rows, cols) {
|
||||
|
||||
62
vendor/ace/editor_text_edit_test.js
vendored
62
vendor/ace/editor_text_edit_test.js
vendored
@@ -36,18 +36,18 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("./test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var MockRenderer = require("ace/test/mockrenderer").MockRenderer;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("./edit_session").EditSession;
|
||||
var Editor = require("./editor").Editor;
|
||||
var JavaScriptMode = require("./mode/javascript").Mode;
|
||||
var UndoManager = require("./undomanager").UndoManager;
|
||||
var MockRenderer = require("./test/mockrenderer").MockRenderer;
|
||||
var assert = require("./test/assertions");
|
||||
|
||||
module.exports = {
|
||||
"test: delete line from the middle" : function() {
|
||||
@@ -301,7 +301,7 @@ module.exports = {
|
||||
assert.position(editor.getSelection().getSelectionLead(), 0, 0);
|
||||
},
|
||||
|
||||
"test: move line without active selection should move cursor to start of the moved line" : function()
|
||||
"test: move line without active selection should not move cursor relative to the moved line" : function()
|
||||
{
|
||||
var session = new EditSession(["11", "22", "33", "44"].join("\n"));
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
@@ -311,13 +311,13 @@ module.exports = {
|
||||
|
||||
editor.moveLinesDown();
|
||||
assert.equal(["11", "33", "22", "44"].join("\n"), session.toString());
|
||||
assert.position(editor.getCursorPosition(), 2, 0);
|
||||
assert.position(editor.getCursorPosition(), 2, 1);
|
||||
|
||||
editor.clearSelection();
|
||||
|
||||
editor.moveLinesUp();
|
||||
assert.equal(["11", "22", "33", "44"].join("\n"), session.toString());
|
||||
assert.position(editor.getCursorPosition(), 1, 0);
|
||||
assert.position(editor.getCursorPosition(), 1, 1);
|
||||
},
|
||||
|
||||
"test: copy lines down should select lines and place cursor at the selection start" : function() {
|
||||
@@ -511,6 +511,46 @@ module.exports = {
|
||||
editor.removeToLineEnd();
|
||||
assert.position(editor.getCursorPosition(), 1, 4);
|
||||
assert.equal(session.getValue(), ["123", "456789"].join("\n"));
|
||||
},
|
||||
|
||||
"test: transform selection to uppercase": function() {
|
||||
var session = new EditSession(["ajax", "dot", "org"]);
|
||||
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
editor.moveCursorTo(1, 0);
|
||||
editor.getSelection().selectLineEnd();
|
||||
editor.toUpperCase()
|
||||
assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n"));
|
||||
},
|
||||
|
||||
"test: transform word to uppercase": function() {
|
||||
var session = new EditSession(["ajax", "dot", "org"]);
|
||||
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
editor.moveCursorTo(1, 0);
|
||||
editor.toUpperCase()
|
||||
assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n"));
|
||||
assert.position(editor.getCursorPosition(), 1, 0);
|
||||
},
|
||||
|
||||
"test: transform selection to lowercase": function() {
|
||||
var session = new EditSession(["AJAX", "DOT", "ORG"]);
|
||||
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
editor.moveCursorTo(1, 0);
|
||||
editor.getSelection().selectLineEnd();
|
||||
editor.toLowerCase()
|
||||
assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n"));
|
||||
},
|
||||
|
||||
"test: transform word to lowercase": function() {
|
||||
var session = new EditSession(["AJAX", "DOT", "ORG"]);
|
||||
|
||||
var editor = new Editor(new MockRenderer(), session);
|
||||
editor.moveCursorTo(1, 0);
|
||||
editor.toLowerCase()
|
||||
assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n"));
|
||||
assert.position(editor.getCursorPosition(), 1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
6
vendor/ace/ext/static_highlight.js
vendored
6
vendor/ace/ext/static_highlight.js
vendored
@@ -39,9 +39,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var TextLayer = require("ace/layer/text").Text;
|
||||
var baseStyles = require("ace/requirejs/text!ace/ext/static.css");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var TextLayer = require("../layer/text").Text;
|
||||
var baseStyles = require("../requirejs/text!./static.css");
|
||||
|
||||
/** Transforms a given input code snippet into HTML using the given mode
|
||||
*
|
||||
|
||||
22
vendor/ace/ext/static_highlight_test.js
vendored
22
vendor/ace/ext/static_highlight_test.js
vendored
@@ -1,18 +1,20 @@
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("../test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var assert = require("assert");
|
||||
var highlighter = require("./static_highlight");
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var JavaScriptMode = require("../mode/javascript").Mode;
|
||||
|
||||
// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
|
||||
module.exports = {
|
||||
timeout: 10000,
|
||||
|
||||
"test simple snippet": function(next) {
|
||||
var theme = require("ace/theme/tomorrow");
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
@@ -36,7 +38,7 @@ function hello (a, b, c) {\n\
|
||||
},
|
||||
|
||||
"test css from theme is used": function(next) {
|
||||
var theme = require("ace/theme/tomorrow");
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
@@ -48,13 +50,13 @@ function hello (a, b, c) {\n\
|
||||
var isError = false, result;
|
||||
result = highlighter.render(snippet, mode, theme);
|
||||
|
||||
assert.equal(result.css, theme.cssText);
|
||||
assert.ok(result.css.indexOf(theme.cssText) !== -1);
|
||||
|
||||
next();
|
||||
},
|
||||
|
||||
"test theme classname should be in output html": function (next) {
|
||||
var theme = require("ace/theme/tomorrow");
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "/** this is a function\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
@@ -71,4 +73,8 @@ function hello (a, b, c) {\n\
|
||||
}
|
||||
};
|
||||
|
||||
!module.parent && require("asyncjs").test.testcase(module.exports).exec();
|
||||
});
|
||||
|
||||
if (typeof module !== "undefined" && module === require.main) {
|
||||
require("asyncjs").test.testcase(module.exports).exec();
|
||||
}
|
||||
2
vendor/ace/keyboard/hash_handler.js
vendored
2
vendor/ace/keyboard/hash_handler.js
vendored
@@ -38,7 +38,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var keyUtil = require("pilot/keys");
|
||||
var keyUtil = require("../lib/keys");
|
||||
|
||||
function HashHandler(config) {
|
||||
this.setConfig(config);
|
||||
|
||||
116
vendor/ace/keyboard/keybinding.js
vendored
116
vendor/ace/keyboard/keybinding.js
vendored
@@ -21,6 +21,7 @@
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
* Harutyun Amirjanyan <amirjanyan@gmail.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
|
||||
@@ -38,79 +39,86 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var useragent = require("pilot/useragent");
|
||||
var keyUtil = require("pilot/keys");
|
||||
var event = require("pilot/event");
|
||||
var settings = require("pilot/settings").settings;
|
||||
var canon = require("pilot/canon");
|
||||
require("ace/commands/default_commands");
|
||||
var useragent = require("../lib/useragent");
|
||||
var keyUtil = require("../lib/keys");
|
||||
var event = require("../lib/event");
|
||||
require("../commands/default_commands");
|
||||
|
||||
var KeyBinding = function(editor) {
|
||||
this.$editor = editor;
|
||||
this.$data = { };
|
||||
this.$keyboardHandler = null;
|
||||
this.$handlers = [this];
|
||||
};
|
||||
|
||||
(function() {
|
||||
this.setKeyboardHandler = function(keyboardHandler) {
|
||||
if (this.$keyboardHandler != keyboardHandler) {
|
||||
this.$data = { };
|
||||
this.$keyboardHandler = keyboardHandler;
|
||||
}
|
||||
if (this.$handlers[this.$handlers.length - 1] == keyboardHandler)
|
||||
return;
|
||||
this.$data = { };
|
||||
this.$handlers = keyboardHandler ? [this, keyboardHandler] : [this];
|
||||
};
|
||||
|
||||
this.addKeyboardHandler = function(keyboardHandler) {
|
||||
this.removeKeyboardHandler(keyboardHandler);
|
||||
this.$handlers.push(keyboardHandler);
|
||||
};
|
||||
|
||||
this.removeKeyboardHandler = function(keyboardHandler) {
|
||||
var i = this.$handlers.indexOf(keyboardHandler);
|
||||
if (i == -1)
|
||||
return false;
|
||||
this.$handlers.splice(i, 1);
|
||||
return true;
|
||||
};
|
||||
|
||||
this.getKeyboardHandler = function() {
|
||||
return this.$keyboardHandler;
|
||||
return this.$handlers[this.$handlers - 1];
|
||||
};
|
||||
|
||||
this.$callKeyboardHandler = function (e, hashId, keyOrText, keyCode) {
|
||||
var env = {editor: this.$editor},
|
||||
toExecute;
|
||||
|
||||
if (this.$keyboardHandler) {
|
||||
toExecute =
|
||||
this.$keyboardHandler.handleKeyboard(this.$data, hashId, keyOrText, keyCode, e);
|
||||
this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
|
||||
for (var i = this.$handlers.length; i--;) {
|
||||
var toExecute = this.$handlers[i].handleKeyboard(
|
||||
this.$data, hashId, keyString, keyCode, e
|
||||
);
|
||||
if (toExecute && toExecute.command)
|
||||
break;
|
||||
}
|
||||
|
||||
// If there is nothing to execute yet, then use the default keymapping.
|
||||
if (!toExecute || !toExecute.command) {
|
||||
if (hashId != 0 || keyCode != 0) {
|
||||
toExecute = {
|
||||
command: canon.findKeyCommand(env, "editor", hashId, keyOrText)
|
||||
}
|
||||
} else {
|
||||
toExecute = {
|
||||
command: "inserttext",
|
||||
args: {
|
||||
text: keyOrText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!toExecute || !toExecute.command)
|
||||
return false;
|
||||
var success = false, commands = this.$editor.commands;
|
||||
|
||||
// allow keyboardHandler to consume keys
|
||||
if (toExecute.command != "null")
|
||||
success = commands.exec(toExecute.command, this.$editor, toExecute.args);
|
||||
else
|
||||
success = true;
|
||||
|
||||
if (success && e)
|
||||
event.stopEvent(e);
|
||||
|
||||
return success
|
||||
};
|
||||
|
||||
this.handleKeyboard = function(data, hashId, keyString) {
|
||||
return {
|
||||
command: this.$editor.commands.findKeyCommand(hashId, keyString)
|
||||
}
|
||||
};
|
||||
|
||||
this.onCommandKey = function(e, hashId, keyCode) {
|
||||
var keyString = keyUtil.keyCodeToString(keyCode);
|
||||
this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
|
||||
};
|
||||
|
||||
this.onTextInput = function(text, pasted) {
|
||||
var success = false;
|
||||
if (toExecute) {
|
||||
success = canon.exec(toExecute.command,
|
||||
env, "editor", toExecute.args);
|
||||
if (success) {
|
||||
event.stopEvent(e);
|
||||
}
|
||||
}
|
||||
return success;
|
||||
if (!pasted && text.length == 1)
|
||||
success = this.$callKeyboardHandlers(0, text);
|
||||
if (!success)
|
||||
this.$editor.commands.exec("insertstring", this.$editor, text);
|
||||
};
|
||||
|
||||
this.onCommandKey = function(e, hashId, keyCode, keyString) {
|
||||
// In case there is no keyString, try to interprete the keyCode.
|
||||
if (!keyString) {
|
||||
keyString = keyUtil.keyCodeToString(keyCode);
|
||||
}
|
||||
return this.$callKeyboardHandler(e, hashId, keyString, keyCode);
|
||||
};
|
||||
|
||||
this.onTextInput = function(text) {
|
||||
return this.$callKeyboardHandler({}, 0, text, 0);
|
||||
}
|
||||
|
||||
}).call(KeyBinding.prototype);
|
||||
|
||||
exports.KeyBinding = KeyBinding;
|
||||
|
||||
4
vendor/ace/keyboard/keybinding/emacs.js
vendored
4
vendor/ace/keyboard/keybinding/emacs.js
vendored
@@ -37,8 +37,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var StateHandler = require("ace/keyboard/state_handler").StateHandler;
|
||||
var matchCharacterOnly = require("ace/keyboard/state_handler").matchCharacterOnly;
|
||||
var StateHandler = require("../state_handler").StateHandler;
|
||||
var matchCharacterOnly = require("../state_handler").matchCharacterOnly;
|
||||
|
||||
var emacsState = {
|
||||
start: [
|
||||
|
||||
4
vendor/ace/keyboard/keybinding/vim.js
vendored
4
vendor/ace/keyboard/keybinding/vim.js
vendored
@@ -37,8 +37,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var StateHandler = require("ace/keyboard/state_handler").StateHandler;
|
||||
var matchCharacterOnly = require("ace/keyboard/state_handler").matchCharacterOnly;
|
||||
var StateHandler = require("../state_handler").StateHandler;
|
||||
var matchCharacterOnly = require("../state_handler").matchCharacterOnly;
|
||||
|
||||
var vimcommand = function(key, exec, then) {
|
||||
return {
|
||||
|
||||
18
vendor/ace/keyboard/textinput.js
vendored
18
vendor/ace/keyboard/textinput.js
vendored
@@ -39,9 +39,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var useragent = require("pilot/useragent");
|
||||
var dom = require("pilot/dom");
|
||||
var event = require("../lib/event");
|
||||
var useragent = require("../lib/useragent");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
var TextInput = function(parentNode, host) {
|
||||
|
||||
@@ -73,10 +73,10 @@ var TextInput = function(parentNode, host) {
|
||||
if (value.charCodeAt(value.length-1) == PLACEHOLDER.charCodeAt(0)) {
|
||||
value = value.slice(0, -1);
|
||||
if (value)
|
||||
host.onTextInput(value, !pasted);
|
||||
host.onTextInput(value, pasted);
|
||||
}
|
||||
else {
|
||||
host.onTextInput(value, !pasted);
|
||||
host.onTextInput(value, pasted);
|
||||
}
|
||||
|
||||
// If editor is no longer focused we quit immediately, since
|
||||
@@ -249,10 +249,12 @@ var TextInput = function(parentNode, host) {
|
||||
|
||||
this.onContextMenu = function(mousePos, isEmpty){
|
||||
if (mousePos) {
|
||||
if(!tempStyle)
|
||||
if (!tempStyle)
|
||||
tempStyle = text.style.cssText;
|
||||
text.style.cssText = 'position:fixed; z-index:1000;' +
|
||||
'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;'
|
||||
|
||||
text.style.cssText =
|
||||
'position:fixed; z-index:1000;' +
|
||||
'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;'
|
||||
|
||||
}
|
||||
if (isEmpty)
|
||||
|
||||
2
vendor/ace/layer/cursor.js
vendored
2
vendor/ace/layer/cursor.js
vendored
@@ -39,7 +39,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var dom = require("pilot/dom");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
var Cursor = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
|
||||
2
vendor/ace/layer/gutter.js
vendored
2
vendor/ace/layer/gutter.js
vendored
@@ -39,7 +39,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var dom = require("pilot/dom");
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
var Gutter = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
|
||||
4
vendor/ace/layer/marker.js
vendored
4
vendor/ace/layer/marker.js
vendored
@@ -39,8 +39,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Range = require("ace/range").Range;
|
||||
var dom = require("pilot/dom");
|
||||
var Range = require("../range").Range;
|
||||
var dom = require("../lib/dom");
|
||||
|
||||
var Marker = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
|
||||
19
vendor/ace/layer/text.js
vendored
19
vendor/ace/layer/text.js
vendored
@@ -41,11 +41,11 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var dom = require("pilot/dom");
|
||||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var oop = require("../lib/oop");
|
||||
var dom = require("../lib/dom");
|
||||
var lang = require("../lib/lang");
|
||||
var useragent = require("../lib/useragent");
|
||||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
|
||||
var Text = function(parentEl) {
|
||||
this.element = dom.createElement("div");
|
||||
@@ -201,6 +201,7 @@ var Text = function(parentEl) {
|
||||
var foldLine = this.session.getFoldLine(row);
|
||||
if (foldLine) {
|
||||
if (foldLine.containsRow(first)) {
|
||||
first = foldLine.start.row;
|
||||
break;
|
||||
} else {
|
||||
row = foldLine.end.row;
|
||||
@@ -264,12 +265,12 @@ var Text = function(parentEl) {
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
|
||||
while (true) {
|
||||
if(row > foldStart) {
|
||||
if (row > foldStart) {
|
||||
row = fold.end.row+1;
|
||||
fold = this.session.getNextFoldLine(row, fold);
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
if(row > lastRow)
|
||||
if (row > lastRow)
|
||||
break;
|
||||
|
||||
var container = dom.createElement("div");
|
||||
@@ -311,12 +312,12 @@ var Text = function(parentEl) {
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
|
||||
while (true) {
|
||||
if(row > foldStart) {
|
||||
if (row > foldStart) {
|
||||
row = fold.end.row+1;
|
||||
fold = this.session.getNextFoldLine(row, fold);
|
||||
foldStart = fold ?fold.start.row :Infinity;
|
||||
}
|
||||
if(row > lastRow)
|
||||
if (row > lastRow)
|
||||
break;
|
||||
|
||||
if (this.$useLineGroups())
|
||||
|
||||
12
vendor/ace/layer/text_test.js
vendored
12
vendor/ace/layer/text_test.js
vendored
@@ -36,16 +36,16 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("ace/test/mockdom");
|
||||
require("amd-loader");
|
||||
require("../test/mockdom");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var TextLayer = require("ace/layer/text").Text;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var TextLayer = require("./text").Text;
|
||||
var JavaScriptMode = require("../mode/javascript").Mode;
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.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
|
||||
@@ -38,60 +40,65 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var types = require('pilot/types')
|
||||
var SelectionType = require('pilot/types/basic').SelectionType
|
||||
var oop = require("./oop");
|
||||
var event = require("./event");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
|
||||
var env
|
||||
/**
|
||||
* This class keeps track of the focus state of the given window.
|
||||
* Focus changes for example when the user switches a browser tab,
|
||||
* goes to the location bar or switches to another application.
|
||||
*/
|
||||
var BrowserFocus = function(win) {
|
||||
win = win || window;
|
||||
|
||||
this.lastFocus = new Date().getTime();
|
||||
this._isFocused = true;
|
||||
|
||||
var _self = this;
|
||||
|
||||
var settingTypes = {
|
||||
selectionStyle: new SelectionType({
|
||||
data: [ 'line', 'text' ]
|
||||
})
|
||||
}
|
||||
// IE < 9 supports focusin and focusout events
|
||||
if ("onfocusin" in win.document) {
|
||||
event.addListener(win.document, "focusin", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
|
||||
var settings = {
|
||||
printMargin: {
|
||||
description: 'Position of the print margin column.',
|
||||
type: 'number',
|
||||
defaultValue: 80,
|
||||
onChange: function onChange(event) {
|
||||
if (env.editor) env.editor.setPrintMarginColumn(event.value)
|
||||
}
|
||||
},
|
||||
showIvisibles: {
|
||||
description: 'Whether or not to show invisible characters.',
|
||||
type: 'bool',
|
||||
defaultValue: false,
|
||||
onChange: function onChange(event) {
|
||||
if (env.editor) env.editor.setShowInvisibles(event.value)
|
||||
}
|
||||
},
|
||||
highlightActiveLine: {
|
||||
description: 'Whether or not highlight active line.',
|
||||
type: 'bool',
|
||||
defaultValue: true,
|
||||
onChange: function onChange(event) {
|
||||
if (env.editor) env.editor.setHighlightActiveLine(event.value)
|
||||
}
|
||||
},
|
||||
selectionStyle: {
|
||||
description: 'Type of text selection.',
|
||||
type: 'selectionStyle',
|
||||
defaultValue: 'line',
|
||||
onChange: function onChange(event) {
|
||||
if (env.editor) env.editor.setSelectionStyle(event.value)
|
||||
}
|
||||
event.addListener(win.document, "focusout", function(e) {
|
||||
_self._setFocused(!!e.toElement);
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
event.addListener(win, "blur", function(e) {
|
||||
_self._setFocused(false);
|
||||
});
|
||||
|
||||
exports.startup = function startup(data, reason) {
|
||||
env = data.env
|
||||
types.registerTypes(settingTypes)
|
||||
data.env.settings.addSettings(settings)
|
||||
}
|
||||
event.addListener(win, "focus", function(e) {
|
||||
_self._setFocused(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports.shutdown = function shutdown(data, reason) {
|
||||
data.env.settings.removeSettings(settings)
|
||||
}
|
||||
(function(){
|
||||
|
||||
})
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.isFocused = function() {
|
||||
return this._isFocused;
|
||||
};
|
||||
|
||||
this._setFocused = function(isFocused) {
|
||||
if (this._isFocused == isFocused)
|
||||
return;
|
||||
|
||||
if (isFocused)
|
||||
this.lastFocus = new Date().getTime();
|
||||
|
||||
this._isFocused = isFocused;
|
||||
this._emit("changeFocus");
|
||||
};
|
||||
|
||||
}).call(BrowserFocus.prototype);
|
||||
|
||||
|
||||
exports.BrowserFocus = BrowserFocus;
|
||||
});
|
||||
335
vendor/ace/lib/dom.js
vendored
Normal file
335
vendor/ace/lib/dom.js
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
/* 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>
|
||||
* Mihai Sucan <mihai AT sucan AT gmail ODT com>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.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 XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
exports.createElement = function(tag, ns) {
|
||||
return document.createElementNS ?
|
||||
document.createElementNS(ns || XHTML_NS, tag) :
|
||||
document.createElement(tag);
|
||||
};
|
||||
|
||||
exports.setText = function(elem, text) {
|
||||
if (elem.innerText !== undefined) {
|
||||
elem.innerText = text;
|
||||
}
|
||||
if (elem.textContent !== undefined) {
|
||||
elem.textContent = text;
|
||||
}
|
||||
};
|
||||
|
||||
if (!document.documentElement.classList) {
|
||||
exports.hasCssClass = function(el, name) {
|
||||
var classes = el.className.split(/\s+/g);
|
||||
return classes.indexOf(name) !== -1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a CSS class to the list of classes on the given node
|
||||
*/
|
||||
exports.addCssClass = function(el, name) {
|
||||
if (!exports.hasCssClass(el, name)) {
|
||||
el.className += " " + name;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove a CSS class from the list of classes on the given node
|
||||
*/
|
||||
exports.removeCssClass = function(el, name) {
|
||||
var classes = el.className.split(/\s+/g);
|
||||
while (true) {
|
||||
var index = classes.indexOf(name);
|
||||
if (index == -1) {
|
||||
break;
|
||||
}
|
||||
classes.splice(index, 1);
|
||||
}
|
||||
el.className = classes.join(" ");
|
||||
};
|
||||
|
||||
exports.toggleCssClass = function(el, name) {
|
||||
var classes = el.className.split(/\s+/g), add = true;
|
||||
while (true) {
|
||||
var index = classes.indexOf(name);
|
||||
if (index == -1) {
|
||||
break;
|
||||
}
|
||||
add = false;
|
||||
classes.splice(index, 1);
|
||||
}
|
||||
if(add)
|
||||
classes.push(name);
|
||||
|
||||
el.className = classes.join(" ");
|
||||
return add;
|
||||
};
|
||||
} else {
|
||||
exports.hasCssClass = function(el, name) {
|
||||
return el.classList.contains(name);
|
||||
};
|
||||
|
||||
exports.addCssClass = function(el, name) {
|
||||
el.classList.add(name);
|
||||
};
|
||||
|
||||
exports.removeCssClass = function(el, name) {
|
||||
el.classList.remove(name);
|
||||
};
|
||||
|
||||
exports.toggleCssClass = function(el, name) {
|
||||
return el.classList.toggle(name);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or remove a CSS class from the list of classes on the given node
|
||||
* depending on the value of <tt>include</tt>
|
||||
*/
|
||||
exports.setCssClass = function(node, className, include) {
|
||||
if (include) {
|
||||
exports.addCssClass(node, className);
|
||||
} else {
|
||||
exports.removeCssClass(node, className);
|
||||
}
|
||||
};
|
||||
|
||||
exports.hasCssString = function(id, doc) {
|
||||
var index = 0, sheets;
|
||||
doc = doc || document;
|
||||
|
||||
if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
|
||||
while (index < sheets.length)
|
||||
if (sheets[index++].title === id) return true;
|
||||
} else if ((sheets = doc.getElementsByTagName("style"))) {
|
||||
while (index < sheets.length)
|
||||
if (sheets[index++].id === id) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.importCssString = function importCssString(cssText, id, doc) {
|
||||
doc = doc || document;
|
||||
// If style is already imported return immediately.
|
||||
if (id && exports.hasCssString(id, doc))
|
||||
return null;
|
||||
|
||||
var style;
|
||||
|
||||
if (doc.createStyleSheet) {
|
||||
style = doc.createStyleSheet();
|
||||
style.cssText = cssText;
|
||||
if (id)
|
||||
style.title = id;
|
||||
} else {
|
||||
style = doc.createElementNS ?
|
||||
doc.createElementNS(XHTML_NS, "style") :
|
||||
doc.createElement("style");
|
||||
|
||||
style.appendChild(doc.createTextNode(cssText));
|
||||
if (id)
|
||||
style.id = id;
|
||||
|
||||
var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
|
||||
head.appendChild(style);
|
||||
}
|
||||
};
|
||||
|
||||
exports.importCssStylsheet = function(uri, doc) {
|
||||
if (doc.createStyleSheet) {
|
||||
var sheet = doc.createStyleSheet(uri);
|
||||
} else {
|
||||
var link = exports.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = uri;
|
||||
|
||||
var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
|
||||
head.appendChild(link);
|
||||
}
|
||||
};
|
||||
|
||||
exports.getInnerWidth = function(element) {
|
||||
return (parseInt(exports.computedStyle(element, "paddingLeft"))
|
||||
+ parseInt(exports.computedStyle(element, "paddingRight")) + element.clientWidth);
|
||||
};
|
||||
|
||||
exports.getInnerHeight = function(element) {
|
||||
return (parseInt(exports.computedStyle(element, "paddingTop"))
|
||||
+ parseInt(exports.computedStyle(element, "paddingBottom")) + element.clientHeight);
|
||||
};
|
||||
|
||||
if (window.pageYOffset !== undefined) {
|
||||
exports.getPageScrollTop = function() {
|
||||
return window.pageYOffset;
|
||||
};
|
||||
|
||||
exports.getPageScrollLeft = function() {
|
||||
return window.pageXOffset;
|
||||
};
|
||||
}
|
||||
else {
|
||||
exports.getPageScrollTop = function() {
|
||||
return document.body.scrollTop;
|
||||
};
|
||||
|
||||
exports.getPageScrollLeft = function() {
|
||||
return document.body.scrollLeft;
|
||||
};
|
||||
}
|
||||
|
||||
if (window.getComputedStyle)
|
||||
exports.computedStyle = function(element, style) {
|
||||
if (style)
|
||||
return (window.getComputedStyle(element, "") || {})[style] || "";
|
||||
return window.getComputedStyle(element, "") || {}
|
||||
};
|
||||
else
|
||||
exports.computedStyle = function(element, style) {
|
||||
if (style)
|
||||
return element.currentStyle[style];
|
||||
return element.currentStyle
|
||||
};
|
||||
|
||||
exports.scrollbarWidth = function(document) {
|
||||
|
||||
var inner = exports.createElement("p");
|
||||
inner.style.width = "100%";
|
||||
inner.style.minWidth = "0px";
|
||||
inner.style.height = "200px";
|
||||
|
||||
var outer = exports.createElement("div");
|
||||
var style = outer.style;
|
||||
|
||||
style.position = "absolute";
|
||||
style.left = "-10000px";
|
||||
style.overflow = "hidden";
|
||||
style.width = "200px";
|
||||
style.minWidth = "0px";
|
||||
style.height = "150px";
|
||||
|
||||
outer.appendChild(inner);
|
||||
|
||||
var body = document.body || document.documentElement;
|
||||
body.appendChild(outer);
|
||||
|
||||
var noScrollbar = inner.offsetWidth;
|
||||
|
||||
style.overflow = "scroll";
|
||||
var withScrollbar = inner.offsetWidth;
|
||||
|
||||
if (noScrollbar == withScrollbar) {
|
||||
withScrollbar = outer.clientWidth;
|
||||
}
|
||||
|
||||
body.removeChild(outer);
|
||||
|
||||
return noScrollbar-withScrollbar;
|
||||
};
|
||||
|
||||
/**
|
||||
* Optimized set innerHTML. This is faster than plain innerHTML if the element
|
||||
* already contains a lot of child elements.
|
||||
*
|
||||
* See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details
|
||||
*/
|
||||
exports.setInnerHtml = function(el, innerHtml) {
|
||||
var element = el.cloneNode(false);//document.createElement("div");
|
||||
element.innerHTML = innerHtml;
|
||||
el.parentNode.replaceChild(element, el);
|
||||
return element;
|
||||
};
|
||||
|
||||
exports.setInnerText = function(el, innerText) {
|
||||
var document = el.ownerDocument;
|
||||
if (document.body && "textContent" in document.body)
|
||||
el.textContent = innerText;
|
||||
else
|
||||
el.innerText = innerText;
|
||||
|
||||
};
|
||||
|
||||
exports.getInnerText = function(el) {
|
||||
var document = el.ownerDocument;
|
||||
if (document.body && "textContent" in document.body)
|
||||
return el.textContent;
|
||||
else
|
||||
return el.innerText || el.textContent || "";
|
||||
};
|
||||
|
||||
exports.getParentWindow = function(document) {
|
||||
return document.defaultView || document.parentWindow;
|
||||
};
|
||||
|
||||
exports.getSelectionStart = function(textarea) {
|
||||
// TODO IE
|
||||
var start;
|
||||
try {
|
||||
start = textarea.selectionStart || 0;
|
||||
} catch (e) {
|
||||
start = 0;
|
||||
}
|
||||
return start;
|
||||
};
|
||||
|
||||
exports.setSelectionStart = function(textarea, start) {
|
||||
// TODO IE
|
||||
return textarea.selectionStart = start;
|
||||
};
|
||||
|
||||
exports.getSelectionEnd = function(textarea) {
|
||||
// TODO IE
|
||||
var end;
|
||||
try {
|
||||
end = textarea.selectionEnd || 0;
|
||||
} catch (e) {
|
||||
end = 0;
|
||||
}
|
||||
return end;
|
||||
};
|
||||
|
||||
exports.setSelectionEnd = function(textarea, end) {
|
||||
// TODO IE
|
||||
return textarea.selectionEnd = end;
|
||||
};
|
||||
|
||||
});
|
||||
346
vendor/ace/lib/event.js
vendored
Normal file
346
vendor/ace/lib/event.js
vendored
Normal file
@@ -0,0 +1,346 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var keys = require("./keys");
|
||||
var useragent = require("./useragent");
|
||||
var dom = require("./dom");
|
||||
|
||||
exports.addListener = function(elem, type, callback) {
|
||||
if (elem.addEventListener) {
|
||||
return elem.addEventListener(type, callback, false);
|
||||
}
|
||||
if (elem.attachEvent) {
|
||||
var wrapper = function() {
|
||||
callback(window.event);
|
||||
};
|
||||
callback._wrapper = wrapper;
|
||||
elem.attachEvent("on" + type, wrapper);
|
||||
}
|
||||
};
|
||||
|
||||
exports.removeListener = function(elem, type, callback) {
|
||||
if (elem.removeEventListener) {
|
||||
return elem.removeEventListener(type, callback, false);
|
||||
}
|
||||
if (elem.detachEvent) {
|
||||
elem.detachEvent("on" + type, callback._wrapper || callback);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Prevents propagation and clobbers the default action of the passed event
|
||||
*/
|
||||
exports.stopEvent = function(e) {
|
||||
exports.stopPropagation(e);
|
||||
exports.preventDefault(e);
|
||||
return false;
|
||||
};
|
||||
|
||||
exports.stopPropagation = function(e) {
|
||||
if (e.stopPropagation)
|
||||
e.stopPropagation();
|
||||
else
|
||||
e.cancelBubble = true;
|
||||
};
|
||||
|
||||
exports.preventDefault = function(e) {
|
||||
if (e.preventDefault)
|
||||
e.preventDefault();
|
||||
else
|
||||
e.returnValue = false;
|
||||
};
|
||||
|
||||
exports.getDocumentX = function(e) {
|
||||
if (e.clientX) {
|
||||
return e.clientX + dom.getPageScrollLeft();
|
||||
} else {
|
||||
return e.pageX;
|
||||
}
|
||||
};
|
||||
|
||||
exports.getDocumentY = function(e) {
|
||||
if (e.clientY) {
|
||||
return e.clientY + dom.getPageScrollTop();
|
||||
} else {
|
||||
return e.pageY;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Number} 0 for left button, 1 for middle button, 2 for right button
|
||||
*/
|
||||
exports.getButton = function(e) {
|
||||
if (e.type == "dblclick")
|
||||
return 0;
|
||||
else if (e.type == "contextmenu")
|
||||
return 2;
|
||||
|
||||
// DOM Event
|
||||
if (e.preventDefault) {
|
||||
return e.button;
|
||||
}
|
||||
// old IE
|
||||
else {
|
||||
return {1:0, 2:2, 4:1}[e.button];
|
||||
}
|
||||
};
|
||||
|
||||
if (document.documentElement.setCapture) {
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
function onMouseMove(e) {
|
||||
eventHandler(e);
|
||||
return exports.stopPropagation(e);
|
||||
}
|
||||
|
||||
var called = false;
|
||||
function onReleaseCapture(e) {
|
||||
eventHandler(e);
|
||||
|
||||
if (!called) {
|
||||
called = true;
|
||||
releaseCaptureHandler(e);
|
||||
}
|
||||
|
||||
exports.removeListener(el, "mousemove", eventHandler);
|
||||
exports.removeListener(el, "mouseup", onReleaseCapture);
|
||||
exports.removeListener(el, "losecapture", onReleaseCapture);
|
||||
|
||||
el.releaseCapture();
|
||||
}
|
||||
|
||||
exports.addListener(el, "mousemove", eventHandler);
|
||||
exports.addListener(el, "mouseup", onReleaseCapture);
|
||||
exports.addListener(el, "losecapture", onReleaseCapture);
|
||||
el.setCapture();
|
||||
};
|
||||
}
|
||||
else {
|
||||
exports.capture = function(el, eventHandler, releaseCaptureHandler) {
|
||||
function onMouseMove(e) {
|
||||
eventHandler(e);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function onMouseUp(e) {
|
||||
eventHandler && eventHandler(e);
|
||||
releaseCaptureHandler && releaseCaptureHandler(e);
|
||||
|
||||
document.removeEventListener("mousemove", onMouseMove, true);
|
||||
document.removeEventListener("mouseup", onMouseUp, true);
|
||||
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
document.addEventListener("mousemove", onMouseMove, true);
|
||||
document.addEventListener("mouseup", onMouseUp, true);
|
||||
};
|
||||
}
|
||||
|
||||
exports.addMouseWheelListener = function(el, callback) {
|
||||
var max = 0;
|
||||
var listener = function(e) {
|
||||
if (e.wheelDelta !== undefined) {
|
||||
|
||||
// some versions of Safari (e.g. 5.0.5) report insanely high
|
||||
// scroll values. These browsers require a higher factor
|
||||
if (Math.abs(e.wheelDeltaY) > max)
|
||||
max = Math.abs(e.wheelDeltaY)
|
||||
|
||||
if (max > 5000)
|
||||
var factor = 400;
|
||||
else
|
||||
var factor = 8;
|
||||
|
||||
if (e.wheelDeltaX !== undefined) {
|
||||
e.wheelX = -e.wheelDeltaX / factor;
|
||||
e.wheelY = -e.wheelDeltaY / factor;
|
||||
} else {
|
||||
e.wheelX = 0;
|
||||
e.wheelY = -e.wheelDelta / factor;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
|
||||
e.wheelX = (e.detail || 0) * 5;
|
||||
e.wheelY = 0;
|
||||
} else {
|
||||
e.wheelX = 0;
|
||||
e.wheelY = (e.detail || 0) * 5;
|
||||
}
|
||||
}
|
||||
callback(e);
|
||||
};
|
||||
exports.addListener(el, "DOMMouseScroll", listener);
|
||||
exports.addListener(el, "mousewheel", listener);
|
||||
};
|
||||
|
||||
exports.addMultiMouseDownListener = function(el, button, count, timeout, callback) {
|
||||
var clicks = 0;
|
||||
var startX, startY;
|
||||
|
||||
var listener = function(e) {
|
||||
clicks += 1;
|
||||
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;
|
||||
|
||||
if (clicks == count) {
|
||||
clicks = 0;
|
||||
callback(e);
|
||||
}
|
||||
|
||||
if (isButton)
|
||||
return exports.preventDefault(e);
|
||||
};
|
||||
|
||||
exports.addListener(el, "mousedown", listener);
|
||||
useragent.isOldIE && exports.addListener(el, "dblclick", listener);
|
||||
};
|
||||
|
||||
function normalizeCommandKeys(callback, e, keyCode) {
|
||||
var hashId = 0;
|
||||
if (useragent.isOpera && useragent.isMac) {
|
||||
hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
|
||||
| (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
|
||||
} else {
|
||||
hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
|
||||
| (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
|
||||
}
|
||||
|
||||
if (keyCode in keys.MODIFIER_KEYS) {
|
||||
switch (keys.MODIFIER_KEYS[keyCode]) {
|
||||
case "Alt":
|
||||
hashId = 2;
|
||||
break;
|
||||
case "Shift":
|
||||
hashId = 4;
|
||||
break;
|
||||
case "Ctrl":
|
||||
hashId = 1;
|
||||
break;
|
||||
default:
|
||||
hashId = 8;
|
||||
break;
|
||||
}
|
||||
keyCode = 0;
|
||||
}
|
||||
|
||||
if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
|
||||
keyCode = 0;
|
||||
}
|
||||
|
||||
// If there is no hashID and the keyCode is not a function key, then
|
||||
// we don't call the callback as we don't handle a command key here
|
||||
// (it's a normal key/character input).
|
||||
if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
|
||||
return false;
|
||||
}
|
||||
return callback(e, hashId, keyCode);
|
||||
}
|
||||
|
||||
exports.addCommandKeyListener = function(el, callback) {
|
||||
var addListener = exports.addListener;
|
||||
if (useragent.isOldGecko) {
|
||||
// Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
|
||||
// event if the user pressed the key for a longer time. Instead, the
|
||||
// keydown event was fired once and later on only the keypress event.
|
||||
// To emulate the 'right' keydown behavior, the keyCode of the initial
|
||||
// keyDown event is stored and in the following keypress events the
|
||||
// stores keyCode is used to emulate a keyDown event.
|
||||
var lastKeyDownKeyCode = null;
|
||||
addListener(el, "keydown", function(e) {
|
||||
lastKeyDownKeyCode = e.keyCode;
|
||||
});
|
||||
addListener(el, "keypress", function(e) {
|
||||
return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
|
||||
});
|
||||
} else {
|
||||
var lastDown = null;
|
||||
|
||||
addListener(el, "keydown", function(e) {
|
||||
lastDown = e.keyIdentifier || e.keyCode;
|
||||
return normalizeCommandKeys(callback, e, e.keyCode);
|
||||
});
|
||||
|
||||
// repeated keys are fired as keypress and not keydown events
|
||||
if (useragent.isMac && useragent.isOpera) {
|
||||
addListener(el, "keypress", function(e) {
|
||||
var keyId = e.keyIdentifier || e.keyCode;
|
||||
if (lastDown !== keyId) {
|
||||
return normalizeCommandKeys(callback, e, lastDown);
|
||||
} else {
|
||||
lastDown = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (window.postMessage) {
|
||||
var postMessageId = 1;
|
||||
this.nextTick = function(callback, win) {
|
||||
win = win || window;
|
||||
var messageName = "zero-timeout-message-" + postMessageId;
|
||||
exports.addListener(win, "message", function listener(e) {
|
||||
if (e.data == messageName) {
|
||||
exports.stopPropagation(e);
|
||||
exports.removeListener(win, "message", listener);
|
||||
callback();
|
||||
}
|
||||
});
|
||||
win.postMessage(messageName, "*");
|
||||
};
|
||||
}
|
||||
else {
|
||||
this.nextTick = function(callback, win) {
|
||||
win = win || window;
|
||||
window.setTimeout(callback, 0);
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
120
vendor/ace/lib/event_emitter.js
vendored
Normal file
120
vendor/ace/lib/event_emitter.js
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
/* 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>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Mike de Boer <mike AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EventEmitter = {};
|
||||
|
||||
EventEmitter._emit =
|
||||
EventEmitter._dispatchEvent = function(eventName, e) {
|
||||
this._eventRegistry = this._eventRegistry || {};
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName] || [];
|
||||
var defaultHandler = this._defaultHandlers[eventName];
|
||||
if (!listeners.length && !defaultHandler)
|
||||
return;
|
||||
|
||||
e = e || {};
|
||||
e.type = eventName;
|
||||
|
||||
if (!e.stopPropagation) {
|
||||
e.stopPropagation = function() {
|
||||
this.propagationStopped = true;
|
||||
};
|
||||
}
|
||||
|
||||
if (!e.preventDefault) {
|
||||
e.preventDefault = function() {
|
||||
this.defaultPrevented = true;
|
||||
};
|
||||
}
|
||||
|
||||
for (var i=0; i<listeners.length; i++) {
|
||||
listeners[i](e);
|
||||
if (e.propagationStopped)
|
||||
break;
|
||||
}
|
||||
|
||||
if (defaultHandler && !e.defaultPrevented)
|
||||
defaultHandler(e);
|
||||
};
|
||||
|
||||
EventEmitter.setDefaultHandler = function(eventName, callback) {
|
||||
this._defaultHandlers = this._defaultHandlers || {};
|
||||
|
||||
if (this._defaultHandlers[eventName])
|
||||
throw new Error("The default handler for '" + eventName + "' is already set");
|
||||
|
||||
this._defaultHandlers[eventName] = callback;
|
||||
};
|
||||
|
||||
EventEmitter.on =
|
||||
EventEmitter.addEventListener = function(eventName, callback) {
|
||||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners)
|
||||
var listeners = this._eventRegistry[eventName] = [];
|
||||
|
||||
if (listeners.indexOf(callback) == -1)
|
||||
listeners.push(callback);
|
||||
};
|
||||
|
||||
EventEmitter.removeListener =
|
||||
EventEmitter.removeEventListener = function(eventName, callback) {
|
||||
this._eventRegistry = this._eventRegistry || {};
|
||||
|
||||
var listeners = this._eventRegistry[eventName];
|
||||
if (!listeners)
|
||||
return;
|
||||
|
||||
var index = listeners.indexOf(callback);
|
||||
if (index !== -1)
|
||||
listeners.splice(index, 1);
|
||||
};
|
||||
|
||||
EventEmitter.removeAllListeners = function(eventName) {
|
||||
if (this._eventRegistry) this._eventRegistry[eventName] = [];
|
||||
};
|
||||
|
||||
exports.EventEmitter = EventEmitter;
|
||||
|
||||
});
|
||||
@@ -36,14 +36,14 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var assert = require("ace/test/assertions");
|
||||
var oop = require("../lib/oop");
|
||||
var EventEmitter = require("./event_emitter").EventEmitter;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
var Emitter = function() {};
|
||||
|
||||
18
vendor/ace/lib/fixoldbrowsers.js
vendored
Normal file
18
vendor/ace/lib/fixoldbrowsers.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// vim:set ts=4 sts=4 sw=4 st:
|
||||
// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
|
||||
// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
|
||||
// -- dantman Daniel Friesen Copyright(C) 2010 XXX No License Specified
|
||||
// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
|
||||
// -- Irakli Gozalishvili Copyright (C) 2010 MIT License
|
||||
|
||||
/*!
|
||||
Copyright (c) 2009, 280 North Inc. http://280north.com/
|
||||
MIT License. http://github.com/280north/narwhal/blob/master/README.md
|
||||
*/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
require("./regexp");
|
||||
require("./es5-shim");
|
||||
|
||||
});
|
||||
128
vendor/ace/lib/keys.js
vendored
Normal file
128
vendor/ace/lib/keys.js
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/*! @license
|
||||
==========================================================================
|
||||
SproutCore -- JavaScript Application Framework
|
||||
copyright 2006-2009, Sprout Systems Inc., Apple Inc. and contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
SproutCore and the SproutCore logo are trademarks of Sprout Systems, Inc.
|
||||
|
||||
For more information about SproutCore, visit http://www.sproutcore.com
|
||||
|
||||
|
||||
==========================================================================
|
||||
@license */
|
||||
|
||||
// Most of the following code is taken from SproutCore with a few changes.
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("./oop");
|
||||
|
||||
/**
|
||||
* Helper functions and hashes for key handling.
|
||||
*/
|
||||
var Keys = (function() {
|
||||
var ret = {
|
||||
MODIFIER_KEYS: {
|
||||
16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
|
||||
},
|
||||
|
||||
KEY_MODS: {
|
||||
"ctrl": 1, "alt": 2, "option" : 2,
|
||||
"shift": 4, "meta": 8, "command": 8
|
||||
},
|
||||
|
||||
FUNCTION_KEYS : {
|
||||
8 : "Backspace",
|
||||
9 : "Tab",
|
||||
13 : "Return",
|
||||
19 : "Pause",
|
||||
27 : "Esc",
|
||||
32 : "Space",
|
||||
33 : "PageUp",
|
||||
34 : "PageDown",
|
||||
35 : "End",
|
||||
36 : "Home",
|
||||
37 : "Left",
|
||||
38 : "Up",
|
||||
39 : "Right",
|
||||
40 : "Down",
|
||||
44 : "Print",
|
||||
45 : "Insert",
|
||||
46 : "Delete",
|
||||
96 : "Numpad0",
|
||||
97 : "Numpad1",
|
||||
98 : "Numpad2",
|
||||
99 : "Numpad3",
|
||||
100: "Numpad4",
|
||||
101: "Numpad5",
|
||||
102: "Numpad6",
|
||||
103: "Numpad7",
|
||||
104: "Numpad8",
|
||||
105: "Numpad9",
|
||||
112: "F1",
|
||||
113: "F2",
|
||||
114: "F3",
|
||||
115: "F4",
|
||||
116: "F5",
|
||||
117: "F6",
|
||||
118: "F7",
|
||||
119: "F8",
|
||||
120: "F9",
|
||||
121: "F10",
|
||||
122: "F11",
|
||||
123: "F12",
|
||||
144: "Numlock",
|
||||
145: "Scrolllock"
|
||||
},
|
||||
|
||||
PRINTABLE_KEYS: {
|
||||
32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
|
||||
54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
|
||||
66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
|
||||
73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
|
||||
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
|
||||
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
|
||||
188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
|
||||
221: ']', 222: '\"'
|
||||
}
|
||||
};
|
||||
|
||||
// A reverse map of FUNCTION_KEYS
|
||||
for (var i in ret.FUNCTION_KEYS) {
|
||||
var name = ret.FUNCTION_KEYS[i].toUpperCase();
|
||||
ret[name] = parseInt(i, 10);
|
||||
}
|
||||
|
||||
// Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY
|
||||
// variables as well.
|
||||
oop.mixin(ret, ret.MODIFIER_KEYS);
|
||||
oop.mixin(ret, ret.PRINTABLE_KEYS);
|
||||
oop.mixin(ret, ret.FUNCTION_KEYS);
|
||||
|
||||
return ret;
|
||||
})();
|
||||
oop.mixin(exports, Keys);
|
||||
|
||||
exports.keyCodeToString = function(keyCode) {
|
||||
return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
|
||||
}
|
||||
|
||||
});
|
||||
149
vendor/ace/lib/lang.js
vendored
Normal file
149
vendor/ace/lib/lang.js
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
/* ***** 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) {
|
||||
|
||||
exports.stringReverse = function(string) {
|
||||
return string.split("").reverse().join("");
|
||||
};
|
||||
|
||||
exports.stringRepeat = function (string, count) {
|
||||
return new Array(count + 1).join(string);
|
||||
};
|
||||
|
||||
var trimBeginRegexp = /^\s\s*/;
|
||||
var trimEndRegexp = /\s\s*$/;
|
||||
|
||||
exports.stringTrimLeft = function (string) {
|
||||
return string.replace(trimBeginRegexp, '')
|
||||
};
|
||||
|
||||
exports.stringTrimRight = function (string) {
|
||||
return string.replace(trimEndRegexp, '');
|
||||
};
|
||||
|
||||
exports.copyObject = function(obj) {
|
||||
var copy = {};
|
||||
for (var key in obj) {
|
||||
copy[key] = obj[key];
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
|
||||
exports.copyArray = function(array){
|
||||
var copy = [];
|
||||
for (i=0, l=array.length; i<l; i++) {
|
||||
if (array[i] && typeof array[i] == "object")
|
||||
copy[i] = this.copyObject( array[i] );
|
||||
else
|
||||
copy[i] = array[i]
|
||||
}
|
||||
return copy;
|
||||
};
|
||||
|
||||
exports.deepCopy = function (obj) {
|
||||
if (typeof obj != "object") {
|
||||
return obj;
|
||||
}
|
||||
|
||||
var copy = obj.constructor();
|
||||
for (var key in obj) {
|
||||
if (typeof obj[key] == "object") {
|
||||
copy[key] = this.deepCopy(obj[key]);
|
||||
} else {
|
||||
copy[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
exports.arrayToMap = function(arr) {
|
||||
var map = {};
|
||||
for (var i=0; i<arr.length; i++) {
|
||||
map[arr[i]] = 1;
|
||||
}
|
||||
return map;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* splice out of 'array' anything that === 'value'
|
||||
*/
|
||||
exports.arrayRemove = function(array, value) {
|
||||
for (var i = 0; i <= array.length; i++) {
|
||||
if (value === array[i]) {
|
||||
array.splice(i, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
exports.escapeRegExp = function(str) {
|
||||
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
|
||||
};
|
||||
|
||||
exports.deferredCall = function(fcn) {
|
||||
|
||||
var timer = null;
|
||||
var callback = function() {
|
||||
timer = null;
|
||||
fcn();
|
||||
};
|
||||
|
||||
var deferred = function(timeout) {
|
||||
deferred.cancel();
|
||||
timer = setTimeout(callback, timeout || 0);
|
||||
return deferred;
|
||||
}
|
||||
|
||||
deferred.schedule = deferred;
|
||||
|
||||
deferred.call = function() {
|
||||
this.cancel();
|
||||
fcn();
|
||||
return deferred;
|
||||
};
|
||||
|
||||
deferred.cancel = function() {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
return deferred;
|
||||
};
|
||||
|
||||
return deferred;
|
||||
};
|
||||
|
||||
});
|
||||
31
vendor/ace/defaults.js → vendor/ace/lib/oop.js
vendored
31
vendor/ace/defaults.js → vendor/ace/lib/oop.js
vendored
@@ -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):
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* 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
|
||||
@@ -38,14 +37,24 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var settings = require("ace/settings/default-settings")
|
||||
exports.inherits = (function() {
|
||||
var tempCtor = function() {};
|
||||
return function(ctor, superCtor) {
|
||||
tempCtor.prototype = superCtor.prototype;
|
||||
ctor.super_ = superCtor.prototype;
|
||||
ctor.prototype = new tempCtor();
|
||||
ctor.prototype.constructor = ctor;
|
||||
}
|
||||
}());
|
||||
|
||||
exports.startup = function startup(data, reason) {
|
||||
settings.startup(data, reason)
|
||||
}
|
||||
exports.mixin = function(obj, mixin) {
|
||||
for (var key in mixin) {
|
||||
obj[key] = mixin[key];
|
||||
}
|
||||
};
|
||||
|
||||
exports.shutdown = function shutdown(data, reason) {
|
||||
settings.shutdown(data, reason)
|
||||
}
|
||||
exports.implement = function(proto, mixin) {
|
||||
exports.mixin(proto, mixin);
|
||||
};
|
||||
|
||||
})
|
||||
});
|
||||
105
vendor/ace/lib/useragent.js
vendored
Normal file
105
vendor/ace/lib/useragent.js
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
|
||||
var ua = navigator.userAgent;
|
||||
var av = navigator.appVersion;
|
||||
|
||||
/** Is the user using a browser that identifies itself as Windows */
|
||||
exports.isWin = (os == "win");
|
||||
|
||||
/** Is the user using a browser that identifies itself as Mac OS */
|
||||
exports.isMac = (os == "mac");
|
||||
|
||||
/** Is the user using a browser that identifies itself as Linux */
|
||||
exports.isLinux = (os == "linux");
|
||||
|
||||
exports.isIE =
|
||||
navigator.appName == "Microsoft Internet Explorer"
|
||||
&& parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]);
|
||||
|
||||
exports.isOldIE = exports.isIE && exports.isIE < 9;
|
||||
|
||||
/** Is this Firefox or related? */
|
||||
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
|
||||
|
||||
/** oldGecko == rev < 2.0 **/
|
||||
exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1]) < 4;
|
||||
|
||||
/** Is this Opera */
|
||||
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
|
||||
|
||||
/** Is the user using a browser that identifies itself as WebKit */
|
||||
exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
|
||||
|
||||
exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
|
||||
|
||||
exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
|
||||
|
||||
exports.isIPad = ua.indexOf("iPad") >= 0;
|
||||
|
||||
exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
|
||||
|
||||
/**
|
||||
* I hate doing this, but we need some way to determine if the user is on a Mac
|
||||
* The reason is that users have different expectations of their key combinations.
|
||||
*
|
||||
* Take copy as an example, Mac people expect to use CMD or APPLE + C
|
||||
* Windows folks expect to use CTRL + C
|
||||
*/
|
||||
exports.OS = {
|
||||
LINUX: 'LINUX',
|
||||
MAC: 'MAC',
|
||||
WINDOWS: 'WINDOWS'
|
||||
};
|
||||
|
||||
/**
|
||||
* Return an exports.OS constant
|
||||
*/
|
||||
exports.getOS = function() {
|
||||
if (exports.isMac) {
|
||||
return exports.OS['MAC'];
|
||||
} else if (exports.isLinux) {
|
||||
return exports.OS['LINUX'];
|
||||
} else {
|
||||
return exports.OS['WINDOWS'];
|
||||
}
|
||||
};
|
||||
|
||||
});
|
||||
4
vendor/ace/mode/behaviour/cstyle.js
vendored
4
vendor/ace/mode/behaviour/cstyle.js
vendored
@@ -38,8 +38,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var Behaviour = require('ace/mode/behaviour').Behaviour;
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require('../behaviour').Behaviour;
|
||||
|
||||
var CstyleBehaviour = function () {
|
||||
|
||||
|
||||
6
vendor/ace/mode/behaviour/xml.js
vendored
6
vendor/ace/mode/behaviour/xml.js
vendored
@@ -38,9 +38,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var Behaviour = require('ace/mode/behaviour').Behaviour;
|
||||
var CstyleBehaviour = require('ace/mode/behaviour/cstyle').CstyleBehaviour;
|
||||
var oop = require("../../lib/oop");
|
||||
var Behaviour = require("../behaviour").Behaviour;
|
||||
var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
|
||||
|
||||
var XmlBehaviour = function () {
|
||||
|
||||
|
||||
14
vendor/ace/mode/c_cpp.js
vendored
14
vendor/ace/mode/c_cpp.js
vendored
@@ -38,13 +38,13 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var c_cppHighlightRules = require("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new c_cppHighlightRules().getRules());
|
||||
|
||||
8
vendor/ace/mode/c_cpp_highlight_rules.js
vendored
8
vendor/ace/mode/c_cpp_highlight_rules.js
vendored
@@ -40,10 +40,10 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
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 c_cppHighlightRules = function() {
|
||||
|
||||
|
||||
12
vendor/ace/mode/clojure.js
vendored
12
vendor/ace/mode/clojure.js
vendored
@@ -39,12 +39,12 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var ClojureHighlightRules = require("ace/mode/clojure_highlight_rules").ClojureHighlightRules;
|
||||
var MatchingParensOutdent = require("ace/mode/matching_parens_outdent").MatchingParensOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
|
||||
var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new ClojureHighlightRules().getRules());
|
||||
|
||||
6
vendor/ace/mode/clojure_highlight_rules.js
vendored
6
vendor/ace/mode/clojure_highlight_rules.js
vendored
@@ -39,9 +39,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
|
||||
|
||||
|
||||
20
vendor/ace/mode/coffee.js
vendored
20
vendor/ace/mode/coffee.js
vendored
@@ -37,13 +37,13 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var Rules = require("ace/mode/coffee_highlight_rules").CoffeeHighlightRules;
|
||||
var Outdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
|
||||
var oop = require("pilot/oop");
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
|
||||
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
var TextMode = require("./text").Mode;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
var oop = require("../lib/oop");
|
||||
|
||||
function Mode() {
|
||||
this.$tokenizer = new Tokenizer(new Rules().getRules());
|
||||
@@ -97,7 +97,7 @@ oop.inherits(Mode, TextMode);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace", "pilot"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker");
|
||||
var worker = new WorkerClient(["ace"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("error", function(e) {
|
||||
@@ -106,7 +106,9 @@ oop.inherits(Mode, TextMode);
|
||||
|
||||
worker.on("ok", function(e) {
|
||||
session.clearAnnotations();
|
||||
});
|
||||
});
|
||||
|
||||
return worker;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
6
vendor/ace/mode/coffee/coffee-script.js
vendored
6
vendor/ace/mode/coffee/coffee-script.js
vendored
@@ -37,8 +37,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Lexer = require("ace/mode/coffee/lexer").Lexer;
|
||||
var parser = require("ace/mode/coffee/parser");
|
||||
var Lexer = require("./lexer").Lexer;
|
||||
var parser = require("./parser");
|
||||
|
||||
var lexer = new Lexer();
|
||||
parser.lexer = {
|
||||
@@ -55,7 +55,7 @@ define(function(require, exports, module) {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
parser.yy = require('ace/mode/coffee/nodes');
|
||||
parser.yy = require('./nodes');
|
||||
|
||||
exports.parse = function(code) {
|
||||
return parser.parse(lexer.tokenize(code));
|
||||
|
||||
4
vendor/ace/mode/coffee/lexer.js
vendored
4
vendor/ace/mode/coffee/lexer.js
vendored
@@ -32,8 +32,8 @@ define(function(require, exports, module) {
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
Rewriter = require('ace/mode/coffee/rewriter').Rewriter;
|
||||
_ref = require('ace/mode/coffee/helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last;
|
||||
Rewriter = require('./rewriter').Rewriter;
|
||||
_ref = require('./helpers'), count = _ref.count, starts = _ref.starts, compact = _ref.compact, last = _ref.last;
|
||||
exports.Lexer = Lexer = (function() {
|
||||
function Lexer() {}
|
||||
Lexer.prototype.tokenize = function(code, opts) {
|
||||
|
||||
4
vendor/ace/mode/coffee/nodes.js
vendored
4
vendor/ace/mode/coffee/nodes.js
vendored
@@ -38,8 +38,8 @@ define(function(require, exports, module) {
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
Scope = require('ace/mode/coffee/scope').Scope;
|
||||
_ref = require('ace/mode/coffee/helpers'), compact = _ref.compact, flatten = _ref.flatten, extend = _ref.extend, merge = _ref.merge, del = _ref.del, starts = _ref.starts, ends = _ref.ends, last = _ref.last;
|
||||
Scope = require('./scope').Scope;
|
||||
_ref = require('./helpers'), compact = _ref.compact, flatten = _ref.flatten, extend = _ref.extend, merge = _ref.merge, del = _ref.del, starts = _ref.starts, ends = _ref.ends, last = _ref.last;
|
||||
exports.extend = extend;
|
||||
YES = function() {
|
||||
return true;
|
||||
|
||||
6
vendor/ace/mode/coffee/parser_test.js
vendored
6
vendor/ace/mode/coffee/parser_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var assert = require("ace/test/assertions");
|
||||
var coffee = require("ace/mode/coffee/coffee-script");
|
||||
var assert = require("../../test/assertions");
|
||||
var coffee = require("../coffee/coffee-script");
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
2
vendor/ace/mode/coffee/scope.js
vendored
2
vendor/ace/mode/coffee/scope.js
vendored
@@ -25,7 +25,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
var Scope, extend, last, _ref;
|
||||
_ref = require('ace/mode/coffee/helpers'), extend = _ref.extend, last = _ref.last;
|
||||
_ref = require('./helpers'), extend = _ref.extend, last = _ref.last;
|
||||
exports.Scope = Scope = (function() {
|
||||
Scope.root = null;
|
||||
function Scope(parent, expressions, method) {
|
||||
|
||||
6
vendor/ace/mode/coffee_highlight_rules.js
vendored
6
vendor/ace/mode/coffee_highlight_rules.js
vendored
@@ -37,9 +37,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var lang = require("pilot/lang");
|
||||
var oop = require("pilot/oop");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var lang = require("../lib/lang");
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
oop.inherits(CoffeeHighlightRules, TextHighlightRules);
|
||||
|
||||
|
||||
6
vendor/ace/mode/coffee_tokenizer_test.js
vendored
6
vendor/ace/mode/coffee_tokenizer_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Mode = require("ace/mode/coffee").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var Mode = require("./coffee").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
|
||||
6
vendor/ace/mode/coffee_worker.js
vendored
6
vendor/ace/mode/coffee_worker.js
vendored
@@ -37,9 +37,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var Mirror = require("ace/worker/mirror").Mirror;
|
||||
var coffee = require("ace/mode/coffee/coffee-script");
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var coffee = require("../mode/coffee/coffee-script");
|
||||
|
||||
window.addEventListener = function() {};
|
||||
|
||||
|
||||
14
vendor/ace/mode/coldfusion.js
vendored
14
vendor/ace/mode/coldfusion.js
vendored
@@ -37,13 +37,13 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var CssMode = require("ace/mode/css").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var ColdfusionHighlightRules = require("ace/mode/coldfusion_highlight_rules").ColdfusionHighlightRules;
|
||||
var XmlBehaviour = require("ace/mode/behaviour/xml").XmlBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var CssMode = require("./css").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
|
||||
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new ColdfusionHighlightRules();
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
||||
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var ColdfusionHighlightRules = function() {
|
||||
|
||||
|
||||
10
vendor/ace/mode/coldfusion_test.js
vendored
10
vendor/ace/mode/coldfusion_test.js
vendored
@@ -36,15 +36,15 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Range = require("ace/range").Range;
|
||||
var ColdfusionMode = require("ace/mode/coldfusion").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var Range = require("../range").Range;
|
||||
var ColdfusionMode = require("./coldfusion").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
|
||||
12
vendor/ace/mode/csharp.js
vendored
12
vendor/ace/mode/csharp.js
vendored
@@ -1,11 +1,11 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var CSharpHighlightRules = require("ace/mode/csharp_highlight_rules").CSharpHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new CSharpHighlightRules().getRules());
|
||||
|
||||
8
vendor/ace/mode/csharp_highlight_rules.js
vendored
8
vendor/ace/mode/csharp_highlight_rules.js
vendored
@@ -1,9 +1,9 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
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 CSharpHighlightRules = function() {
|
||||
|
||||
|
||||
15
vendor/ace/mode/css.js
vendored
15
vendor/ace/mode/css.js
vendored
@@ -37,12 +37,12 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new CssHighlightRules().getRules());
|
||||
@@ -78,7 +78,7 @@ oop.inherits(Mode, TextMode);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace", "pilot"], "worker-css.js", "ace/mode/css_worker", "Worker");
|
||||
var worker = new WorkerClient(["ace"], "worker-css.js", "ace/mode/css_worker", "Worker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("csslint", function(e) {
|
||||
@@ -95,6 +95,7 @@ oop.inherits(Mode, TextMode);
|
||||
|
||||
session.setAnnotations(errors);
|
||||
});
|
||||
return worker;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
6
vendor/ace/mode/css_highlight_rules.js
vendored
6
vendor/ace/mode/css_highlight_rules.js
vendored
@@ -37,9 +37,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var CssHighlightRules = function() {
|
||||
|
||||
|
||||
8
vendor/ace/mode/css_test.js
vendored
8
vendor/ace/mode/css_test.js
vendored
@@ -36,14 +36,14 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var CssMode = require("ace/mode/css").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var CssMode = require("./css").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
6
vendor/ace/mode/css_tokenizer_test.js
vendored
6
vendor/ace/mode/css_tokenizer_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var CssMode = require("ace/mode/css").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var CssMode = require("./css").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
6
vendor/ace/mode/css_worker.js
vendored
6
vendor/ace/mode/css_worker.js
vendored
@@ -37,9 +37,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var Mirror = require("ace/worker/mirror").Mirror;
|
||||
var CSSLint = require("ace/mode/css/csslint").CSSLint;
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var CSSLint = require("./css/csslint").CSSLint;
|
||||
|
||||
var Worker = exports.Worker = function(sender) {
|
||||
Mirror.call(this, sender);
|
||||
|
||||
6
vendor/ace/mode/css_worker_test.js
vendored
6
vendor/ace/mode/css_worker_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var assert = require("ace/test/assertions");
|
||||
var Worker = require("ace/mode/css_worker").Worker;
|
||||
var assert = require("../test/assertions");
|
||||
var Worker = require("./css_worker").Worker;
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var DocCommentHighlightRules = function() {
|
||||
|
||||
|
||||
12
vendor/ace/mode/groovy.js
vendored
12
vendor/ace/mode/groovy.js
vendored
@@ -1,11 +1,11 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var GroovyHighlightRules = require("ace/mode/groovy_highlight_rules").GroovyHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new GroovyHighlightRules().getRules());
|
||||
|
||||
8
vendor/ace/mode/groovy_highlight_rules.js
vendored
8
vendor/ace/mode/groovy_highlight_rules.js
vendored
@@ -1,9 +1,9 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
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 GroovyHighlightRules = function() {
|
||||
|
||||
|
||||
56
vendor/ace/mode/haxe.js
vendored
Normal file
56
vendor/ace/mode/haxe.js
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new HaxeHighlightRules().getRules());
|
||||
this.$outdent = new MatchingBraceOutdent();
|
||||
this.$behaviour = new CstyleBehaviour();
|
||||
};
|
||||
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;
|
||||
var endState = tokenizedLine.state;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
this.createWorker = function(session) {
|
||||
return null;
|
||||
};
|
||||
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
103
vendor/ace/mode/haxe_highlight_rules.js
vendored
Normal file
103
vendor/ace/mode/haxe_highlight_rules.js
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
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 HaxeHighlightRules = function() {
|
||||
|
||||
var keywords = lang.arrayToMap(
|
||||
("break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std").split("|")
|
||||
);
|
||||
|
||||
var buildinConstants = lang.arrayToMap(
|
||||
("null|true|false").split("|")
|
||||
);
|
||||
|
||||
|
||||
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [
|
||||
{
|
||||
token : "comment",
|
||||
regex : "\\/\\/.*$"
|
||||
},
|
||||
new 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 : function(value) {
|
||||
if (value == "this")
|
||||
return "variable.language";
|
||||
else if (keywords.hasOwnProperty(value))
|
||||
return "keyword";
|
||||
else if (buildinConstants.hasOwnProperty(value))
|
||||
return "constant.language";
|
||||
else
|
||||
return "identifier";
|
||||
},
|
||||
// TODO: Unicode escape sequences
|
||||
// TODO: Unicode identifiers
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
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-",
|
||||
[ new DocCommentHighlightRules().getEndRule("start") ]);
|
||||
};
|
||||
|
||||
oop.inherits(HaxeHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.HaxeHighlightRules = HaxeHighlightRules;
|
||||
});
|
||||
14
vendor/ace/mode/html.js
vendored
14
vendor/ace/mode/html.js
vendored
@@ -37,13 +37,13 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var CssMode = require("ace/mode/css").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var HtmlHighlightRules = require("ace/mode/html_highlight_rules").HtmlHighlightRules;
|
||||
var XmlBehaviour = require("ace/mode/behaviour/xml").XmlBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var CssMode = require("./css").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new HtmlHighlightRules();
|
||||
|
||||
10
vendor/ace/mode/html_highlight_rules.js
vendored
10
vendor/ace/mode/html_highlight_rules.js
vendored
@@ -37,10 +37,10 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
||||
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var HtmlHighlightRules = function() {
|
||||
|
||||
@@ -195,4 +195,4 @@ var HtmlHighlightRules = function() {
|
||||
oop.inherits(HtmlHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.HtmlHighlightRules = HtmlHighlightRules;
|
||||
});
|
||||
});
|
||||
|
||||
10
vendor/ace/mode/html_test.js
vendored
10
vendor/ace/mode/html_test.js
vendored
@@ -36,15 +36,15 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Range = require("ace/range").Range;
|
||||
var HtmlMode = require("ace/mode/html").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var Range = require("../range").Range;
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
|
||||
8
vendor/ace/mode/html_tokenizer_test.js
vendored
8
vendor/ace/mode/html_tokenizer_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var HtmlMode = require("ace/mode/html").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
@@ -62,7 +62,7 @@ module.exports = {
|
||||
assert.equal("text", tokens[4].type);
|
||||
assert.equal("string", tokens[5].type);
|
||||
assert.equal("text", tokens[6].type);
|
||||
assert.equal("keyword", tokens[7].type);
|
||||
assert.equal("keyword.definition", tokens[7].type);
|
||||
assert.equal("text", tokens[8].type);
|
||||
assert.equal("meta.tag", tokens[9].type);
|
||||
assert.equal("text", tokens[10].type);
|
||||
|
||||
12
vendor/ace/mode/java.js
vendored
12
vendor/ace/mode/java.js
vendored
@@ -1,11 +1,11 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var JavaHighlightRules = require("ace/mode/java_highlight_rules").JavaHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new JavaHighlightRules().getRules());
|
||||
|
||||
8
vendor/ace/mode/java_highlight_rules.js
vendored
8
vendor/ace/mode/java_highlight_rules.js
vendored
@@ -1,9 +1,9 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
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 JavaHighlightRules = function() {
|
||||
|
||||
|
||||
20
vendor/ace/mode/javascript.js
vendored
20
vendor/ace/mode/javascript.js
vendored
@@ -37,14 +37,14 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var WorkerClient = require("ace/worker/worker_client").WorkerClient;
|
||||
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new JavaScriptHighlightRules().getRules());
|
||||
@@ -125,8 +125,8 @@ oop.inherits(Mode, TextMode);
|
||||
};
|
||||
|
||||
this.createWorker = function(session) {
|
||||
var worker = new WorkerClient(["ace", "pilot"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
var worker = new WorkerClient(["ace"], "worker-javascript.js", "ace/mode/javascript_worker", "JavaScriptWorker");
|
||||
worker.attachToDocument(session.getDocument());
|
||||
|
||||
worker.on("jslint", function(results) {
|
||||
var errors = [];
|
||||
|
||||
10
vendor/ace/mode/javascript_highlight_rules.js
vendored
10
vendor/ace/mode/javascript_highlight_rules.js
vendored
@@ -38,11 +38,11 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var unicode = require("ace/unicode");
|
||||
var DocCommentHighlightRules = require("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var unicode = require("../unicode");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var JavaScriptHighlightRules = function() {
|
||||
|
||||
|
||||
12
vendor/ace/mode/javascript_test.js
vendored
12
vendor/ace/mode/javascript_test.js
vendored
@@ -36,15 +36,15 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var EditSession = require("../edit_session").EditSession;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
setUp : function() {
|
||||
@@ -141,7 +141,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
"test: auto outdent should indent the line with the same indent as the line with the matching opening brace" : function() {
|
||||
var session = new EditSession([" function foo() {", " bla", " }"]);
|
||||
var session = new EditSession([" function foo() {", " bla", " }"], new JavaScriptMode());
|
||||
this.mode.autoOutdent("start", session, 2);
|
||||
assert.equal(" }", session.getLine(2));
|
||||
},
|
||||
|
||||
8
vendor/ace/mode/javascript_tokenizer_test.js
vendored
8
vendor/ace/mode/javascript_tokenizer_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var assert = require("ace/test/assertions");
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var assert = require("../test/assertions");
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -62,7 +62,7 @@ module.exports = {
|
||||
assert.equal("text", tokens[1].type);
|
||||
assert.equal("keyword.operator", tokens[2].type);
|
||||
assert.equal("text", tokens[3].type);
|
||||
assert.equal("keyword", tokens[4].type);
|
||||
assert.equal("keyword.definition", tokens[4].type);
|
||||
},
|
||||
|
||||
"test: tokenize doc comment" : function() {
|
||||
|
||||
46
vendor/ace/mode/javascript_worker.js
vendored
46
vendor/ace/mode/javascript_worker.js
vendored
@@ -1,9 +1,45 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var Mirror = require("ace/worker/mirror").Mirror;
|
||||
//var lint = require("ace/worker/jslint").JSLINT;
|
||||
var lint = require("ace/worker/jshint").JSHINT;
|
||||
var oop = require("../lib/oop");
|
||||
var Mirror = require("../worker/mirror").Mirror;
|
||||
var lint = require("../worker/jshint").JSHINT;
|
||||
|
||||
var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
|
||||
Mirror.call(this, sender);
|
||||
@@ -19,7 +55,7 @@ oop.inherits(JavaScriptWorker, Mirror);
|
||||
value = value.replace(/^#!.*\n/, "\n");
|
||||
|
||||
// var start = new Date();
|
||||
var parser = require("ace/narcissus/jsparse");
|
||||
var parser = require("../narcissus/jsparse");
|
||||
try {
|
||||
parser.parse(value);
|
||||
} catch(e) {
|
||||
|
||||
6
vendor/ace/mode/javascript_worker_test.js
vendored
6
vendor/ace/mode/javascript_worker_test.js
vendored
@@ -36,13 +36,13 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
if (typeof process !== "undefined") {
|
||||
require("../../../support/paths");
|
||||
require("amd-loader");
|
||||
}
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var assert = require("ace/test/assertions");
|
||||
var JavaScriptWorker = require("ace/mode/javascript_worker").JavaScriptWorker;
|
||||
var assert = require("../test/assertions");
|
||||
var JavaScriptWorker = require("./javascript_worker").JavaScriptWorker;
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
14
vendor/ace/mode/json.js
vendored
14
vendor/ace/mode/json.js
vendored
@@ -37,13 +37,13 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var HighlightRules = require("ace/mode/json_highlight_rules").JsonHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var CstyleBehaviour = require("ace/mode/behaviour/cstyle").CstyleBehaviour;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new HighlightRules().getRules());
|
||||
|
||||
6
vendor/ace/mode/json_highlight_rules.js
vendored
6
vendor/ace/mode/json_highlight_rules.js
vendored
@@ -38,9 +38,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var JsonHighlightRules = function() {
|
||||
|
||||
|
||||
10
vendor/ace/mode/latex.js
vendored
10
vendor/ace/mode/latex.js
vendored
@@ -1,10 +1,10 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var LatexHighlightRules = require("ace/mode/latex_highlight_rules").LatexHighlightRules;
|
||||
var Range = require("ace/range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function()
|
||||
{
|
||||
|
||||
4
vendor/ace/mode/latex_highlight_rules.js
vendored
4
vendor/ace/mode/latex_highlight_rules.js
vendored
@@ -1,7 +1,7 @@
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var LatexHighlightRules = function()
|
||||
{
|
||||
|
||||
10
vendor/ace/mode/lua.js
vendored
10
vendor/ace/mode/lua.js
vendored
@@ -38,11 +38,11 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var LuaHighlightRules = require("ace/mode/lua_highlight_rules").LuaHighlightRules;
|
||||
var Range = require("ace/range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new LuaHighlightRules().getRules());
|
||||
|
||||
6
vendor/ace/mode/lua_highlight_rules.js
vendored
6
vendor/ace/mode/lua_highlight_rules.js
vendored
@@ -39,9 +39,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var LuaHighlightRules = function() {
|
||||
|
||||
|
||||
16
vendor/ace/mode/markdown.js
vendored
16
vendor/ace/mode/markdown.js
vendored
@@ -40,14 +40,14 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var XmlMode = require("ace/mode/xml").Mode;
|
||||
var HtmlMode = require("ace/mode/html").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var MarkdownHighlightRules = require("ace/mode/markdown_highlight_rules").MarkdownHighlightRules;
|
||||
var Range = require("ace/range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var JavaScriptMode = require("./javascript").Mode;
|
||||
var XmlMode = require("./xml").Mode;
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new MarkdownHighlightRules();
|
||||
|
||||
12
vendor/ace/mode/markdown_highlight_rules.js
vendored
12
vendor/ace/mode/markdown_highlight_rules.js
vendored
@@ -38,12 +38,12 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var XmlHighlightRules = require("ace/mode/xml_highlight_rules").XmlHighlightRules;
|
||||
var HtmlHighlightRules = require("ace/mode/html_highlight_rules").HtmlHighlightRules;
|
||||
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
|
||||
|
||||
function github_embed(tag, prefix) {
|
||||
return { // Github style block
|
||||
|
||||
2
vendor/ace/mode/matching_brace_outdent.js
vendored
2
vendor/ace/mode/matching_brace_outdent.js
vendored
@@ -37,7 +37,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Range = require("ace/range").Range;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingBraceOutdent = function() {};
|
||||
|
||||
|
||||
2
vendor/ace/mode/matching_parens_outdent.js
vendored
2
vendor/ace/mode/matching_parens_outdent.js
vendored
@@ -37,7 +37,7 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var Range = require("ace/range").Range;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var MatchingParensOutdent = function() {};
|
||||
|
||||
|
||||
12
vendor/ace/mode/ocaml.js
vendored
12
vendor/ace/mode/ocaml.js
vendored
@@ -37,12 +37,12 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var OcamlHighlightRules = require("ace/mode/ocaml_highlight_rules").OcamlHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new OcamlHighlightRules().getRules());
|
||||
|
||||
6
vendor/ace/mode/ocaml_highlight_rules.js
vendored
6
vendor/ace/mode/ocaml_highlight_rules.js
vendored
@@ -39,9 +39,9 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var lang = require("pilot/lang");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var oop = require("../lib/oop");
|
||||
var lang = require("../lib/lang");
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var OcamlHighlightRules = function() {
|
||||
|
||||
|
||||
12
vendor/ace/mode/perl.js
vendored
12
vendor/ace/mode/perl.js
vendored
@@ -37,12 +37,12 @@
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var PerlHighlightRules = require("ace/mode/perl_highlight_rules").PerlHighlightRules;
|
||||
var MatchingBraceOutdent = require("ace/mode/matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("ace/range").Range;
|
||||
var oop = require("../lib/oop");
|
||||
var TextMode = require("./text").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
|
||||
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||
var Range = require("../range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
this.$tokenizer = new Tokenizer(new PerlHighlightRules().getRules());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user