Compare commits

..

1 commit

Author SHA1 Message Date
nightwing
974ecccfc5 add elixir mode converted from textmate
(needs further modifications)
2013-06-05 15:43:26 +04:00
877 changed files with 61192 additions and 166002 deletions

2
.gitignore vendored
View file

@ -2,11 +2,9 @@
.DS_Store
*.swp
*.tmp
*~
# Project files that should not be in the repo
.*
\#*
!/.gitignore
.*.gz
*.tmTheme.js

4
.gitmodules vendored
View file

@ -1,6 +1,6 @@
[submodule "doc/wiki"]
path = doc/wiki
url = https://github.com/ajaxorg/ace.wiki.git
url = git://github.com/ajaxorg/ace.wiki.git
[submodule "build"]
path = build
url = https://github.com/ajaxorg/ace-builds.git
url = git://github.com/ajaxorg/ace-builds.git

1
CNAME
View file

@ -1 +0,0 @@
ace.c9.io

View file

@ -7,9 +7,16 @@ Feel free to fork and improve/enhance Ace any way you want. If you feel that the
There are two versions of the agreement:
1. [The Individual CLA](https://docs.google.com/a/c9.io/forms/d/1MfmfrxqD_PNlNsuK0lC2KSelRLxGLGfh_wEcG0ijVvo/viewform): use this version if you're working on the Cloud9 SDK or open source projects in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://docs.google.com/a/c9.io/forms/d/1vFejn4111GdnCNuQ6BfnJDaxdsUEMD4KCo1ayovAfu0/viewform): have your corporate lawyer review and submit this if your company is going to be contributing to the Cloud9 SDK and/or open source projects.
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
If you want to contribute to the Cloud9 SDK and/or open source projects please go to the online form, fill it out and submit it.
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email.
Happy coding, Cloud9
Email: ace+cla@c9.io
Fax: +31 (0) 206388953
Address: Ajax.org B.V.
Keizersgracht 241
1016 EA, Amsterdam
the Netherlands

View file

@ -1,103 +1,4 @@
Version 1.2.0-pre
* New Features
- Indented soft wrap (danyaPostfactum)
* API Changes
- unified delta types `{start, end, action, lines}` (Alden Daniels https://github.com/ajaxorg/ace/pull/1745)
- "change" event listeners on session and editor get delta objects directly
2015.04.03 Version 1.1.9
- Small Enhancements and Bugfixes
2014.11.08 Version 1.1.8
* API Changes
- `editor.commands.commandKeyBinding` now contains direct map from keys to commands instead of grouping them by hashid
* New Features
- Improved autoindent for html and php modes (Adam Jimenez)
- Find All from searchbox (Colton Voege)
* new language modes
- Elixir, Elm
2014.09.21 Version 1.1.7
* Bugfixes
- fix several bugs in autocompletion
- workaround for inaccurate getBoundingClientRect on chrome 37
2014.08.17 Version 1.1.6
* Bugfixes
- fix regression in double tap to highlight
- Improved Latex Mode (Daniel Felder)
* API Changes
- editor.destroy destroys editor.session too (call editor.setSession(null) to prevent that)
* new language modes
- Praat (José Joaquín Atria)
- Eiffel (Victorien Elvinger)
- G-code (Adam Joseph Cook)
2014.07.09 Version 1.1.5
* Bugfixes
- fix regression in autocomplete popup
* new language modes
- gitignore (Devon Carew)
2014.07.01 Version 1.1.4
* New Features
- Highlight matching tags (Adam Jimenez)
- Improved jump to matching command (Adam Jimenez)
* new language modes
- AppleScript (Yaogang Lian)
- Vala
2014.03.08 Version 1.1.3
* New Features
- Allow syntax checkers to be loaded from CDN (Derk-Jan Hartman)
- Add ColdFusion behavior (Abram Adams)
- add showLineNumbers option
- Add html syntax checker (danyaPostfactum)
* new language modes
- Gherkin (Patrick Nevels)
- Smarty
2013.12.02 Version 1.1.2
* New Features
- Accessibility Theme for Ace (Peter Xiao)
- use snipetManager for expanding emmet snippets
- update jshint to 2.1.4
- improve php syntax checker (jdalegonzalez)
- add option for autoresizing
- add option for autohiding vertical scrollbar
- improvements to highlighting of xml like languages (danyaPostfactum)
- add support for autocompletion and snippets (gjtorikyan danyaPostfactum and others)
- add option to merge similar changes in undo history
- add scrollPastEnd option
- use html5 dragndrop for text dragging (danyaPostfactum)
* API Changes
- fixed typo in HashHandler commmandManager
* new language modes
- Nix (Zef Hemel)
- Protobuf (Zef Hemel)
- Soy
- Handlebars
2013.06.04 Version 1.1.1
2013.06.04 Version 1.1.01
- Improved emacs keybindings (Robert Krahn)
- Added markClean, isClean methods to UndoManager (Joonsoo Jeon)

View file

@ -13,17 +13,7 @@ pre_build:
build: pre_build
./Makefile.dryice.js normal
./Makefile.dryice.js demo
# Minimal build: call Makefile.dryice.js only if our sources changed
basic: build/src/ace.js
build/src/ace.js : ${wildcard lib/*} \
${wildcard lib/*/*} \
${wildcard lib/*/*/*} \
${wildcard lib/*/*/*/*} \
${wildcard lib/*/*/*/*/*} \
${wildcard lib/*/*/*/*/*/*}
./Makefile.dryice.js
./Makefile.dryice.js bm
doc:
cd doc;\

View file

@ -31,23 +31,22 @@
var fs = require("fs");
var path = require("path");
var copy = require('architect-build/copy');
var build = require('architect-build/build');
if (!fs.existsSync)
fs.existsSync = path.existsSync;
else
path.existsSync = fs.existsSync;
var copy = require('dryice').copy;
var ACE_HOME = __dirname;
var BUILD_DIR = ACE_HOME + "/build";
var CACHE = {};
function main(args) {
if (args.indexOf("updateModes") !== -1) {
return updateModes();
}
var type = "minimal";
args = args.map(function(x) {
if (x[0] == "-" && x[1] != "-")
return "-" + x;
return x;
}).filter(Boolean);
});
if (args[2] && (args[2][0] != "-" || args[2].indexOf("h") != -1))
type = args[2];
@ -67,24 +66,22 @@ function main(args) {
ace();
} else if (type == "demo") {
demo();
} else if (type == "bm") {
bookmarklet();
} else if (type == "full") {
ace();
demo();
} else if (type == "highlighter") {
// TODO
demo(ace());
bookmarklet();
}
}
}
function showHelp(type) {
console.log("--- Ace Dryice Build Tool ---");
console.log("");
console.log("Options:");
console.log(" minimal Places necessary Ace files out in build dir; uses configuration flags below [default]");
console.log(" normal Runs four Ace builds--minimal, minimal-noconflict, minimal-min, and minimal-noconflict-min");
console.log(" demo Runs demo build of Ace");
console.log(" full all of above");
console.log(" highlighter ");
console.log(" minimal Places necessary Ace files out in build dir; uses configuration flags below [default]");
console.log(" normal Runs four Ace builds--minimal, minimal-noconflict, minimal-min, and minimal-noconflict-min");
console.log(" demo Runs demo build of Ace");
console.log(" bm Runs bookmarklet build of Ace");
console.log(" full all of above");
console.log("args:");
console.log(" --target ./path path to build folder");
console.log("flags:");
@ -93,34 +90,94 @@ function showHelp(type) {
console.log(" --nc namespace require");
console.log(" --s shrinkwrap (combines all output files into one)");
console.log("");
if (type)
console.log(" output for " + type + " generated in " + BUILD_DIR);
if (BUILD_DIR)
console.log(" output generated in " + type + __dirname + "/" + BUILD_DIR)
}
function bookmarklet() {
var targetDir = BUILD_DIR + "/textarea";
copy({
source: "build_support/editor_textarea.html",
dest: targetDir + '/editor.html'
});
copy({
source: "build_support/style.css",
dest: targetDir + '/style.css'
});
buildAce({
targetDir: targetDir + "/src",
ns: "__ace_shadowed__",
exportModule: "ace/ext/textarea",
compress: false,
noconflict: true,
suffix: "",
name: "ace-bookmarklet",
workers: [],
keybindings: []
});
}
function ace() {
console.log('# ace ---------');
// uncompressed
var project = buildAce({
compress: false,
noconflict: false
});
buildAce({
compress: false,
noconflict: true
});
// compressed
buildAce({
compress: true,
noconflict: false
});
buildAce({
compress: true,
noconflict: true
});
console.log('# ace License | Readme | Changelog ---------');
copy.file(ACE_HOME + "/build_support/editor.html", BUILD_DIR + "/editor.html");
copy.file(ACE_HOME + "/LICENSE", BUILD_DIR + "/LICENSE");
copy.file(ACE_HOME + "/ChangeLog.txt", BUILD_DIR + "/ChangeLog.txt");
copy({
source: ACE_HOME + "/build_support/editor.html",
dest: BUILD_DIR + "/editor.html"
});
copy({
source: ACE_HOME + "/LICENSE",
dest: BUILD_DIR + "/LICENSE"
});
copy({
source: ACE_HOME + "/ChangeLog.txt",
dest: BUILD_DIR + "/ChangeLog.txt"
});
console.log('# ace ---------');
for (var i = 0; i < 4; i++)
buildAce({compress: i & 2, noconflict: i & 1});
return project;
}
function demo() {
function demo(project) {
project = project || buildAce({
compress: false,
noconflict: false,
coreOnly: true
});
console.log('# kitchen sink ---------');
var version = "", ref = "";
var version, ref;
try {
version = JSON.parse(fs.readFileSync(ACE_HOME + "/package.json")).version;
ref = fs.readFileSync(ACE_HOME + "/.git-ref").toString();
} catch(e) {}
} catch(e) {
ref = "";
version = "";
}
function changeComments(data) {
return (data
.replace("doc/site/images/ace-logo.png", "demo/kitchen-sink/ace-logo.png")
.replace(/<!\-\-DEVEL[\d\D]*?DEVEL\-\->/g, "")
.replace(/PACKAGE\-\->|<!\-\-PACKAGE/g, "")
.replace(/\/\*DEVEL[\d\D]*?DEVEL\*\//g, "")
@ -128,55 +185,49 @@ function demo() {
.replace("%version%", version)
.replace("%commit%", ref)
);
};
function fixDocPaths(data) {
return data.replace(/"(demo|build)\//g, "\"");
}
copy(ACE_HOME +"/demo/kitchen-sink/docs/", BUILD_DIR + "/demo/kitchen-sink/docs/");
copy.file(ACE_HOME + "/demo/kitchen-sink/logo.png", BUILD_DIR + "/demo/kitchen-sink/logo.png");
copy.file(ACE_HOME + "/demo/kitchen-sink/styles.css", BUILD_DIR + "/demo/kitchen-sink/styles.css");
copy.file(ACE_HOME + "/kitchen-sink.html", BUILD_DIR + "/kitchen-sink.html", changeComments);
buildSubmodule({}, {
require: ["kitchen-sink/demo"],
projectType: "demo"
}, BUILD_DIR + "/demo/kitchen-sink/demo");
copy(ACE_HOME + "/demo/", BUILD_DIR + "/demo/", {
shallow: true,
exclude: /\s|requirejs/,
include: /\.(js|html)$/,
replace: function(source) {
if (!/^\s*</.test(source))
return source;
var removeRequireJS;
source = source.replace(/<script src="kitchen-sink\/require.js"[\s\S]+?require\(\[([^\]]+).*/, function(e, m) {
removeRequireJS = true;
var scripts = m.split(/,\s*/);
var result = [];
function comment(str) {result.push("<!-- " + str + " -->")}
function script(str) {result.push('<script src="../src/' + str + '.js"></script>')}
scripts.forEach(function(s) {
s = s.replace(/"/g, "");
if (s == "ace/ace") {
comment("load ace");
script("ace");
} else {
var extName = s.match(/[^/]*$/)[0];
comment("load ace " + extName + " extension");
script("ext-" + extName);
}
});
result.push("<script>");
return result.join("\n");
});
if (removeRequireJS)
source = source.replace(/\s*\}\);?\s*(<\/script>)/, "\n$1");
source = source.replace(/"\.\.\/build\//g, function(e) {
console.log(e); return '"../';
});
return source;
}
copy({
source: ACE_HOME + "/kitchen-sink.html",
dest: BUILD_DIR + "/kitchen-sink.html",
filter: [changeComments, fixDocPaths]
});
copy({
source: ACE_HOME + "/demo/kitchen-sink/styles.css",
dest: BUILD_DIR + "/kitchen-sink/styles.css",
filter: [ changeComments ]
});
fs.readdirSync(ACE_HOME +"/demo/kitchen-sink/docs/").forEach(function(x) {
copy({
source: ACE_HOME +"/demo/kitchen-sink/docs/" + x,
dest: BUILD_DIR + "/kitchen-sink/docs/" + x
});
});
var demo = copy.createDataObject();
project.assumeAllFilesLoaded();
copy({
source: [{
project: cloneProject(project),
require: [ "kitchen-sink/demo" ]
}],
filter: getWriteFilters({filters:[fixDocPaths]}, "demo"),
dest: demo
});
copy({
source: demo,
dest: BUILD_DIR + "/kitchen-sink/demo.js",
});
copyFileSync(ACE_HOME + "/demo/kitchen-sink/logo.png", BUILD_DIR + "/kitchen-sink/logo.png");
}
function jsFileList(path, filter) {
@ -185,350 +236,255 @@ function jsFileList(path, filter) {
filter = /_test/;
return fs.readdirSync(path).map(function(x) {
if (x.slice(-3) == ".js" && !filter.test(x) && !/\s|BASE|(\b|_)dummy(\b|_)/.test(x))
if (x.slice(-3) == ".js" && !filter.test(x) && !/\s/.test(x))
return x.slice(0, -3);
}).filter(Boolean);
}).filter(function(x){ return !!x });
}
function workers(path) {
return jsFileList(path).map(function(x) {
if (x.slice(-7) == "_worker")
return x.slice(0, -7);
}).filter(function(x) { return !!x; });
return jsFileList(path).map(function(x) {
if (x.slice(-7) == "_worker")
return x.slice(0, -7);
}).filter(function(x) { return !!x; });
}
function modeList() {
return jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour|completions/);
}
function buildAceModule(opts, callback) {
// calling buildAceModuleInternal many times in parallel is slow, so we use queue
if (!buildAceModule.queue) {
buildAceModule.queue = [];
buildAceModule.dequeue = function() {
if (buildAceModule.running) return;
var call = buildAceModule.queue.shift();
buildAceModule.running = call;
if (call)
buildAceModuleInternal.apply(null, call);
};
}
buildAceModule.queue.push([opts, function(err, result) {
callback && callback(err, result);
buildAceModule.running = null;
buildAceModule.dequeue();
}]);
if (!buildAceModule.running) {
buildAceModule.dequeue();
} else {
process.nextTick(buildAceModule.dequeue);
function addSuffix(options) {
if (options.suffix == null) {
options.suffix = "";
if (options.compress)
options.suffix += "-min";
if (options.noconflict)
options.suffix += "-noconflict";
}
}
function buildAceModuleInternal(opts, callback) {
var cache = opts.cache == undefined ? CACHE : opts.cache;
var key = opts.require + "|" + opts.projectType;
if (cache && cache.configs && cache.configs[key])
return write(null, cache.configs[key]);
var pathConfig = {
paths: {
ace: ACE_HOME + "/lib/ace",
"kitchen-sink": ACE_HOME + "/demo/kitchen-sink",
build_support: ACE_HOME + "/build_support",
},
root: ACE_HOME
function getWriteFilters(options, projectType) {
var filters = [
copy.filter.moduleDefines,
removeUseStrict,
removeLicenceComments,
inlineTextModules
];
if (options.filters)
filters = filters.concat(options.filters);
if (options.noconflict)
filters.push(namespace(options.ns));
if (options.compress)
filters.push(copy.filter.uglifyjs);
if (options.exportModule && projectType == "main") {
if (options.noconflict)
filters.push(exportAce(options.ns, options.exportModule, options.ns));
else
filters.push(exportAce(options.ns, options.exportModule));
}
return filters;
}
var buildAce = function(options) {
var aceProject = {
roots: [ACE_HOME + '/lib', ACE_HOME + '/demo'],
textPluginPattern: /^ace\/requirejs\/text!/
};
function write(err, result) {
if (cache && key && !(cache.configs && cache.configs[key])) {
cache.configs = cache.configs || Object.create(null);
cache.configs[key] = result;
result.sources = result.sources.map(function(pkg) {
return {deps: pkg.deps};
});
}
if (!opts.outputFile)
return callback(err, result);
var code = result.code;
if (opts.compress) {
if (!result.codeMin)
result.codeMin = compress(result.code);
code = result.codeMin;
}
var targetDir = BUILD_DIR + "/src";
if (opts.compress)
targetDir += "-min";
if (opts.noconflict)
targetDir += "-noconflict";
var to = /^([\\/]|\w:)/.test(opts.outputFile)
? opts.outputFile
: path.join(opts.outputFolder || targetDir, opts.outputFile);
var filters = [];
var ns = opts.ns || "ace";
if (opts.filters)
filters = filters.concat(opts.filters);
if (opts.noconflict)
filters.push(namespace(ns));
var projectType = opts.projectType;
if (projectType == "main" || projectType == "ext") {
filters.push(exportAce(ns, opts.require[0],
opts.noconflict ? ns : "", projectType == "ext"));
}
filters.forEach(function(f) { code = f(code); });
build.writeToFile({code: code}, {
outputFolder: path.dirname(to),
outputFile: path.basename(to),
}, function() {});
callback && callback(err, result);
}
build(opts.require, {
cache: cache,
quiet: opts.quiet,
pathConfig: pathConfig,
additional: opts.additional,
enableBrowser: true,
keepDepArrays: "all",
noArchitect: true,
var defaults = {
targetDir: BUILD_DIR + "/src",
ns: "ace",
exportModule: "ace/ace",
requires: null,
compress: false,
ignore: opts.ignore || [],
withRequire: false,
basepath: ACE_HOME,
transforms: [normalizeLineEndings],
afterRead: [optimizeTextModules]
}, write);
}
noconflict: false,
suffix: null,
name: "ace",
modes: jsFileList("lib/ace/mode", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour/),
themes: jsFileList("lib/ace/theme"),
extensions: jsFileList("lib/ace/ext"),
workers: workers("lib/ace/mode"),
keybindings: ["vim", "emacs"]
};
function buildCore(options, extra, callback) {
options = extend(extra, options);
options.additional = [{
id: "build_support/mini_require",
order: -1000,
literal: true
}];
options.require =["ace/ace"];
options.projectType = "main";
options.ns = "ace";
buildAceModule(options, callback);
}
for(var key in defaults)
if (!options.hasOwnProperty(key))
options[key] = defaults[key];
generateThemesModule(options.themes);
function buildSubmodule(options, extra, file, callback) {
options = extend(extra, options);
getLoadedFileList(options, function(coreFiles) {
options.outputFile = file + ".js";
options.ignore = options.ignore || coreFiles;
options.quiet = true;
buildAceModule(options, callback);
});
}
addSuffix(options);
function buildAce(options) {
var snippetFiles = jsFileList("lib/ace/snippets");
var modeNames = modeList();
if (!options.requires)
options.requires = [options.exportModule];
buildCore(options, {outputFile: "ace.js"}),
// modes
modeNames.forEach(function(name) {
buildSubmodule(options, {
projectType: "mode",
require: ["ace/mode/" + name]
}, "mode-" + name);
var targetDir = options.targetDir + options.suffix;
var name = options.name;
var project = copy.createCommonJsProject(aceProject);
var ace = copy.createDataObject();
copy({
source: [ACE_HOME + "/build_support/mini_require.js"],
dest: ace
});
// snippets
modeNames.forEach(function(name) {
if (snippetFiles.indexOf(name + ".js") == -1)
addSnippetFile(name);
buildSubmodule(options, {
require: ["ace/snippets/" + name],
}, "snippets/" + name);
copy({
source: [{
project: project,
require: options.requires
}],
filter: [ copy.filter.moduleDefines ],
dest: ace
});
// themes
jsFileList("lib/ace/theme").forEach(function(name) {
buildSubmodule(options, {
projectType: "theme",
require: ["ace/theme/" + name]
}, "theme-" + name);
if (options.coreOnly)
return project;
copy({
source: ace,
filter: getWriteFilters(options, "main"),
dest: targetDir + '/' + name + ".js"
});
// keybindings
["vim", "emacs"].forEach(function(name) {
buildSubmodule(options, {
projectType: "keybinding",
require: ["ace/keyboard/" + name ]
}, "keybinding-" + name);
});
// extensions
jsFileList("lib/ace/ext").forEach(function(name) {
buildSubmodule(options, {
projectType: "ext",
require: ["ace/ext/" + name]
}, "ext-" + name);
});
// workers
workers("lib/ace/mode").forEach(function(name) {
buildSubmodule(options, {
projectType: "worker",
require: ["ace/mode/" + name + "_worker"],
ignore: [],
additional: [{
id: "ace/worker/worker",
transforms: [],
order: -1000
console.log('# ace modes ---------');
project.assumeAllFilesLoaded();
options.modes.forEach(function(mode) {
console.log("mode " + mode);
copy({
source: [{
project: cloneProject(project),
require: [ 'ace/mode/' + mode ]
}],
}, "worker-" + name);
filter: getWriteFilters(options, "mode"),
dest: targetDir + "/mode-" + mode + ".js"
});
});
}
function getLoadedFileList(options, callback, result) {
if (!result) {
return buildCore({}, {}, function(e, result) {
getLoadedFileList(options, callback, result);
console.log('# ace themes ---------');
project.assumeAllFilesLoaded();
options.themes.forEach(function(theme) {
console.log("theme " + theme);
copy({
source: [{
project: cloneProject(project),
require: ["ace/theme/" + theme]
}],
filter: getWriteFilters(options, "theme"),
dest: targetDir + "/theme-" + theme.replace("_theme", "") + ".js"
});
});
console.log('# ace extensions ---------');
project.assumeAllFilesLoaded();
options.extensions.forEach(function(ext) {
console.log("extensions " + ext);
copy({
source: [{
project: cloneProject(project),
require: [ 'ace/ext/' + ext ]
}],
filter: getWriteFilters(options, "ext"),
dest: targetDir + "/ext-" + ext + ".js"
});
});
console.log('# ace key bindings ---------');
// copy key bindings
project.assumeAllFilesLoaded();
options.keybindings.forEach(function(keybinding) {
copy({
source: [{
project: cloneProject(project),
require: [ 'ace/keyboard/' + keybinding ]
}],
filter: getWriteFilters(options, "keybinding"),
dest: targetDir + "/keybinding-" + keybinding + ".js"
});
});
console.log('# ace worker ---------');
options.workers.forEach(function(mode) {
console.log("worker for " + mode + " mode");
var worker = copy.createDataObject();
var workerProject = copy.createCommonJsProject({
roots: [ ACE_HOME + '/lib' ],
textPluginPattern: /^ace\/requirejs\/text!/
});
copy({
source: [{
project: workerProject,
require: [
'ace/worker/worker',
'ace/mode/' + mode + '_worker'
]
}],
filter: getWriteFilters(options, "worker"),
dest: worker
});
copy({
source: [
worker
],
filter: options.compress ? [copy.filter.uglifyjs] : [],
dest: targetDir + "/worker-" + mode + ".js"
});
});
if (options.shrinkwrap) {
console.log('# combining files into one ---------');
copy({
source: { root:targetDir, exclude:/(^|\\|\/)worker\-[^\\\/]*\.js$/ },
dest: BUILD_DIR + '/ace-min.js'
});
}
var deps = Object.create(null);
result.sources.forEach(function(pkg) {
pkg.deps && pkg.deps.forEach(function(p) {
if (!deps[p]) deps[p] = 1;
});
});
delete deps["ace/theme/textmate"];
callback(Object.keys(deps));
}
function normalizeLineEndings(module) {
module.source = module.source.replace(/\r\n/g, "\n");
}
function optimizeTextModules(sources) {
var textModules = {};
return sources.filter(function(pkg) {
if (!pkg.id) {
return true;
}
else if (pkg.id.indexOf("text!") > -1) {
detectTextModules(pkg);
return false;
}
else {
pkg.source = rewriteTextImports(pkg.source, pkg.deps);
return true;
}
}).map(function(pkg) {
if (pkg && pkg.deps) {
pkg.deps = pkg.deps && pkg.deps.filter(function(p) {
return p.indexOf("text!") == -1;
});
}
return pkg;
});
function rewriteTextImports(text, deps) {
return text.replace(/ require\(['"](?:ace|[.\/]+)\/requirejs\/text!(.*?)['"]\)/g, function(_, call) {
if (call) {
var dep;
deps.some(function(d) {
if (d.split("/").pop() == call.split("/").pop()) {
dep = d;
return true;
}
});
return project;
};
// silence annoying messages from dryice
var buildAce = function(fn) {
return function() {
var log = console.log
console.log = function() {
if (typeof arguments[0] == "string" && /Ignoring requirement/.test(arguments[0]))
return;
log.apply(console, arguments);
}
var ret = fn.apply(null, arguments);
console.log = log;
return ret;
}
}(buildAce);
var textModules = {}
var detectTextModules = function(input, source) {
if (!source)
throw new Error('Missing filename for text module');
if (typeof input !== 'string')
input = input.toString();
var module = source.isLocation ? source.path : source;
call = textModules[dep];
if (call)
return " " + call;
}
});
input = input.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
if (/\.css$/.test(module)) {
// remove unnecessary whitespace from css
input = input.replace(/\n\s+/g, "\n");
input = '"' + input.replace(/\r?\n/g, '\\\n') + '"';
} else {
// but don't break other files!
input = '"' + input.replace(/\r?\n/g, '\\n\\\n') + '"';
}
function detectTextModules(pkg) {
var input = pkg.source.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
if (/\.css$/.test(pkg.id)) {
// remove unnecessary whitespace from css
input = input.replace(/\n\s+/g, "\n");
input = '"' + input.replace(/\n/g, '\\\n') + '"';
} else {
// but don't break other files!
input = '"' + input.replace(/\n/g, '\\n\\\n') + '"';
}
textModules[pkg.id] = input;
}
}
textModules[module] = input;
function namespace(ns) {
return function(text) {
text = text
.toString()
.replace(/ACE_NAMESPACE\s*=\s*""/, 'ACE_NAMESPACE = "' + ns +'"')
.replace(/(\.define)|\bdefine\(/g, function(_, a) {
return a || ns + ".define(";
});
return text;
};
}
function exportAce(ns, modules, requireBase, extModules) {
requireBase = requireBase || "window";
return function(text) {
/*globals REQUIRE_NS, MODULES, NS*/
var template = function() {
(function() {
REQUIRE_NS.require(MODULES, function(a) {
a && a.config.init(true);
if (!window.NS)
window.NS = a;
for (var key in a) if (a.hasOwnProperty(key))
window.NS[key] = a[key];
});
})();
};
if (extModules) {
template = function() {
(function() {
REQUIRE_NS.require(MODULES, function() {});
})();
};
}
text = text.replace(/function init\(packaged\) {/, "init(true);$&\n");
if (typeof modules == "string")
modules = [modules];
return (text.replace(/;\s*$/, "") + ";" + template
.toString()
.replace(/MODULES/g, JSON.stringify(modules))
.replace(/REQUIRE_NS/g, requireBase)
.replace(/NS/g, ns)
.slice(13, -1)
);
};
}
function updateModes() {
modeList().forEach(function(m) {
var filepath = __dirname + "/lib/ace/mode/" + m + ".js";
var source = fs.readFileSync(filepath, "utf8");
if (!/this.\$id\s*=\s*"/.test(source))
source = source.replace(/\n([ \t]*)(\}\).call\(\w*Mode.prototype\))/, '\n$1 this.$id = "";\n$1$2');
source = source.replace(/(this.\$id\s*=\s*)"[^"]*"/, '$1"ace/mode/' + m + '"');
fs.writeFileSync(filepath, source, "utf8");
});
}
return "";
};
detectTextModules.onRead = true;
copy.filter.addDefines = detectTextModules;
function generateThemesModule(themes) {
var themelist = [
@ -536,33 +492,118 @@ function generateThemesModule(themes) {
'\n\nmodule.exports.themes = ' + JSON.stringify(themes, null, ' '),
';\n\n});'
].join('');
fs.writeFileSync(__dirname + '/lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8');
fs.writeFileSync('./lib/ace/ext/themelist_utils/themes.js', themelist, 'utf8');
}
function addSnippetFile(modeName) {
var snippetFilePath = ACE_HOME + "/lib/ace/snippets/" + modeName;
if (!fs.existsSync(snippetFilePath + ".js")) {
copy.file(ACE_HOME + "/tool/templates/snippets.js", snippetFilePath + ".js", function(t) {
return t.replace(/%modeName%/g, modeName);
});
}
if (!fs.existsSync(snippetFilePath + ".snippets")) {
fs.writeFileSync(snippetFilePath + ".snippets", "");
}
}
function compress(text) {
var ujs = require("dryice").copy.filter.uglifyjs;
ujs.options.mangle_toplevel = {except: ["ACE_NAMESPACE", "requirejs"]};
ujs.options.beautify = {ascii_only: true, inline_script: true}
return ujs(text);
}
function extend(base, extra) {
Object.keys(extra).forEach(function(k) {
base[k] = extra[k];
function inlineTextModules(text) {
var lastDep = "";
return text.replace(/, *['"]ace\/requirejs\/text!(.*?)['"]|= *require\(['"](?:ace|[.\/]+)\/requirejs\/text!(.*?)['"]\)/g, function(_, dep, call) {
if (dep) {
if (!lastDep) {
lastDep = dep;
return "";
}
} else if (call) {
call = textModules[lastDep];
delete textModules[lastDep];
lastDep = "";
if (call)
return "= " + call;
}
console.log(dep, lastDep, call);
throw "inlining of multiple text modules is not supported";
});
return base;
}
// TODO: replace with project.clone once it is fixed in dryice
function cloneProject(project) {
var clone = copy.createCommonJsProject({
roots: project.roots,
ignores: project.ignoreRequires,
textPluginPattern: project.textPluginPattern
});
Object.keys(project.currentModules).forEach(function(module) {
clone.currentModules[module] = project.currentModules[module];
});
Object.keys(project.ignoredModules).forEach(function(module) {
clone.ignoredModules[module] = project.ignoredModules[module];
});
return clone;
}
function copyFileSync(srcFile, destFile) {
var BUF_LENGTH = 64*1024,
buf = new Buffer(BUF_LENGTH),
bytesRead = BUF_LENGTH,
pos = 0,
fdr = null,
fdw = null;
fdr = fs.openSync(srcFile, 'r');
fdw = fs.openSync(destFile, 'w');
while (bytesRead === BUF_LENGTH) {
bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
fs.writeSync(fdw, buf, 0, bytesRead);
pos += bytesRead;
}
fs.closeSync(fdr);
fs.closeSync(fdw);
}
function quoteString(str) {
return '"' + str.replace(/\\/, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\\n") + '"';
}
function removeUseStrict(text) {
return text.replace(/['"]use strict['"];/g, "");
}
function removeLicenceComments(text) {
return text.replace(/(?:(;)|\n)\s*\/\*[\d\D]*?\*\/|\n\s*\/\/.*/g, "$1");
}
function namespace(ns) {
return function(text) {
text = text
.toString()
.replace('var ACE_NAMESPACE = "";', 'var ACE_NAMESPACE = "' + ns +'";')
.replace(/\bdefine\(/g, ns + ".define(");
return text;
};
}
function exportAce(ns, module, requireBase) {
requireBase = requireBase || "window";
module = module || "ace/ace";
return function(text) {
var template = function() {
(function() {
REQUIRE_NS.require(["MODULE"], function(a) {
a && a.config.init();
if (!window.NS)
window.NS = {};
for (var key in a) if (a.hasOwnProperty(key))
NS[key] = a[key];
});
})();
};
return (text + ";" + template
.toString()
.replace(/MODULE/g, module)
.replace(/REQUIRE_NS/g, requireBase)
.replace(/NS/g, ns)
.slice(13, -1)
);
};
}
if (!module.parent)

View file

@ -1,14 +1,14 @@
Ace (Ajax.org Cloud9 Editor)
============================
_Note_: The new site at http://ace.c9.io contains all the info below along with an embedding guide and all the other resources you need to get started with Ace.
_Note_: The new site at http://ace.ajax.org contains all the info below along with an embedding guide and all the other resources you need to get started with Ace.
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](https://c9.io/) and the successor of the Mozilla Skywriter (Bespin) Project.
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
Features
--------
* Syntax highlighting for over 110 languages (TextMate/Sublime/_.tmlanguage_ files can be imported)
* Syntax highlighting for over 40 languages (TextMate/Sublime/_.tmlanguage_ files can be imported)
* Over 20 themes (TextMate/Sublime/_.tmtheme_ files can be imported)
* Automatic indent and outdent
* An optional command line
@ -28,9 +28,9 @@ Features
Take Ace for a spin!
--------------------
Check out the Ace live [demo](http://ace.c9.io/build/kitchen-sink.html) or get a [Cloud9 IDE account](https://c9.io/) to experience Ace while editing one of your own GitHub projects.
Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/kitchen-sink.html) or get a [Cloud9 IDE account](http://c9.io) to experience Ace while editing one of your own GitHub projects.
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.io/ace/build/demo/bookmarklet/index.html).
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
Embedding Ace
-------------
@ -79,16 +79,16 @@ By default the editor only supports plain text mode; many other languages are av
The mode can then be used like this:
```javascript
var JavaScriptMode = ace.require("ace/mode/javascript").Mode;
var JavaScriptMode = require("ace/mode/javascript").Mode;
editor.getSession().setMode(new JavaScriptMode());
```
Documentation
-------------
Additional usage information, including events to listen to and extending syntax highlighters, can be found [on the main Ace website](http://ace.c9.io).
Additional usage information, including events to listen to and extending syntax highlighters, can be found [on the main Ace website](http://ace.ajax.org).
You can also find API documentation at [http://ace.c9.io/#nav=api](http://ace.c9.io/#nav=api).
You can also find API documentation at [http://ajaxorg.github.com/ace/api/index.html](http://ajaxorg.github.com/ace/api/index.html).
Also check out the sample code for the kitchen sink [demo app](https://github.com/ajaxorg/ace/blob/master/demo/kitchen-sink/demo.js).
@ -112,7 +112,7 @@ Or using Node.JS
The editor can then be opened at http://localhost:8888/kitchen-sink.html.
To open the editor with a file:/// URL see [the wiki](https://github.com/ajaxorg/ace/wiki/Running-Ace-from-file).
To open the editor with a file:/// URL see [the wiki](https://github.com/ajaxorg/ace/wiki/Running-Ace-from-a-file:).
Building Ace
-----------

View file

@ -243,7 +243,7 @@
</ul>
</div>
<div class="sideToggler">
<div id="ellipsis_Document.getAllLines" class="ellipsis_description"><p>Returns all lines in the document as string array.</p>
<div id="ellipsis_Document.getAllLines" class="ellipsis_description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p>
</div>
<div class="description"><p>Returns all lines in the document as string array. Warning: The caller should not modify this array!</p>

View file

@ -390,8 +390,8 @@
</div>
<div class="description"><p>Creates a new <code>Editor</code> object.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">renderer</td><td class="argType"><a href="virtual_renderer.html" class="" title="VirtualRenderer (class)" data-id="VirtualRenderer">VirtualRenderer</a></td><td class="argDescription "><p>Required. Associated <code>VirtualRenderer</code> that draws everything</p>
</td></tr><tr class="argumentRow "><td class="argName ">session</td><td class="argType"><a href="edit_session.html" class="" title="EditSession (class)" data-id="EditSession">EditSession</a></td><td class="argDescription "><p>Required. The <code>EditSession</code> to refer to</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">renderer</td><td class="argType" "><a href="virtual_renderer.html" class="" title="VirtualRenderer (class)" data-id="VirtualRenderer">VirtualRenderer</a></td><td class="argDescription "><p>Required. Associated <code>VirtualRenderer</code> that draws everything</p>
</td></tr><tr class="argumentRow "><td class="argName ">session</td><td class="argType" "><a href="edit_session.html" class="" title="EditSession (class)" data-id="EditSession">EditSession</a></td><td class="argDescription "><p>Required. The <code>EditSession</code> to refer to</p>
</td></tr></table>
</div>
</div>
@ -444,7 +444,7 @@
</div>
<div class="description"><p>Emitted whenever the document is changed.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">e</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. Contains a single property, <code>data</code>, which has the delta of changes</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">e</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. Contains a single property, <code>data</code>, which has the delta of changes</p>
</td></tr></table>
</div>
</div>
@ -471,7 +471,7 @@
</div>
<div class="description"><p>Emitted when the selection style changes, via <a href="#Editor.setSelectionStyle" class="link-short" title="Editor.setSelectionStyle (class method)" data-id="Editor.setSelectionStyle"><code>Editor.setSelectionStyle()</code></a>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">data</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. Contains one property, <code>data</code>, which indicates the new selection style</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">data</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. Contains one property, <code>data</code>, which indicates the new selection style</p>
</td></tr></table>
</div>
</div>
@ -498,7 +498,7 @@
</div>
<div class="description"><p>Emitted whenever the <a href="edit_session.html" class="link-short" title="EditSession (class)" data-id="EditSession"><code>EditSession</code></a> changes.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">e</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object with two properties, <code>oldSession</code> and <code>session</code>, that represent the old and new <a href="edit_session.html" class="link-short" title="EditSession (class)" data-id="EditSession"><code>EditSession</code></a>s.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">e</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object with two properties, <code>oldSession</code> and <code>session</code>, that represent the old and new <a href="edit_session.html" class="link-short" title="EditSession (class)" data-id="EditSession"><code>EditSession</code></a>s.</p>
</td></tr></table>
</div>
</div>
@ -525,7 +525,7 @@
</div>
<div class="description"><p>Emitted when text is copied.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The copied text</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The copied text</p>
</td></tr></table>
</div>
</div>
@ -564,7 +564,7 @@
<ul class="signatures">
<li class="signature">
<ul>
<li class="signature-call"><span class="eventObjName">Editor</span><span class="eventListenerStart">.on("</span><span id="Editor.event.paste" class="member-name eventMember methodClicker">paste</span><span class="eventListenerClose">", </span><span class="eventFunctionOpen">function(</span><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="argument methodClicker" title="Object" data-id="Object">Object</a> e<span class="eventFunctionClose">))</span></li>
<li class="signature-call"><span class="eventObjName">Editor</span><span class="eventListenerStart">.on("</span><span id="Editor.event.paste" class="member-name eventMember methodClicker">paste</span><span class="eventListenerClose">", </span><span class="eventFunctionOpen">function(</span><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="argument methodClicker" title="String" data-id="String">String</a> text<span class="eventFunctionClose">))</span></li>
</ul>
<ul class="metaInfo">
</ul>
@ -577,7 +577,7 @@
</div>
<div class="description"><p>Emitted when text is pasted.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">e</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object which contains one property, <code>text</code>, that represents the text to be pasted. Editing this property will alter the text that is pasted.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The pasted text</p>
</td></tr></table>
</div>
</div>
@ -610,7 +610,7 @@
</div>
<div class="description"><p>Adds the selection and cursor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">orientedRange</td><td class="argType"><a href="range.html" class="" title="Range (class)" data-id="Range">Range</a></td><td class="argDescription "><p>Required. A range containing a cursor</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">orientedRange</td><td class="argType" "><a href="range.html" class="" title="Range (class)" data-id="Range">Range</a></td><td class="argDescription "><p>Required. A range containing a cursor</p>
</td></tr></table>
</div>
</div>
@ -920,9 +920,9 @@
</div>
<div class="description"><p>Attempts to find <code>needle</code> within the document. For more information on <code>options</code>, see <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">needle</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The text to search for (optional)</p>
</td></tr><tr class="argumentRow "><td class="argName ">options</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object defining various search properties</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animate scrolling</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">needle</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The text to search for (optional)</p>
</td></tr><tr class="argumentRow "><td class="argName ">options</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object defining various search properties</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animate scrolling</p>
</td></tr></table>
</div>
</div>
@ -954,9 +954,9 @@
</div>
<div class="description"><p>Finds and selects all the occurences of <code>needle</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">The</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. text to find</p>
</td></tr><tr class="argumentRow "><td class="argName ">The</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. search options</p>
</td></tr><tr class="argumentRow "><td class="argName ">keeps</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. </p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">The</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. text to find</p>
</td></tr><tr class="argumentRow "><td class="argName ">The</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. search options</p>
</td></tr><tr class="argumentRow "><td class="argName ">keeps</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. </p>
</td></tr></table>
</div>
</div>
@ -983,8 +983,8 @@
</div>
<div class="description"><p>Performs another search for <code>needle</code> in the document. For more information on <code>options</code>, see <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">options</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. search options</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animate scrolling</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">options</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. search options</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animate scrolling</p>
</td></tr></table>
</div>
</div>
@ -1011,8 +1011,8 @@
</div>
<div class="description"><p>Performs a search for <code>needle</code> backwards. For more information on <code>options</code>, see <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">options</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. search options</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animate scrolling</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">options</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. search options</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animate scrolling</p>
</td></tr></table>
</div>
</div>
@ -1064,8 +1064,8 @@
</div>
<div class="description"><p>Executes a command for each selection range.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">cmd</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The command to execute</p>
</td></tr><tr class="argumentRow "><td class="argName ">args</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. Any arguments for the command</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">cmd</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The command to execute</p>
</td></tr><tr class="argumentRow "><td class="argName ">args</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. Any arguments for the command</p>
</td></tr></table>
</div>
</div>
@ -1523,8 +1523,8 @@
</div>
<div class="description"><p>Works like <a href="#nav=api&api=edit_session" class="link-short" title="EditSession.getTokenAt (class method)" data-id="EditSession.getTokenAt"><code>EditSession.getTokenAt()</code></a>, except it returns a number.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
</td></tr></table>
</div>
</div>
@ -1966,9 +1966,9 @@
</div>
<div class="description"><p>Moves the cursor to the specified line number, and also into the indiciated column.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">lineNumber</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The line number to go to</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A column number to go to</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animates scolling</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">lineNumber</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The line number to go to</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A column number to go to</p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animates scolling</p>
</td></tr></table>
</div>
</div>
@ -2070,7 +2070,7 @@
</div>
<div class="description"><p>Inserts <code>text</code> into wherever the cursor is pointing.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new text to add</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new text to add</p>
</td></tr></table>
</div>
</div>
@ -2132,7 +2132,7 @@
</div>
<div class="description"><p>Indicates if the entire row is currently visible on the screen.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The row to check</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The row to check</p>
</td></tr></table>
</div>
</div>
@ -2164,7 +2164,7 @@
</div>
<div class="description"><p>Indicates if the row is currently visible on the screen.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The row to check</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The row to check</p>
</td></tr></table>
</div>
</div>
@ -2191,7 +2191,7 @@
</div>
<div class="description"><p>Moves the cursor&#39;s row and column to the next matching bracket.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">select</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">select</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
</td></tr></table>
</div>
</div>
@ -2218,7 +2218,7 @@
</div>
<div class="description"><p>If the character before the cursor is a number, this functions changes its value by <code>amount</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">amount</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The value to change the numeral by (can be negative to decrease value)</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">amount</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The value to change the numeral by (can be negative to decrease value)</p>
</td></tr></table>
</div>
</div>
@ -2245,8 +2245,8 @@
</div>
<div class="description"><p>Moves the cursor to the specified row and column. Note that this does not de-select the current selection.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new row number</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new column number</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new row number</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new column number</p>
</td></tr></table>
</div>
</div>
@ -2273,7 +2273,7 @@
</div>
<div class="description"><p>Moves the cursor to the position indicated by <code>pos.row</code> and <code>pos.column</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">pos</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object with two properties, row and column</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">pos</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. An object with two properties, row and column</p>
</td></tr></table>
</div>
</div>
@ -2384,7 +2384,7 @@
</div>
<div class="description"><p>Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
</td></tr></table>
</div>
</div>
@ -2461,7 +2461,7 @@
</div>
<div class="description"><p>Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
</td></tr></table>
</div>
</div>
@ -2538,7 +2538,7 @@
</div>
<div class="description"><p>Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
</td></tr></table>
</div>
</div>
@ -2565,8 +2565,8 @@
</div>
<div class="description"><p>Moves the cursor to the specified row and column. Note that this does de-select the current selection.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new row number</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new column number</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new row number</p>
</td></tr><tr class="argumentRow "><td class="argName ">column</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The new column number</p>
</td></tr></table>
</div>
</div>
@ -2593,7 +2593,7 @@
</div>
<div class="description"><p>Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">times</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The number of times to change navigation</p>
</td></tr></table>
</div>
</div>
@ -3105,7 +3105,7 @@
</div>
<div class="description"><p>Called whenever a text &quot;paste&quot; happens.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The pasted text</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">text</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The pasted text</p>
</td></tr></table>
</div>
</div>
@ -3277,7 +3277,7 @@
</div>
<div class="description"><p>Removes words of text from the editor. A &quot;word&quot; is defined as a string of characters bookended by whitespace.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The direction of the deletion to occur, either &quot;left&quot; or &quot;right&quot;</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The direction of the deletion to occur, either &quot;left&quot; or &quot;right&quot;</p>
</td></tr></table>
</div>
</div>
@ -3329,7 +3329,7 @@
</div>
<div class="description"><p>Removes the selection marker.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">The</td><td class="argType"><a href="range.html" class="" title="Range (class)" data-id="Range">Range</a></td><td class="argDescription "><p>Required. selection range added with <a href="#nav=api&api=multi_select" class="link-short" title="Editor.addSelectionMarker (class method)" data-id="Editor.addSelectionMarker"><code>addSelectionMarker()</code></a>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">The</td><td class="argType" "><a href="range.html" class="" title="Range (class)" data-id="Range">Range</a></td><td class="argDescription "><p>Required. selection range added with <a href="#nav=api&api=multi_select" class="link-short" title="Editor.addSelectionMarker (class method)" data-id="Editor.addSelectionMarker"><code>addSelectionMarker()</code></a>.</p>
</td></tr></table>
</div>
</div>
@ -3456,8 +3456,8 @@
</div>
<div class="description"><p>Replaces the first occurance of <code>options.needle</code> with the value in <code>replacement</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">replacement</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The text to replace with</p>
</td></tr><tr class="argumentRow "><td class="argName ">options</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. The <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a> options to use</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">replacement</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The text to replace with</p>
</td></tr><tr class="argumentRow "><td class="argName ">options</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. The <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a> options to use</p>
</td></tr></table>
</div>
</div>
@ -3484,8 +3484,8 @@
</div>
<div class="description"><p>Replaces all occurances of <code>options.needle</code> with the value in <code>replacement</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">replacement</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The text to replace with</p>
</td></tr><tr class="argumentRow "><td class="argName ">options</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. The <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a> options to use</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">replacement</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The text to replace with</p>
</td></tr><tr class="argumentRow "><td class="argName ">options</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. The <a href="search.html" class="link-short" title="Search (class)" data-id="Search"><code>Search</code></a> options to use</p>
</td></tr></table>
</div>
</div>
@ -3512,7 +3512,7 @@
</div>
<div class="description"><p>Triggers a resize of the editor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">force</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code>, recomputes the size, even if the height and width haven&#39;t changed</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">force</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code>, recomputes the size, even if the height and width haven&#39;t changed</p>
</td></tr></table>
</div>
</div>
@ -3613,10 +3613,10 @@
</div>
<div class="description"><p>Scrolls to a line. If <code>center</code> is <code>true</code>, it puts the line in middle of screen (or attempts to).</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">line</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The line to scroll to</p>
</td></tr><tr class="argumentRow "><td class="argName ">center</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code></p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animates scrolling</p>
</td></tr><tr class="argumentRow "><td class="argName ">callback</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function" class="" title="Function" data-id="Function">Function</a></td><td class="argDescription "><p>Required. Function to be called when the animation has finished</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">line</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The line to scroll to</p>
</td></tr><tr class="argumentRow "><td class="argName ">center</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code></p>
</td></tr><tr class="argumentRow "><td class="argName ">animate</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code> animates scrolling</p>
</td></tr><tr class="argumentRow "><td class="argName ">callback</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function" class="" title="Function" data-id="Function">Function</a></td><td class="argDescription "><p>Required. Function to be called when the animation has finished</p>
</td></tr></table>
</div>
</div>
@ -3643,7 +3643,7 @@
</div>
<div class="description"><p>Moves the editor to the specified row.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">row</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
</td></tr></table>
</div>
</div>
@ -3695,8 +3695,8 @@
</div>
<div class="description"><p>Finds the next occurence of text in an active selection and adds it to the selections.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The direction of lines to select: -1 for up, 1 for down</p>
</td></tr><tr class="argumentRow "><td class="argName ">skip</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code>, removes the active selection range</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The direction of lines to select: -1 for up, 1 for down</p>
</td></tr><tr class="argumentRow "><td class="argName ">skip</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code>, removes the active selection range</p>
</td></tr></table>
</div>
</div>
@ -3723,8 +3723,8 @@
</div>
<div class="description"><p>Adds a cursor above or below the active cursor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The direction of lines to select: -1 for up, 1 for down</p>
</td></tr><tr class="argumentRow "><td class="argName ">skip</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code>, removes the active selection range</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The direction of lines to select: -1 for up, 1 for down</p>
</td></tr><tr class="argumentRow "><td class="argName ">skip</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. If <code>true</code>, removes the active selection range</p>
</td></tr></table>
</div>
</div>
@ -3825,7 +3825,7 @@
</div>
<div class="description"><p>Specifies whether to use behaviors or not. &quot;Behaviors&quot; in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">enabled</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Enables or disables behaviors</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">enabled</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Enables or disables behaviors</p>
</td></tr></table>
</div>
</div>
@ -3876,7 +3876,7 @@
</div>
<div class="description"><p>Sets the delay (in milliseconds) of the mouse drag.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dragDelay</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A value indicating the new delay</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dragDelay</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A value indicating the new delay</p>
</td></tr></table>
</div>
</div>
@ -3927,7 +3927,7 @@
</div>
<div class="description"><p>Set a new font size (in pixels) for the editor text.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">size</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A font size</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">size</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A font size</p>
</td></tr></table>
</div>
</div>
@ -3954,7 +3954,7 @@
</div>
<div class="description"><p>Determines whether or not the current line should be highlighted.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">shouldHighlight</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Set to <code>true</code> to highlight the current line</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">shouldHighlight</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Set to <code>true</code> to highlight the current line</p>
</td></tr></table>
</div>
</div>
@ -4005,7 +4005,7 @@
</div>
<div class="description"><p>Determines if the currently selected word should be highlighted.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">shouldHighlight</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Set to <code>true</code> to highlight the currently selected word</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">shouldHighlight</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Set to <code>true</code> to highlight the currently selected word</p>
</td></tr></table>
</div>
</div>
@ -4032,7 +4032,7 @@
</div>
<div class="description"><p>Sets a new key handler, such as &quot;vim&quot; or &quot;windows&quot;.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">keyboardHandler</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new key handler</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">keyboardHandler</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new key handler</p>
</td></tr></table>
</div>
</div>
@ -4059,7 +4059,7 @@
</div>
<div class="description"><p>Pass in <code>true</code> to enable overwrites in your session, or <code>false</code> to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of <code>overwrite</code> changes, this function also emites the <code>changeOverwrite</code> event.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">overwrite</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Defines wheter or not to set overwrites</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">overwrite</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Defines wheter or not to set overwrites</p>
</td></tr></table>
</div>
</div>
@ -4086,7 +4086,7 @@
</div>
<div class="description"><p>Sets the column defining where the print margin should be.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">showPrintMargin</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. Specifies the new print margin</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">showPrintMargin</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. Specifies the new print margin</p>
</td></tr></table>
</div>
</div>
@ -4113,7 +4113,7 @@
</div>
<div class="description"><p>If <code>readOnly</code> is true, then the editor is set to read-only mode, and none of the content can change.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">readOnly</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether the editor can be modified or not</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">readOnly</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether the editor can be modified or not</p>
</td></tr></table>
</div>
</div>
@ -4140,7 +4140,7 @@
</div>
<div class="description"><p>Sets how fast the mouse scrolling should do.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">speed</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A value indicating the new speed (in milliseconds)</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">speed</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. A value indicating the new speed (in milliseconds)</p>
</td></tr></table>
</div>
</div>
@ -4170,7 +4170,7 @@
although this code change in the future.</p>
<p>This function also emits the <code>&#39;changeSelectionStyle&#39;</code> event.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">style</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new selection style</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">style</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new selection style</p>
</td></tr></table>
</div>
</div>
@ -4197,7 +4197,7 @@ although this code change in the future.</p>
</div>
<div class="description"><p>Sets a new editsession to use. This method also emits the <code>&#39;changeSession&#39;</code> event.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">session</td><td class="argType"><a href="edit_session.html" class="" title="EditSession (class)" data-id="EditSession">EditSession</a></td><td class="argDescription "><p>Required. The new session to use</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">session</td><td class="argType" "><a href="edit_session.html" class="" title="EditSession (class)" data-id="EditSession">EditSession</a></td><td class="argDescription "><p>Required. The new session to use</p>
</td></tr></table>
</div>
</div>
@ -4224,7 +4224,7 @@ although this code change in the future.</p>
</div>
<div class="description"><p>Indicates whether the fold widgets are shown or not.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">show</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether the fold widgets are shown</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">show</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether the fold widgets are shown</p>
</td></tr></table>
</div>
</div>
@ -4251,7 +4251,7 @@ although this code change in the future.</p>
</div>
<div class="description"><p>If <code>showInvisibles</code> is set to <code>true</code>, invisible characters&mdash;like spaces or new lines&mdash;are show in the editor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">showInvisibles</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether or not to show invisible characters</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">showInvisibles</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether or not to show invisible characters</p>
</td></tr></table>
</div>
</div>
@ -4278,7 +4278,7 @@ although this code change in the future.</p>
</div>
<div class="description"><p>If <code>showPrintMargin</code> is set to <code>true</code>, the print margin is shown in the editor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">showPrintMargin</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether or not to show the print margin</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">showPrintMargin</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Specifies whether or not to show the print margin</p>
</td></tr></table>
</div>
</div>
@ -4305,7 +4305,7 @@ although this code change in the future.</p>
</div>
<div class="description"><p>Adds a new class, <code>style</code>, to the editor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">style</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. A class name</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">style</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. A class name</p>
</td></tr></table>
</div>
</div>
@ -4332,7 +4332,7 @@ although this code change in the future.</p>
</div>
<div class="description"><p>Sets a new theme for the editor. <code>theme</code> should exist, and be a directory path, like <code>ace/theme/textmate</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">theme</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The path to a theme</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">theme</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The path to a theme</p>
</td></tr></table>
</div>
</div>
@ -4364,8 +4364,8 @@ although this code change in the future.</p>
</div>
<div class="description"><p>Sets the current document to <code>val</code>.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">val</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new value to set for the document</p>
</td></tr><tr class="argumentRow "><td class="argName ">cursorPos</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. Where to set the new value. <code>undefined</code> or 0 is selectAll, -1 is at the document start, and 1 is at the end</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">val</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String" class="" title="String" data-id="String">String</a></td><td class="argDescription "><p>Required. The new value to set for the document</p>
</td></tr><tr class="argumentRow "><td class="argName ">cursorPos</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. Where to set the new value. <code>undefined</code> or 0 is selectAll, -1 is at the document start, and 1 is at the end</p>
</td></tr></table>
</div>
</div>
@ -4394,7 +4394,7 @@ when such a character is typed in.</p>
<div class="description"><p>Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets
when such a character is typed in.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">enabled</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Enables or disables wrapping behaviors</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">enabled</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean" class="" title="Boolean" data-id="Boolean">Boolean</a></td><td class="argDescription "><p>Required. Enables or disables wrapping behaviors</p>
</td></tr></table>
</div>
</div>
@ -4595,7 +4595,7 @@ when such a character is typed in.</p>
</div>
<div class="description"><p>Transposes the selected ranges.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The direction to rotate selections</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">dir</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number" class="" title="Number" data-id="Number">Number</a></td><td class="argDescription "><p>Required. The direction to rotate selections</p>
</td></tr></table>
</div>
</div>
@ -4647,7 +4647,7 @@ when such a character is typed in.</p>
</div>
<div class="description"><p>Removes the class <code>style</code> from the editor.</p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">style</td><td class="argType"><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
<h4>Arguments</h4><table class="argumentTable argument-list table table-striped table-bordered"><tr class="argumentRow "><td class="argName ">style</td><td class="argType" "><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object" class="" title="Object" data-id="Object">Object</a></td><td class="argDescription "><p>Required. </p>
</td></tr></table>
</div>
</div>

View file

@ -163,7 +163,7 @@
<article id="Selection" data-title="Selection (class)" class="article">
<div class="section description">
<div class="memberContent"><p>Contains the cursor position and the text selection of an edit session.</p>
<p>The row/columns used in the selection are in document coordinates representing the coordinates as they appear in the document before applying soft wrap and folding.</p>
<p>The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.</p>
</div>
</div>
@ -1778,4 +1778,4 @@
<script defer src="./resources/javascripts/disqus-ext.js"></script>
<script defer src="./resources/javascripts/ga.js"></script>
<div id="disqus_thread"></div>
</div>
</div>

2
build

@ -1 +1 @@
Subproject commit a4e495d8901876c6bafe3870a35cb8e32c827e97
Subproject commit cf536740d866276b65cfd351610001c2a841e751

View file

@ -8,8 +8,8 @@
body {
overflow: hidden;
}
#editor {
#editor {
margin: 0;
position: absolute;
top: 0;
@ -27,7 +27,7 @@
alert("Ace Rocks " + items[i]);
}
}</pre>
<script src="src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");

View file

@ -20,7 +20,7 @@ function foo() {
var bar = true;
}</textarea><br>
SourceUrl: <br>
<input id="srcURL" style="width:300px" value="http://ajaxorg.github.com/ace-builds/src-noconflict"></input><br>
<input id="srcURL" style="width:300px" value="http://ajaxorg.github.com/ace-builds/textarea/src/"></input><br>
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
<a href="https://github.com/ajaxorg/ace/">
<div class="fork_on_github" ></div>
@ -49,60 +49,63 @@ function foo() {
<script>
function inject(options, callback) {
var baseUrl = options.baseUrl || "../../src-noconflict";
var load = function(path, callback) {
function inject(callback) {
var baseUrl = "src/";
var load = window.__ace_loader__ = function(path, module, callback) {
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.src = baseUrl + "/" + path;
s.src = baseUrl + path;
head.appendChild(s);
s.onload = s.onreadystatechange = function(_, isAbort) {
if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
s = s.onload = s.onreadystatechange = null;
if (!isAbort)
callback();
}
s.onload = function() {
window.__ace_shadowed__.require([module], callback);
};
};
load("ace.js", function() {
ace.config.loadModule("ace/ext/textarea", function() {
var event = ace.require("ace/lib/event");
var areas = document.getElementsByTagName("textarea");
for (var i = 0; i < areas.length; i++) {
event.addListener(areas[i], "click", function(e) {
if (e.detail == 3) {
ace.transformTextarea(e.target, options.ace);
}
});
}
callback && callback();
});
load('ace-bookmarklet.js', "ace/ext/textarea", function() {
var ace = window.__ace_shadowed__;
ace.options.mode = "javascript";
var Event = ace.require("ace/lib/event");
var areas = document.getElementsByTagName("textarea");
for (var i = 0; i < areas.length; i++) {
Event.addListener(areas[i], "click", function(e) {
if (e.detail == 3) {
ace.transformTextarea(e.target, load);
}
});
}
callback && callback();
});
}
// Call the inject function to load the ace files.
var textAce;
inject({}, function () {
inject(function () {
// Transform the textarea on the page into an ace editor.
var ace = window.__ace_shadowed__;
var t = document.querySelector("textarea");
textAce = ace.require("ace/ext/textarea").transformTextarea(t);
textAce = ace.transformTextarea(t, window.__ace_loader__);
setTimeout(function(){textAce.setDisplaySettings(true)});
});
document.getElementById("buBuild").onclick = function() {
var injectSrc = inject.toString().split("\n").join("");
injectSrc = injectSrc.replace('baseUrl = "src/"', 'baseUrl="' + document.getElementById("srcURL").value + '"');
var aceOptions = textAce.getOptions();
var opt = [];
for (var option in aceOptions) {
opt.push(option + ":'" + aceOptions[option] + "'");
}
injectSrc = injectSrc.replace('ace.options.mode = "javascript"', 'ace.options = { ' + opt.join(",") + ' }');
injectSrc = injectSrc.replace(/\s+/g, " ");
var options = textAce.getOptions();
options.baseUrl = document.getElementById("srcURL").value;
var a = document.querySelector("a");
a.href = "javascript:(" + injectSrc + ")(" + JSON.stringify(options) + ")";
a.href = "javascript:(" + injectSrc + ")()";
a.innerHTML = "Ace Bookmarklet Link";
}

View file

@ -3,7 +3,7 @@
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
@ -14,7 +14,7 @@
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@ -38,62 +38,69 @@
var ACE_NAMESPACE = "";
var global = (function() { return this; })();
if (!global && typeof window != "undefined") global = window; // strict mode
var global = (function() {
return this;
})();
if (!ACE_NAMESPACE && typeof requirejs !== "undefined")
return;
var define = function(module, deps, payload) {
if (typeof module !== "string") {
if (define.original)
define.original.apply(this, arguments);
var _define = function(module, deps, payload) {
if (typeof module !== 'string') {
if (_define.original)
_define.original.apply(window, arguments);
else {
console.error("dropping module because define wasn\'t a string.");
console.error('dropping module because define wasn\'t a string.');
console.trace();
}
return;
}
if (arguments.length == 2)
payload = deps;
if (!define.modules[module]) {
define.payloads[module] = payload;
define.modules[module] = null;
}
};
define.modules = {};
define.payloads = {};
if (!_define.modules) {
_define.modules = {};
_define.payloads = {};
}
_define.payloads[module] = payload;
_define.modules[module] = null;
};
/**
* Get at functionality define()ed using the function above
*/
var _require = function(parentId, module, callback) {
if (typeof module === "string") {
var payload = lookup(parentId, module);
if (payload != undefined) {
callback && callback();
return payload;
}
} else if (Object.prototype.toString.call(module) === "[object Array]") {
if (Object.prototype.toString.call(module) === "[object Array]") {
var params = [];
for (var i = 0, l = module.length; i < l; ++i) {
var dep = lookup(parentId, module[i]);
if (dep == undefined && require.original)
return;
if (!dep && _require.original)
return _require.original.apply(window, arguments);
params.push(dep);
}
return callback && callback.apply(null, params) || true;
if (callback) {
callback.apply(null, params);
}
}
};
else if (typeof module === 'string') {
var payload = lookup(parentId, module);
if (!payload && _require.original)
return _require.original.apply(window, arguments);
var require = function(module, callback) {
var packagedModule = _require("", module, callback);
if (packagedModule == undefined && require.original)
return require.original.apply(this, arguments);
return packagedModule;
if (callback) {
callback();
}
return payload;
}
else {
if (_require.original)
return _require.original.apply(window, arguments);
}
};
var normalizeModule = function(parentId, moduleName) {
@ -112,6 +119,7 @@ var normalizeModule = function(parentId, moduleName) {
moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
}
}
return moduleName;
};
@ -120,11 +128,12 @@ var normalizeModule = function(parentId, moduleName) {
* definition function if needed.
*/
var lookup = function(parentId, moduleName) {
moduleName = normalizeModule(parentId, moduleName);
var module = define.modules[moduleName];
var module = _define.modules[moduleName];
if (!module) {
module = define.payloads[moduleName];
module = _define.payloads[moduleName];
if (typeof module === 'function') {
var exports = {};
var mod = {
@ -140,15 +149,19 @@ var lookup = function(parentId, moduleName) {
var returnValue = module(req, exports, mod);
exports = returnValue || mod.exports;
define.modules[moduleName] = exports;
delete define.payloads[moduleName];
_define.modules[moduleName] = exports;
delete _define.payloads[moduleName];
}
module = define.modules[moduleName] = exports || module;
module = _define.modules[moduleName] = exports || module;
}
return module;
};
function exportAce(ns) {
var require = function(module, callback) {
return _require("", module, callback);
};
var root = global;
if (ns) {
if (!global[ns])
@ -157,13 +170,13 @@ function exportAce(ns) {
}
if (!root.define || !root.define.packaged) {
define.original = root.define;
root.define = define;
_define.original = root.define;
root.define = _define;
root.define.packaged = true;
}
if (!root.require || !root.require.packaged) {
require.original = root.require;
_require.original = root.require;
root.require = require;
root.require.packaged = true;
}

View file

@ -4,7 +4,7 @@ body {
margin:0;
padding:0;
background-color:#e6f5fc;
}
H2, H3, H4 {
@ -58,7 +58,7 @@ PRE{
position:relative;
overflow:hidden;
background: url(images/background.png) repeat-x 0 0;
border-bottom:1px solid #c9e8fa;
border-bottom:1px solid #c9e8fa;
}
#header .content .signature {
@ -224,3 +224,7 @@ UL.menu-footer LI A {
UL.menu-footer LI A:hover {
text-decoration:underline;
}

View file

@ -1,45 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ACE Autocompletion demo</title>
<style type="text/css" media="screen">
body {
overflow: hidden;
}
#editor {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
</head>
<body>
<pre id="editor"></pre>
<!-- load ace -->
<script src="../build/src-noconflict/ace.js"></script>
<!-- load ace language tools -->
<script src="../build/src-noconflict/ext-language_tools.js"></script>
<script>
// trigger extension
ace.require("ace/ext/language_tools");
var editor = ace.edit("editor");
editor.session.setMode("ace/mode/html");
editor.setTheme("ace/theme/tomorrow");
// enable autocompletion and snippets
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: false
});
</script>
<script src="./show_own_source.js"></script>
</body>
</html>

View file

@ -1,68 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Editor</title>
<style type="text/css" media="screen">
.ace_editor {
border: 1px solid lightgray;
margin: auto;
height: 200px;
width: 80%;
}
.scrollmargin {
height: 80px;
text-align: center;
}
</style>
</head>
<body>
<pre id="editor1">autoresizing editor</pre>
<div class="scrollmargin"></div>
<pre id="editor2">minHeight = 2 lines</pre>
<div class="scrollmargin"></div>
<pre id="editor3" style="width: 40%;"></pre>
<div class="scrollmargin"></div>
<pre id="editor"></pre>
<script src="kitchen-sink/require.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace"], function(ace) {
var editor1 = ace.edit("editor1");
editor1.setTheme("ace/theme/tomorrow_night_eighties");
editor1.session.setMode("ace/mode/html");
editor1.setAutoScrollEditorIntoView(true);
editor1.setOption("maxLines", 30);
var editor2 = ace.edit("editor2");
editor2.setTheme("ace/theme/tomorrow_night_blue");
editor2.session.setMode("ace/mode/html");
editor2.setAutoScrollEditorIntoView(true);
editor2.setOption("maxLines", 30);
editor2.setOption("minLines", 2);
var editor = ace.edit("editor3");
editor.setOptions({
autoScrollEditorIntoView: true,
maxLines: 8
});
editor.renderer.setScrollMargin(10, 10, 10, 10);
var editor = ace.edit("editor");
editor.setTheme("ace/theme/tomorrow");
editor.session.setMode("ace/mode/html");
editor.setAutoScrollEditorIntoView(true);
editor.setOption("maxLines", 100);
});
</script>
<script src="./show_own_source.js"></script>
</body>
</html>

View file

@ -1,39 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ACE ChromeVox demo</title>
<style type="text/css" media="screen">
body {
overflow: hidden;
}
#editor {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
</head>
<body>
<pre id="editor"></pre>
<!-- load ace -->
<script src="../build/src/ace.js"></script>
<!-- load ace accessibility extension -->
<script src="../build/src/ext-chromevox.js"></script>
<script>
// trigger extension
ace.require("ace/ext/chromevox");
var editor = ace.edit("editor");
editor.session.setMode("ace/mode/html");
editor.setTheme("ace/theme/tomorrow");
</script>
<script src="./show_own_source.js"></script>
</body>
</html>

3
demo/demo_helper.js Normal file
View file

@ -0,0 +1,3 @@
ace.require("ace/lib/net").get(document.baseURI, function(t){
editor.setValue(t, 1);
})

View file

@ -1,43 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ACE Emmet demo</title>
<style type="text/css" media="screen">
body {
overflow: hidden;
}
#editor {
margin: 0;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
</style>
</head>
<body>
<pre id="editor"></pre>
<!-- load emmet code and snippets compiled for browser -->
<script src="https://cloud9ide.github.io/emmet-core/emmet.js"></script>
<script src="kitchen-sink/require.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace", "ace/ext/emmet"], function(ace) {
var editor = ace.edit("editor");
editor.session.setMode("ace/mode/html");
// enable emmet on the current editor
editor.setOption("enableEmmet", true);
});
</script>
<script src="./show_own_source.js"></script>
</body>
</html>

View file

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ACE Editor StatusBar Demo</title>
<style type="text/css" media="screen">
/*!important without this top: 0; bottom: 0 doesn't work on old ie */
body, html {
position: absolute;
top: 0px; bottom: 0; left: 0; right: 0;
margin:0; padding:0;
overflow:hidden
}
#editor {
margin: 0;
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
}
</style>
</head>
<body>
<pre id="editor">
require("ace/ext/old_ie");
// now ace will work even on ie7!
var editor = ace.edit("editor");
</pre>
<script src="../build/src/ace.js"></script>
<script src="../build/src/ext-old_ie.js"></script>
<script>
// before creating an editor patch up things for old ie
require("ace/ext/old_ie");
// now ace will work even on ie7!
var editor = ace.edit("editor");
editor.setTheme("ace/theme/textmate");
editor.session.setMode("ace/mode/javascript");
</script>
</body>
</html>

View file

@ -22,11 +22,8 @@
<pre id="editor"></pre>
<script src="kitchen-sink/require.js"></script>
<script src="../build/src-noconflict/ace.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
require(["ace/ace"], function(ace) {
var editor = ace.edit("editor")
editor.setTheme("ace/theme/twilight")
editor.session.setMode("ace/mode/html")
@ -36,16 +33,14 @@ require(["ace/ace"], function(ace) {
name: "showKeyboardShortcuts",
bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
exec: function(editor) {
ace.config.loadModule("ace/ext/keybinding_menu", function(module) {
config.loadModule("ace/ext/keybinding_menu", function(module) {
module.init(editor);
editor.showKeyboardShortcuts()
})
}
})
editor.execCommand("showKeyboardShortcuts")
})
</script>
<script src="./show_own_source.js"></script>
<script src="./demo_helper.js"></script>
</body>
</html>

View file

@ -33,13 +33,6 @@ define(function(require, exports, module) {
"use strict";
require("ace/lib/fixoldbrowsers");
require("ace/multi_select");
require("ace/ext/spellcheck");
require("./inline_editor");
require("./dev_util");
require("./file_drop");
var config = require("ace/config");
config.init();
var env = {};
@ -58,14 +51,12 @@ var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
var Editor = require("ace/editor").Editor;
var MultiSelect = require("ace/multi_select").MultiSelect;
var whitespace = require("ace/ext/whitespace");
var doclist = require("./doclist");
var modelist = require("ace/ext/modelist");
var themelist = require("ace/ext/themelist");
var layout = require("./layout");
var TokenTooltip = require("./token_tooltip").TokenTooltip;
var util = require("./util");
@ -78,12 +69,6 @@ var ElasticTabstopsLite = require("ace/ext/elastic_tabstops_lite").ElasticTabsto
var IncrementalSearch = require("ace/incremental_search").IncrementalSearch;
var workerModule = require("ace/worker/worker_client");
if (location.href.indexOf("noworker") !== -1) {
workerModule.WorkerClient = workerModule.UIWorkerClient;
}
/*********** create editor ***************************/
var container = document.getElementById("editor-container");
@ -97,7 +82,11 @@ split.on("focus", function(editor) {
});
env.split = split;
window.env = env;
window.ace = env.editor;
env.editor.setAnimatedScroll(true);
// add multiple cursor support to editor
require("ace/multi_select").MultiSelect(env.editor);
var consoleEl = dom.createElement("div");
container.parentNode.appendChild(consoleEl);
@ -166,11 +155,11 @@ env.editor.commands.addCommands([{
bindKey: "ctrl+enter",
exec: function(editor) {
try {
var r = window.eval(editor.getCopyText() || editor.getValue());
var r = eval(editor.getCopyText()||editor.getValue());
} catch(e) {
r = e;
}
editor.cmdLine.setValue(r + "");
editor.cmdLine.setValue(r + "")
},
readOnly: true
}, {
@ -179,28 +168,8 @@ env.editor.commands.addCommands([{
exec: function(editor) {
config.loadModule("ace/ext/keybinding_menu", function(module) {
module.init(editor);
editor.showKeyboardShortcuts();
});
}
}, {
name: "increaseFontSize",
bindKey: "Ctrl-=|Ctrl-+",
exec: function(editor) {
var size = parseInt(editor.getFontSize(), 10) || 12;
editor.setFontSize(size + 1);
}
}, {
name: "decreaseFontSize",
bindKey: "Ctrl+-|Ctrl-_",
exec: function(editor) {
var size = parseInt(editor.getFontSize(), 10) || 12;
editor.setFontSize(Math.max(size - 1 || 1));
}
}, {
name: "resetFontSize",
bindKey: "Ctrl+0|Ctrl-Numpad0",
exec: function(editor) {
editor.setFontSize(12);
editor.showKeyboardShortcuts()
})
}
}]);
@ -224,31 +193,7 @@ var commands = env.editor.commands;
commands.addCommand({
name: "save",
bindKey: {win: "Ctrl-S", mac: "Command-S"},
exec: function(arg) {
var session = env.editor.session;
var name = session.name.match(/[^\/]+$/);
localStorage.setItem(
"saved_file:" + name,
session.getValue()
);
env.editor.cmdLine.setValue("saved "+ name);
}
});
commands.addCommand({
name: "load",
bindKey: {win: "Ctrl-O", mac: "Command-O"},
exec: function(arg) {
var session = env.editor.session;
var name = session.name.match(/[^\/]+$/);
var value = localStorage.getItem("saved_file:" + name);
if (typeof value == "string") {
session.setValue(value);
env.editor.cmdLine.setValue("loaded "+ name);
} else {
env.editor.cmdLine.setValue("no previuos value saved for "+ name);
}
}
exec: function() {alert("Fake Save File");}
});
var keybindings = {
@ -296,7 +241,6 @@ var showGutterEl = document.getElementById("show_gutter");
var showPrintMarginEl = document.getElementById("show_print_margin");
var highlightSelectedWordE = document.getElementById("highlight_selected_word");
var showHScrollEl = document.getElementById("show_hscroll");
var showVScrollEl = document.getElementById("show_vscroll");
var animateScrollEl = document.getElementById("animate_scroll");
var softTabEl = document.getElementById("soft_tab");
var behavioursEl = document.getElementById("enable_behaviours");
@ -315,25 +259,26 @@ doclist.history = doclist.docs.map(function(doc) {
});
doclist.history.index = 0;
doclist.cycleOpen = function(editor, dir) {
var h = this.history;
var h = this.history
h.index += dir;
if (h.index >= h.length)
if (h.index >= h.length)
h.index = 0;
else if (h.index <= 0)
h.index = h.length - 1;
var s = h[h.index];
docEl.value = s;
docEl.onchange();
};
h.index
}
doclist.addToHistory = function(name) {
var h = this.history;
var h = this.history
var i = h.indexOf(name);
if (i != h.index) {
if (i != -1)
h.splice(i, 1);
h.index = h.push(name);
}
};
}
bindDropdown("doc", function(name) {
doclist.loadDoc(name, function(session) {
@ -371,26 +316,20 @@ function updateUIEditorOptions() {
saveOption(behavioursEl, editor.getBehavioursEnabled());
}
themelist.themes.forEach(function(x){ x.value = x.theme });
fillDropdown(themeEl, {
Bright: themelist.themes.filter(function(x){return !x.isDark}),
Dark: themelist.themes.filter(function(x){return x.isDark}),
});
event.addListener(themeEl, "mouseover", function(e){
themeEl.desiredValue = e.target.value;
if (!themeEl.$timer)
themeEl.$timer = setTimeout(themeEl.updateTheme);
this.desiredValue = e.target.value;
if (!this.$timer)
this.$timer = setTimeout(this.updateTheme);
});
event.addListener(themeEl, "mouseout", function(e){
themeEl.desiredValue = null;
if (!themeEl.$timer)
themeEl.$timer = setTimeout(themeEl.updateTheme, 20);
this.desiredValue = null;
if (!this.$timer)
this.$timer = setTimeout(this.updateTheme, 20);
});
themeEl.updateTheme = function(){
env.split.setTheme((themeEl.desiredValue || themeEl.selectedValue));
env.split.setTheme(themeEl.desiredValue || themeEl.selectedValue);
themeEl.$timer = null;
};
@ -415,11 +354,28 @@ bindDropdown("folding", function(value) {
});
bindDropdown("soft_wrap", function(value) {
env.editor.setOption("wrap", value);
var session = env.editor.session;
var renderer = env.editor.renderer;
switch (value) {
case "off":
session.setUseWrapMode(false);
renderer.setPrintMarginColumn(80);
break;
case "free":
session.setUseWrapMode(true);
session.setWrapLimitRange(null, null);
renderer.setPrintMarginColumn(80);
break;
default:
session.setUseWrapMode(true);
var col = parseInt(value, 10);
session.setWrapLimitRange(col, col);
renderer.setPrintMarginColumn(col);
}
});
bindCheckbox("select_style", function(checked) {
env.editor.setOption("selectionStyle", checked ? "line" : "text");
env.editor.setSelectionStyle(checked ? "line" : "text");
});
bindCheckbox("highlight_active", function(checked) {
@ -447,11 +403,7 @@ bindCheckbox("highlight_selected_word", function(checked) {
});
bindCheckbox("show_hscroll", function(checked) {
env.editor.setOption("hScrollBarAlwaysVisible", checked);
});
bindCheckbox("show_vscroll", function(checked) {
env.editor.setOption("vScrollBarAlwaysVisible", checked);
env.editor.renderer.setHScrollBarAlwaysVisible(checked);
});
bindCheckbox("animate_scroll", function(checked) {
@ -472,9 +424,6 @@ bindCheckbox("fade_fold_widgets", function(checked) {
bindCheckbox("read_only", function(checked) {
env.editor.setReadOnly(checked);
});
bindCheckbox("scrollPastEnd", function(checked) {
env.editor.setOption("scrollPastEnd", checked);
});
bindDropdown("split", function(value) {
var sp = env.split;
@ -526,20 +475,59 @@ bindCheckbox("highlight_token", function(checked) {
}
});
/************** dragover ***************************/
event.addListener(container, "dragover", function(e) {
var types = e.dataTransfer.types;
if (types && Array.prototype.indexOf.call(types, 'Files') !== -1)
return event.preventDefault(e);
});
event.addListener(container, "drop", function(e) {
var file;
try {
file = e.dataTransfer.files[0];
if (window.FileReader) {
var reader = new FileReader();
reader.onload = function() {
var mode = modelist.getModeForPath(file.name);
env.editor.session.doc.setValue(reader.result);
modeEl.value = mode.name;
env.editor.session.setMode(mode.mode);
env.editor.session.modeName = mode.name;
};
reader.readAsText(file);
}
return event.preventDefault(e);
} catch(err) {
return event.stopEvent(e);
}
});
var StatusBar = require("ace/ext/statusbar").StatusBar;
new StatusBar(env.editor, cmdLine.container);
var Emmet = require("ace/ext/emmet");
net.loadScript("https://cloud9ide.github.io/emmet-core/emmet.js", function() {
net.loadScript("https://rawgithub.com/nightwing/emmet-core/master/emmet.js", function() {
Emmet.setCore(window.emmet);
env.editor.setOption("enableEmmet", true);
});
})
// require("ace/placeholder").PlaceHolder;
require("ace/placeholder").PlaceHolder;
var snippetManager = require("ace/snippets").snippetManager;
var snippetManager = require("ace/snippets").snippetManager
var jsSnippets = require("ace/snippets/javascript");
window.snippetManager = snippetManager
saveSnippets()
function saveSnippets() {
jsSnippets.snippets = snippetManager.parseSnippetFile(jsSnippets.snippetText);
snippetManager.register(jsSnippets.snippets, "javascript")
}
env.editSnippets = function() {
var sp = env.split;
@ -550,36 +538,25 @@ env.editSnippets = function() {
sp.setSplits(1);
sp.setSplits(2);
sp.setOrientation(sp.BESIDE);
var editor = sp.$editors[1];
var id = sp.$editors[0].session.$mode.$id || "";
var m = snippetManager.files[id];
if (!doclist["snippets/" + id]) {
var text = m.snippetText;
var s = doclist.initDoc(text, "", {});
s.setMode("ace/mode/snippets");
doclist["snippets/" + id] = s;
var editor = sp.$editors[1]
if (!env.snippetSession) {
var file = jsSnippets.snippetText;
env.snippetSession = doclist.initDoc(file, "", {});
env.snippetSession.setMode("ace/mode/tmsnippet");
env.snippetSession.setUseSoftTabs(false);
}
editor.on("blur", function() {
m.snippetText = editor.getValue();
snippetManager.unregister(m.snippets);
m.snippets = snippetManager.parseSnippetFile(m.snippetText, m.scope);
snippetManager.register(m.snippets);
});
sp.$editors[0].once("changeMode", function() {
sp.setSplits(1);
});
editor.setSession(doclist["snippets/" + id], 1);
jsSnippets.snippetText = editor.getValue();
saveSnippets();
})
editor.setSession(env.snippetSession, 1);
editor.focus();
};
}
require("ace/ext/language_tools");
env.editor.setOptions({
enableBasicAutocompletion: true,
enableLiveAutocompletion: false,
enableSnippets: true
});
var beautify = require("ace/ext/beautify");
env.editor.commands.addCommands(beautify.commands);
ace.commands.bindKey("Tab", function(editor) {
var success = snippetManager.expandWithTab(editor);
if (!success)
editor.execCommand("indent");
})
});

View file

@ -1,217 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var dom = require("ace/lib/dom");
var Range = require("ace/range").Range;
function warn() {
var s = (new Error()).stack || "";
s = s.split("\n");
if (s[1] == "Error") s.shift(); // remove error description on chrome
s.shift(); // remove warn
s.shift(); // remove the getter
s = s.join("\n");
// allow easy access to ace in console, but not in ace code
if (!/at Object.InjectedScript.|@debugger eval|snippets:\/{3}|\(<anonymous>:\d+:\d+\)/.test(s)) {
console.error("trying to access to global variable");
}
}
function def(o, key, get) {
try {
Object.defineProperty(o, key, {
configurable: true,
get: get,
set: function(val) {
delete o[key];
o[key] = val;
}
});
} catch(e) {
console.error(e);
}
}
def(window, "ace", function(){ warn(); return window.env.editor });
def(window, "editor", function(){ warn(); return window.env.editor });
def(window, "session", function(){ warn(); return window.env.editor.session });
def(window, "split", function(){ warn(); return window.env.split });
def(window, "devUtil", function(){ warn(); return exports });
exports.showTextArea = function(argument) {
dom.importCssString("\
.ace_text-input {\
position: absolute;\
z-index: 10!important;\
width: 6em!important;\
height: 1em;\
opacity: 1!important;\
background: rgba(0, 92, 255, 0.11);\
border: none;\
font: inherit;\
padding: 0 1px;\
margin: 0 -1px;\
text-indent: 0em;\
}\
");
};
exports.addGlobals = function() {
window.oop = require("ace/lib/oop");
window.dom = require("ace/lib/dom");
window.Range = require("ace/range").Range;
window.Editor = require("ace/editor").Editor;
window.assert = require("ace/test/asyncjs/assert");
window.asyncjs = require("ace/test/asyncjs/async");
window.UndoManager = require("ace/undomanager").UndoManager;
window.EditSession = require("ace/edit_session").EditSession;
window.MockRenderer = require("ace/test/mockrenderer").MockRenderer;
window.EventEmitter = require("ace/lib/event_emitter").EventEmitter;
window.getSelection = getSelection;
window.setSelection = setSelection;
window.testSelection = testSelection;
};
function getSelection(editor) {
var data = editor.multiSelect.toJSON();
if (!data.length) data = [data];
data = data.map(function(x) {
var a, c;
if (x.isBackwards) {
a = x.end;
c = x.start;
} else {
c = x.end;
a = x.start;
}
return Range.comparePoints(a, c)
? [a.row, a.column, c.row, c.column]
: [a.row, a.column];
});
return data.length > 1 ? data : data[0];
}
function setSelection(editor, data) {
if (typeof data[0] == "number")
data = [data];
editor.selection.fromJSON(data.map(function(x) {
var start = {row: x[0], column: x[1]};
var end = x.length == 2 ? start : {row: x[2], column: x[3]};
var isBackwards = Range.comparePoints(start, end) > 0;
return isBackwards ? {
start: end,
end: start,
isBackwards: true
} : {
start: start,
end: end,
isBackwards: true
};
}));
}
function testSelection(editor, data) {
assert.equal(getSelection(editor) + "", data + "");
}
exports.recordTestCase = function() {
exports.addGlobals();
var editor = window.editor;
var testcase = window.testcase = [];
var assert;
testcase.push({
type: "setValue",
data: editor.getValue()
}, {
type: "setSelection",
data: getSelection(editor)
});
editor.commands.on("afterExec", function(e) {
testcase.push({
type: "exec",
data: e
});
testcase.push({
type: "value",
data: editor.getValue()
});
testcase.push({
type: "selection",
data: getSelection(editor)
});
});
editor.on("mouseup", function() {
testcase.push({
type: "setSelection",
data: getSelection(editor)
});
});
testcase.toString = function() {
var lastValue = "";
// var lastSelection = ""
var str = this.map(function(x) {
var data = x.data;
switch (x.type) {
case "exec":
return 'editor.execCommand("'
+ data.command.name
+ (data.args ? '", ' + JSON.stringify(data.args) : '"')
+ ')';
case "setSelection":
return 'setSelection(editor, ' + JSON.stringify(data) + ')';
case "setValue":
if (lastValue != data) {
lastValue = data;
return 'editor.setValue(' + JSON.stringify(data) + ', -1)';
}
return;
case "selection":
return 'testSelection(editor, ' + JSON.stringify(data) + ')';
case "value":
if (lastValue != data) {
lastValue = data;
return 'assert.equal('
+ 'editor.getValue(),'
+ JSON.stringify(data)
+ ')';
}
return;
}
}).filter(Boolean).join("\n");
return getSelection + "\n"
+ testSelection + "\n"
+ setSelection + "\n"
+ "\n" + str + "\n";
};
};
});

View file

@ -66,51 +66,103 @@ function makeHuge(txt) {
}
var docs = {
"docs/javascript.js": {order: 1, name: "JavaScript"},
"docs/javascript.js": "JavaScript",
"docs/AsciiDoc.asciidoc": "AsciiDoc",
"docs/clojure.clj": "Clojure",
"docs/coffeescript.coffee": "CoffeeScript",
"docs/coldfusion.cfm": "ColdFusion",
"docs/cpp.cpp": "C/C++",
"docs/csharp.cs": "C#",
"docs/css.css": "CSS",
"docs/curly.curly": "Curly",
"docs/dart.dart": "Dart",
"docs/diff.diff": "Diff",
"docs/dot.dot": "Dot",
"docs/freemarker.ftl" : "FreeMarker",
"docs/glsl.glsl": "Glsl",
"docs/golang.go": "Go",
"docs/groovy.groovy": "Groovy",
"docs/haml.haml": "Haml",
"docs/Haxe.hx": "haXe",
"docs/html.html": "HTML",
"docs/html_ruby.erb": "HTML (Ruby)",
"docs/jade.jade": "Jade",
"docs/java.java": "Java",
"docs/jsp.jsp": "JSP",
"docs/json.json": "JSON",
"docs/jsx.jsx": "JSX",
"docs/latex.tex": {name: "LaTeX", wrapped: true},
"docs/less.less": "LESS",
"docs/lisp.lisp": "Lisp",
"docs/lsl.lsl": "LSL",
"docs/scheme.scm": "Scheme",
"docs/livescript.ls": "LiveScript",
"docs/liquid.liquid": "Liquid",
"docs/logiql.logic": "LogiQL",
"docs/lua.lua": "Lua",
"docs/lucene.lucene": "Lucene",
"docs/luapage.lp": "LuaPage",
"docs/Makefile": "Makefile",
"docs/markdown.md": {name: "Markdown", wrapped: true},
"docs/mushcode.mc": {name: "MUSHCode", wrapped: true},
"docs/objectivec.m": {name: "Objective-C"},
"docs/ocaml.ml": "OCaml",
"docs/OpenSCAD.scad": "OpenSCAD",
"docs/pascal.pas": "Pascal",
"docs/perl.pl": "Perl",
"docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
"docs/php.php": "PHP",
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
"docs/powershell.ps1": "Powershell",
"docs/properties.properties": "Properties",
"docs/python.py": "Python",
"docs/r.r": "R",
"docs/rdoc.Rd": "RDoc",
"docs/rhtml.rhtml": "RHTML",
"docs/ruby.rb": "Ruby",
"docs/abap.abap": "SAP - ABAP",
"docs/scala.scala": "Scala",
"docs/scss.scss": "SCSS",
"docs/sass.sass": "SASS",
"docs/sh.sh": "SH",
"docs/stylus.styl": "Stylus",
"docs/sql.sql": {name: "SQL", wrapped: true},
"docs/svg.svg": "SVG",
"docs/tcl.tcl": "Tcl",
"docs/tex.tex": "Tex",
"docs/textile.textile": {name: "Textile", wrapped: true},
"docs/snippets.snippets": "snippets",
"docs/toml.toml": "TOML",
"docs/typescript.ts": "Typescript",
"docs/vbscript.vbs": "VBScript",
"docs/velocity.vm": "Velocity",
"docs/xml.xml": "XML",
"docs/xquery.xq": "XQuery",
"docs/yaml.yaml": "YAML",
"docs/c9search.c9search_results": "C9 Search Results",
"docs/mel.mel": "MEL",
"docs/Nix.nix": "Nix"
"docs/actionscript.as": "ActionScript",
"docs/assembly_x86.asm": "Assembly_x86",
"docs/autohotkey.ahk": "AutoHotKey",
"docs/batchfile.bat": "BatchFile",
"docs/erlang/erl": "Erlang",
"docs/forth.frt": "Forth",
"docs/haskell.hs": "Haskell",
"docs/julia.js": "Julia",
"docs/prolog/plg": "Prolog",
"docs/rust.rs": "Rust",
"docs/twig.twig": "Twig"
};
var ownSource = {
/* filled from require*/
};
var hugeDocs = require.toUrl ? {
var hugeDocs = {
"build/src/ace.js": "",
"build/src-min/ace.js": ""
} : {
"src/ace.js": "",
"src-min/ace.js": ""
};
modelist.modes.forEach(function(m) {
var ext = m.extensions.split("|")[0];
if (ext[0] === "^") {
path = ext.substr(1);
} else {
var path = m.name + "." + ext;
}
path = "docs/" + path;
if (!docs[path]) {
docs[path] = {name: m.caption};
} else if (typeof docs[path] == "object" && !docs[path].name) {
docs[path].name = m.caption;
}
});
if (window.require && window.require.s) try {
for (var path in window.require.s.contexts._.defined) {
if (path.indexOf("!") != -1)
@ -121,13 +173,6 @@ if (window.require && window.require.s) try {
}
} catch(e) {}
function sort(list) {
return list.sort(function(a, b) {
var cmp = (b.order || 0) - (a.order || 0);
return cmp || a.name && a.name.localeCompare(b.name);
});
}
function prepareDocList(docs) {
var list = [];
for (var path in docs) {
@ -169,44 +214,13 @@ function loadDoc(name, callback) {
});
}
function saveDoc(name, callback) {
var doc = fileCache[name] || name;
if (!doc || !doc.session)
return callback("Unknown document: " + name);
var path = doc.path;
var parts = path.split("/");
if (parts[0] == "docs")
path = "demo/kitchen-sink/" + path;
else if (parts[0] == "ace")
path = "lib/" + path;
upload(path, doc.session.getValue(), callback);
}
function upload(url, data, callback) {
url = net.qualifyURL(url);
if (!/https?:/.test(url))
return callback(new Error("Unsupported url scheme"));
var xhr = new XMLHttpRequest();
xhr.open("PUT", url, true);
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
callback(!/^2../.test(xhr.status));
}
};
xhr.send(data);
};
module.exports = {
fileCache: fileCache,
docs: sort(prepareDocList(docs)),
docs: prepareDocList(docs),
ownSource: prepareDocList(ownSource),
hugeDocs: prepareDocList(hugeDocs),
initDoc: initDoc,
loadDoc: loadDoc,
saveDoc: saveDoc,
loadDoc: loadDoc
};
module.exports.all = {
"Mode Examples": module.exports.docs,

View file

@ -1,11 +0,0 @@
# A sample .gitignore file.
.buildlog
.DS_Store
.svn
# Negated patterns:
!foo.bar
# Also ignore user settings...
/.settings

View file

@ -1,53 +0,0 @@
#
# example Dockerfile for http://docs.docker.io/en/latest/examples/postgresql_service/
#
FROM ubuntu
MAINTAINER SvenDowideit@docker.com
# Add the PostgreSQL PGP key to verify their Debian packages.
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
# Add PostgreSQL's repository. It contains the most recent stable release
# of PostgreSQL, ``9.3``.
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
# Update the Ubuntu and PostgreSQL repository indexes
RUN apt-get update
# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3
# There are some warnings (in red) that show up during the build. You can hide
# them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
RUN apt-get -y -q install python-software-properties software-properties-common
RUN apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
# Note: The official Debian and Ubuntu images automatically ``apt-get clean``
# after each ``apt-get``
# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed``
USER postgres
# Create a PostgreSQL role named ``docker`` with ``docker`` as the password and
# then create a database `docker` owned by the ``docker`` role.
# Note: here we use ``&&\`` to run commands one after the other - the ``\``
# allows the RUN command to span multiple lines.
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
createdb -O docker docker
# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf
# Expose the PostgreSQL port
EXPOSE 5432
# Add VOLUMEs to allow backup of config, logs and databases
VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]
# Set the default command to run when starting the container
CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]

View file

@ -1,247 +0,0 @@
vars it, p
p = {label, value|
print("\n" + label)
print(inspect(value))
}
-- Create an array from 0 to 15
p("range", i-collect(range(5)))
-- Create an array from 0 to 15 and break up in chunks of 4
p("chunked range", i-collect(i-chunk(4, range(16))))
-- Check if all or none items in stream pass test.
p("all < 60 in range(60)", i-all?({i|i<60}, range(60)))
p("any < 60 in range(60)", i-any?({i|i>60}, range(60)))
p("all < 60 in range(70)", i-all?({i|i<60}, range(70)))
p("any < 60 in range(70)", i-any?({i|i>60}, range(70)))
-- Zip three different collections together
p("zipped", i-collect(i-zip(
range(10),
[1,2,3,4,5],
i-map({i|i*i}, range(10))
)))
vars names, person, i, doubles, lengths, cubeRange
names = ["Thorin", "Dwalin", "Balin", "Bifur", "Bofur", "Bombur", "Oin",
"Gloin", "Ori", "Nori", "Dori", "Fili", "Kili", "Bilbo", "Gandalf"]
for name in names {
if name != "Bilbo" && name != "Gandalf" {
print(name)
}
}
person = {name: "Tim", age: 30}
for key, value in person {
print(key + " = " + value)
}
i = 0
while i < 10 {
i = i + 1
print(i)
}
print("range")
for i in range(10) {
print(i + 1)
}
for i in range(10) {
print(10 - i)
}
-- Dynamic object that gives the first 10 doubles
doubles = {
@len: {| 10 }
@get: {key|
if key is Integer { key * key }
}
}
print("#doubles", #doubles)
print("Doubles")
for k, v in doubles {
print([k, v])
}
-- Dynamic object that has names list as keys and string lenth as values
lengths = {
@keys: {| names }
@get: {key|
if key is String { #key }
}
}
print ("Lengths")
for k, v in lengths {
print([k, v])
}
cubeRange = {n|
vars i, v
i = 0
{
@call: {|
v = i
i = i + 1
if v < n { v * v * v }
}
}
}
print("Cubes")
for k, v in cubeRange(5) {
print([k, v])
}
print("String")
for k, v in "Hello World" {
print([k, v])
}
print([i for i in range(10)])
print([i for i in range(20) if i % 3])
-- Example showing how to do parallel work using split..and
base = {bootstrap, target-dir|
split {
copy("res", target-dir)
} and {
if newer("src/*.less", target-dir + "/style.css") {
lessc("src/" + bootstrap + ".less", target-dir + "/style.css")
}
} and {
build("src/" + bootstrap + ".js", target-dir + "/app.js")
}
}
vars Dragon, pet
Dragon = {name|
vars asleep, stuff-in-belly, stuff-in-intestine,
feed, walk, put-to-bed, toss, rock,
hungry?, poopy?, passage-of-time
asleep = false
stuff-in-belly = 10 -- He's full.
stuff-in-intestine = 0 -- He doesn't need to go.
print(name + ' is born.')
feed = {|
print('You feed ' + name + '.')
stuff-in-belly = 10
passage-of-time()
}
walk = {|
print('You walk ' + name + ".")
stuff-in-intestine = 0
passage-of-time
}
put-to-bed = {|
print('You put ' + name + ' to bed.')
asleep = true
for i in range(3) {
if asleep {
passage-of-time()
}
if asleep {
print(name + ' snores, filling the room with smoke.')
}
}
if asleep {
asleep = false
print(name + ' wakes up slowly.')
}
}
toss = {|
print('You toss ' + name + ' up into the air.')
print('He giggles, which singes your eyebrows.')
passage-of-time()
}
rock = {|
print('You rock ' + name + ' gently.')
asleep = true
print('He briefly dozes off...')
passage-of-time()
if asleep {
asleep = false
print('...but wakes when you stop.')
}
}
hungry? = {|
stuff-in-belly <= 2
}
poopy? = {|
stuff-in-intestine >= 8
}
passage-of-time = {|
if stuff-in-belly > 0 {
-- Move food from belly to intestine
stuff-in-belly = stuff-in-belly - 1
stuff-in-intestine = stuff-in-intestine + 1
} else { -- Our dragon is starving!
if asleep {
asleep = false
print('He wakes up suddenly!')
}
print(name + ' is starving! In desperation, he ate YOU!')
abort "died"
}
if stuff-in-intestine >= 10 {
stuff-in-intestine = 0
print('Whoops! ' + name + ' had an accident...')
}
if hungry?() {
if asleep {
asleep = false
print('He wakes up suddenly!')
}
print(name + "'s stomach grumbles...")
}
if poopy?() {
if asleep {
asleep = false
print('He wakes up suddenly!')
}
print(name + ' does the potty dance...')
}
}
-- Export the public interface to this closure object.
{
feed: feed
walk: walk
put-to-bed: put-to-bed
toss: toss
rock: rock
}
}
pet = Dragon('Norbert')
pet.feed()
pet.toss()
pet.walk()
pet.put-to-bed()
pet.rock()
pet.put-to-bed()
pet.put-to-bed()
pet.put-to-bed()
pet.put-to-bed()

View file

@ -1,57 +0,0 @@
{
# Name of our deployment
network.description = "HelloWorld";
# Enable rolling back to previous versions of our infrastructure
network.enableRollback = true;
# It consists of a single server named 'helloserver'
helloserver =
# Every server gets passed a few arguments, including a reference
# to nixpkgs (pkgs)
{ config, pkgs, ... }:
let
# We import our custom packages from ./default passing pkgs as argument
packages = import ./default.nix { pkgs = pkgs; };
# This is the nodejs version specified in default.nix
nodejs = packages.nodejs;
# And this is the application we'd like to deploy
app = packages.app;
in
{
# We'll be running our application on port 8080, because a regular
# user cannot bind to port 80
# Then, using some iptables magic we'll forward traffic designated to port 80 to 8080
networking.firewall.enable = true;
# We will open up port 22 (SSH) as well otherwise we're locking ourselves out
networking.firewall.allowedTCPPorts = [ 80 8080 22 ];
networking.firewall.allowPing = true;
# Port forwarding using iptables
networking.firewall.extraCommands = ''
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
'';
# To run our node.js program we're going to use a systemd service
# We can configure the service to automatically start on boot and to restart
# the process in case it crashes
systemd.services.helloserver = {
description = "Hello world application";
# Start the service after the network is available
after = [ "network.target" ];
# We're going to run it on port 8080 in production
environment = { PORT = "8080"; };
serviceConfig = {
# The actual command to run
ExecStart = "${nodejs}/bin/node ${app}/server.js";
# For security reasons we'll run this process as a special 'nodejs' user
User = "nodejs";
Restart = "always";
};
};
# And lastly we ensure the user we run our application as is created
users.extraUsers = {
nodejs = { };
};
};
}

View file

@ -1,171 +0,0 @@
%abc-2.1
H:This file contains some example English tunes
% note that the comments (like this one) are to highlight usages
% and would not normally be included in such detail
O:England % the origin of all tunes is England
X:1 % tune no 1
T:Dusty Miller, The % title
T:Binny's Jig % an alternative title
C:Trad. % traditional
R:DH % double hornpipe
M:3/4 % meter
K:G % key
B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:|
Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:|
BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:|
W:Hey, the dusty miller, and his dusty coat;
W:He will win a shilling, or he spend a groat.
W:Dusty was the coat, dusty was the colour;
W:Dusty was the kiss, that I got frae the miller.
X:2
T:Old Sir Simon the King
C:Trad.
S:Offord MSS % from Offord manuscript
N:see also Playford % reference note
M:9/8
R:SJ % slip jig
N:originally in C % transcription note
K:G
D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:|
D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|[A2G] F2E D2:|\ % no line-break in score
M:12/8 % change of meter
[2 E2E EFE E2E EFG|\ % no line-break in score
M:9/8 % change of meter
A2G F2E D2|]
X:3
T:William and Nancy
T:New Mown Hay
T:Legacy, The
C:Trad.
O:England; Gloucs; Bledington % place of origin
B:Sussex Tune Book % can be found in these books
B:Mally's Cotswold Morris vol.1 2
D:Morris On % can be heard on this record
P:(AB)2(AC)2A % play the parts in this order
M:6/8
K:G
[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d B2d|"C"gfe "D7"d2c|
"G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
% changes of meter, using inline fields
[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\
"C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c|
"G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
X:4
T:South Downs Jig
R:jig
S:Robert Harbron
M:6/8
L:1/8
K:G
|: d | dcA G3 | EFG AFE | DEF GAB | cde d2d |
dcA G3 | EFG AFE | DEF GAB | cAF G2 :|
B | Bcd e2c | d2B c2A | Bcd e2c | [M:9/8]d2B c2B A3 |
[M:6/8]DGF E3 | cBA FED | DEF GAB |1 cAF G2 :|2 cAF G3 |]
X:5
T:Atholl Brose
% in this example, which reproduces Highland Bagpipe gracing,
% the large number of grace notes mean that it is more convenient to be specific about
% score line-breaks (using the $ symbol), rather than using code line breaks to indicate them
I:linebreak $
K:D
{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad|
{gcd}c<{e}A {gAGAG}A>e {ag}a>f {gef}e>d|
{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad|
{g}c/d/e {g}G>{d}B {gf}gG {dc}d>B:|$
{g}c<e {gf}g>e {ag}a>e {gf}g>e|
{g}c<e {gf}g>e {ag}a2 {GdG}a>d|
{g}c<e {gf}g>e {ag}a>e {gf}g>f|
{gef}e>d {gf}g>d {gBd}B<{e}G {dc}d>B|
{g}c<e {gf}g>e {ag}a>e {gf}g>e|
{g}c<e {gf}g>e {ag}a2 {GdG}ad|
{g}c<{GdG}e {gf}ga {f}g>e {g}f>d|
{g}e/f/g {Gdc}d>c {gBd}B<{e}G {dc}d2|]
X:6
T:Untitled Reel
C:Trad.
K:D
eg|a2ab ageg|agbg agef|g2g2 fgag|f2d2 d2:|\
ed|cecA B2ed|cAcA E2ed|cecA B2ed|c2A2 A2:|
K:G
AB|cdec BcdB|ABAF GFE2|cdec BcdB|c2A2 A2:|
X:7
T:Kitchen Girl
C:Trad.
K:D
[c4a4] [B4g4]|efed c2cd|e2f2 gaba|g2e2 e2fg|
a4 g4|efed cdef|g2d2 efed|c2A2 A4:|
K:G
ABcA BAGB|ABAG EDEG|A2AB c2d2|e3f edcB|ABcA BAGB|
ABAG EGAB|cBAc BAG2|A4 A4:|
%abc-2.1
%%pagewidth 21cm
%%pageheight 29.7cm
%%topspace 0.5cm
%%topmargin 1cm
%%botmargin 0cm
%%leftmargin 1cm
%%rightmargin 1cm
%%titlespace 0cm
%%titlefont Times-Bold 32
%%subtitlefont Times-Bold 24
%%composerfont Times 16
%%vocalfont Times-Roman 14
%%staffsep 60pt
%%sysstaffsep 20pt
%%musicspace 1cm
%%vocalspace 5pt
%%measurenb 0
%%barsperstaff 5
%%scale 0.7
X: 1
T: Canzonetta a tre voci
C: Claudio Monteverdi (1567-1643)
M: C
L: 1/4
Q: "Andante mosso" 1/4 = 110
%%score [1 2 3]
V: 1 clef=treble name="Soprano"sname="A"
V: 2 clef=treble name="Alto" sname="T"
V: 3 clef=bass middle=d name="Tenor" sname="B"
%%MIDI program 1 75 % recorder
%%MIDI program 2 75
%%MIDI program 3 75
K: Eb
% 1 - 4
[V: 1] |:z4 |z4 |f2ec |_ddcc |
w: Son que-sti~i cre-spi cri-ni~e
w: Que-sti son gli~oc-chi che mi-
[V: 2] |:c2BG|AAGc|(F/G/A/B/)c=A|B2AA |
w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e
w: Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi-
[V: 3] |:z4 |f2ec|_ddcf |(B/c/_d/e/)ff|
w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il
w: Que-sti son~gli oc-chi che mi-ran - - - - do
% 5 - 9
[V: 1] cAB2 |cAAA |c3B|G2!fermata!Gz ::e4|
w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,
w: ran-do fi-so, tut-to re-stai con-qui-so.
[V: 2] AAG2 |AFFF |A3F|=E2!fermata!Ez::c4|
w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,
w: ran-do fi-so tut-to re-stai con-qui-so.
[V: 3] (ag/f/e2)|A_ddd|A3B|c2!fermata!cz ::A4|
w: vi - - - so ond' io ti-man-go~uc-ci-so. Deh,
w: fi - - - so tut-to re-stai con-qui-so.
% 10 - 15
[V: 1] f_dec |B2c2|zAGF |\
w: dim-me-lo ben mi-o, che que-sto\
=EFG2 |1F2z2:|2F8|] % more notes
w: sol de-si-o_. % more lyrics
[V: 2] ABGA |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|]
w: dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_.
[V: 3] _dBc>d|e2AF|=EFc_d|c4 |1F2z2:|2F8|]
w: dim-me-lo ben mi-o, che que-sto sol de-si-o_.

View file

@ -1,5 +0,0 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line("Hello, world!");
end Hello;

View file

@ -1,4 +1,4 @@
Searching for var in/.c9/metadata/workspace/pluginsregexp, case sensitive, whole word
Searching for 'var' in /workspace/configs
configs/default.js:
1: var fs = require("fs");

View file

@ -1,42 +0,0 @@
-- https://github.com/Cirru/cirru-gopher/blob/master/code/scope.cr,
set a (int 2)
print (self)
set c (child)
under c
under parent
print a
print $ get c a
set c x (int 3)
print $ get c x
set just-print $ code
print a
print just-print
eval (self) just-print
eval just-print
print (string "string with space")
print (string "escapes \n \"\\")
brackets ((((()))))
"eval" $ string "eval"
print (add $ (int 1) (int 2))
print $ unwrap $
map (a $ int 1) (b $ int 2)
print a
int 1
, b c
int 2
, d

View file

@ -1 +0,0 @@
TODO

View file

@ -1,18 +1,28 @@
.text-layer {
font: 12px Monaco, "Courier New", monospace;
font-family: Monaco, "Courier New", monospace;
font-size: 12pX;
cursor: text;
}
.blinker {
animation: blink 1s linear infinite alternate;
animation-duration: 1s;
animation-name: blink;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-timing-function: linear;
}
@keyframes blink {
0%, 40% {
0% {
opacity: 0;
}
40.5%, 100% {
40% {
opacity: 0;
}
40.5% {
opacity: 1
}
100% {
opacity: 1
}
}

View file

@ -1,14 +0,0 @@
#!/usr/bin/env rdmd
// Computes average line length for standard input.
import std.stdio;
void main() {
ulong lines = 0;
double sumLength = 0;
foreach (line; stdin.byLine()) {
++lines;
sumLength += line.length;
}
writeln("Average line length: ",
lines ? sumLength / lines : 0);
}

View file

@ -1,19 +1,58 @@
// Go ahead and modify this example.
import "dart:html";
// Computes the nth Fibonacci number.
int fibonacci(int n) {
if (n < 2) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
main() {
print('Hello World!');
}
// Displays a Fibonacci number.
void main() {
int i = 20;
String message = "fibonacci($i) = ${fibonacci(i)}";
// This example uses HTML to display the result and it will appear
// in a nested HTML frame (an iframe).
document.body.append(new HeadingElement.h1()..appendText(message));
int fib(int n) => (n > 1) ? (fib(n - 1) + fib(n - 2)) : n;
main() {
print('fib(20) = ${fib(20)}');
}
/*asd
asdad
*/
0.67
77
.86
import("http://dartwatch.com/myOtherLibrary.dart");
import("myOtherLibrary.dart", prefix:"lib1");
"""asdasdads
asdadsadsasd
asdasdasdad"""
'23424'
0x234
foo is bar
int x = 4 << 10
// Create a class for Point.
class Point {
// Final variables cannot be changed once they are assigned.
// Create two instance variables.
final num x, y;
// A constructor, with syntactic sugar for setting instance variables.
Point(this.x, this.y);
// A named constructor with an initializer list.
Point.origin() : x = 0, y = 0;
// A method.
num distanceTo(Point other) {
var dx = x - other.x;
var dy = y - other.y;
return sqrt(dx * dx + dy * dy);
}
}
// Check for null.
var unicorn;
assert(unicorn == null);
// Check for NaN.
var iMeantToDoThis = 0/0;
assert(iMeantToDoThis.isNaN());

View file

@ -1,30 +0,0 @@
note
description: "Represents a person."
class
PERSON
create
make, make_unknown
feature {NONE} -- Creation
make (a_name: like name)
-- Create a person with `a_name' as `name'.
do
name := a_name
ensure
name = a_name
end
make_unknown
do ensure
name = Void
end
feature -- Access
name: detachable STRING
-- Full name or Void if unknown.
end

View file

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Cloud9 Rocks!</title>
</head>
<body>
<table class="table">
<tr>
<th>Name</th>
<th>Size</th>
</tr>
<% if (!isRoot) { %>
<tr>
<td><a href="..">..</a></td>
<td></td></td>
</tr>
<% } %>
<% entries.forEach(function(entry) { %>
<tr>
<td>
<span class="glyphicon <%= entry.mime == 'directory' ? 'folder': 'file'%>"></span>
<a href="<%= entry.name %>"><%= entry.name %></a>
</td>
<td><%= entry.size %></td>
</tr>
<% }) %>
</table>
</body>
</html>

View file

@ -1,42 +0,0 @@
defmodule HelloModule do
@moduledoc """
This is supposed to be `markdown`.
__Yes__ this is [mark](http://down.format)
# Truly
## marked
* with lists
* more
* and more
Even.with(code)
blocks |> with |> samples
_Docs are first class citizens in Elixir_ (Jose Valim)
"""
# A "Hello world" function
def some_fun do
IO.puts "Juhu Kinners!"
end
# A private function
defp priv do
is_regex ~r"""
This is a regex
spanning several
lines.
"""
x = elem({ :a, :b, :c }, 0) #=> :a
end
end
test_fun = fn(x) ->
cond do
x > 10 ->
:greater_than_ten
true ->
:maybe_ten
end
end

View file

@ -1,12 +0,0 @@
{- Ace {- 4 -} Elm -}
main = lift clock (every second)
clock t = collage 400 400 [ filled lightGrey (ngon 12 110)
, outlined (solid grey) (ngon 12 110)
, hand orange 100 t
, hand charcoal 100 (t/60)
, hand charcoal 60 (t/720) ]
hand clr len time =
let angle = degrees (90 - 6 * inSeconds time)
in traced (solid clr) <| segment (0,0) (len * cos angle, len * sin angle)

View file

@ -1,31 +0,0 @@
O003 (DIAMOND SQUARE)
N2 G54 G90 G49 G80
N3 M6 T1 (1.ENDMILL)
N4 M3 S1800
N5 G0 X-.6 Y2.050
N6 G43 H1 Z.1
N7 G1 Z-.3 F50.
N8 G41 D1 Y1.45
N9 G1 X0 F20.
N10 G2 J-1.45
(CUTTER COMP CANCEL)
N11 G1 Z-.2 F50.
N12 Y-.990
N13 G40
N14 G0 X-.6 Y1.590
N15 G0 Z.1
N16 M5 G49 G28 G91 Z0
N17 CALL O9456
N18 #500=0.004
N19 #503=[#500+#501]
N20 VC45=0.0006
VS4=0.0007
N21 G90 G10 L20 P3 X5.Y4. Z6.567
N22 G0 X5000
N23 IF [#1 LT 0.370] GOTO 49
N24 X-0.678 Y+.990
N25 G84.3 X-0.1
N26 #4=#5*COS[45]
N27 #4=#5*SIN[45]
N28 VZOFZ=652.9658
%

View file

@ -1,28 +0,0 @@
@these @are @tags
Feature: Serve coffee
Coffee should not be served until paid for
Coffee should not be served until the button has been pressed
If there is no coffee left then money should be refunded
Scenario Outline: Eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |
Scenario: Buy last coffee
Given there are 1 coffees left in the machine
And I have deposited 1$
When I press the coffee button
Then I should be served a "coffee"
# this a comment
"""
this is a
pystring
"""

View file

@ -1,8 +0,0 @@
{{!-- Ace + :-}} --}}
<div id="comments">
{{#each comments}}
<h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2>
<div>{{{body}}}</div>
{{/each}}
</div>

View file

@ -1,10 +0,0 @@
Redirect /linux http://www.linux.org
Redirect 301 /kernel http://www.linux.org
# comment
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*
RewriteRule ^/$ /homepage.max.html [L]
RewriteRule ^/$ /homepage.std.html [L]

View file

@ -1,4 +1,3 @@
<!DOCTYPE html>
<html>
<head>

View file

@ -11,7 +11,6 @@
<% @books.each do |book| %>
<tr>
<%# comment %>
<td><%= book.title %></td>
<td><%= book.content %></td>
<td><%= link_to 'Show', book %></td>

View file

@ -1,4 +0,0 @@
[.ShellClassInfo]
IconResource=..\logo.png
[ViewState]
FolderType=Generic

View file

@ -1,6 +0,0 @@
// computes factorial of a number
factorial := method(n,
if(n == 0, return 1)
res := 1
Range 1 to(n) foreach(i, res = res * i)
)

View file

@ -1 +0,0 @@
TODO

View file

@ -2,7 +2,7 @@ for op = (:+, :*, :&, :|, :$)
@eval ($op)(a,b,c) = ($op)(($op)(a,b),c)
end
v = α';
function g(x,y)
return x * y
x + y

View file

@ -1,9 +0,0 @@
import logic
section
variables (A : Type) (p q : A Prop)
example : (x : A, p x q x) y : A, p y :=
assume H : x : A, p x q x,
take y : A,
show p y, from and.elim_left (H y)
end

View file

@ -8,7 +8,7 @@ integer someIntNormal = 3672;
integer someIntHex = 0x00000000;
integer someIntMath = PI_BY_TWO;
integer event = 5673; // invalid.illegal
integer event = 5673; // invalid reserved keyword!
key someKeyTexture = TEXTURE_DEFAULT;
string someStringSpecial = EOF;
@ -53,12 +53,12 @@ default
someIntHex = 0x00000000;
someIntMath = PI_BY_TWO;
event = 5673; // invalid.illegal
event = 5673; // invalid reserved keyword!
someKeyTexture = TEXTURE_DEFAULT;
someStringSpecial = EOF;
llSetInventoryPermMask("some item", MASK_NEXT, PERM_ALL); // reserved.godmode
llCollisionSprite(someKeyTexture); // invalid deprecated function!
llWhisper(PUBLIC_CHANNEL, "Leaving \"default\" now...");
state other;

View file

@ -34,5 +34,3 @@ print([===[
table.maxn is deprecated, use # instead.
--]=]--
print(table.maxn{1,2,[4]=4,[8]=8) -- outputs 8 instead of 2
print(5 --[[ blah ]])

View file

@ -1,52 +0,0 @@
/* Mask Syntax Demo */
div > ' Test ~[name]';
define :userProfile {
header {
h4 > @title;
button.close;
}
}
:userProfile {
@title > ' Hello ~[: username.toUpperCase()]'
}
style {
html, body {
background: url('name.png') 0 0 no-repeat;
}
}
button {
event click (e) {
this.textContent = `name ${e.clientX} !`;
}
}
md > """
- div
- span
Hello
[one](http://google.com)
""";
header .foo > 'Heading'
button .baz x-signal='click: test' disabled > "
Hello,
world
\"Buddy\"
"
var a = {
name: `name ${window.innerWidth}`
};
span .foo > "~[bind: a.name]"

View file

@ -1,17 +0,0 @@
%{
%{
Ace Matlab demo
%}
%}
classdef hello
methods
function greet(this)
disp('Hello!') % say hi
end
end
end
% transpose
a = [ 'x''y', "x\n\
y", 1' ]' + 2'

View file

@ -1,33 +0,0 @@
// animated duplicates, instances script
proc animatedDuplication (int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance)
{
int $range_start = $rangeStart;
int $range_end = $rangeEnd;
int $num_of_duplicates = $numOfDuplicates;
int $step_size = ($range_end - $range_start) / $num_of_duplicates;
int $i = 0;
int $temp;
currentTime $range_start; // set to range start
string $selectedObjects[]; // to store selected objects
$selectedObjects = `ls -sl`; // store selected objects
select $selectedObjects;
while ($i <= $num_of_duplicates)
{
$temp = $range_start + ($step_size * $i);
currentTime ($temp);
// seleced the objects to duplicate or instance
select $selectedObjects;
if($duplicateOrInstance == 0)
{
duplicate;
}
else
{
instance;
}
$i++;
}
}

View file

@ -1 +0,0 @@
TODO

View file

@ -41,8 +41,8 @@ SELECT city, temp_lo, temp_hi, prcp, "date", location
/**
* Dollar quotes starting at the end of the line are colored as SQL unless
* a special language tag is used. Dollar quote syntax coloring is implemented
* for Perl, Python, JavaScript, and Json.
* a special language tag is used. Pearl and Python are currently implemented
* but lots of others are possible.
*/
create or replace function blob_content_chunked(
in p_data bytea,
@ -82,24 +82,6 @@ CREATE FUNCTION usesavedplan() RETURNS trigger AS $python$
SD["plan"] = plan
$python$ LANGUAGE plpythonu;
-- pl/v8 (javascript)
CREATE FUNCTION plv8_test(keys text[], vals text[]) RETURNS text AS $javascript$
var o = {};
for(var i=0; i<keys.length; i++){
o[keys[i]] = vals[i];
}
return JSON.stringify(o);
$javascript$ LANGUAGE plv8 IMMUTABLE STRICT;
-- json
select * from json_object_keys($json$
{
"f1": 5,
"f2": "test",
"f3": {}
}
$json$);
-- psql commands
\df cash*

View file

@ -1,148 +0,0 @@
form Highlighter test
sentence My_sentence This should all be a string
text My_text This should also all be a string
word My_word Only the first word is a string, the rest is invalid
boolean Binary 1
boolean Text no
boolean Quoted "yes"
comment This should be a string
real left_Range -123.6
positive right_Range_max 3.3
integer Int 4
natural Nat 4
endform
# External scripts
include /path/to/file
runScript: "/path/to/file"
execute /path/to/file
stopwatch
# old-style procedure call
call oldStyle "quoted" 2 unquoted string
assert oldStyle.local = 1
# New-style procedure call with parens
@newStyle("quoted", 2, "quoted string")
if praatVersion >= 5364
# New-style procedure call with colon
@newStyle: "quoted", 2, "quoted string"
endif
# if-block with built-in variables
if windows
# We are on Windows
elsif unix = 1 or !macintosh
exitScript: "We are on Linux"
else macintosh == 1
exit We are on Mac
endif
# inline if with inline comment
var = if macintosh = 1 then 0 else 1 fi ; This is an inline comment
# for-loop with explicit from using local variable
# and paren-style function calls and variable interpolation
n = numberOfSelected("Sound")
for i from newStyle.local to n
sound'i' = selected("Sound", i)
sound[i] = sound'i'
endfor
for i from 1 to n
# Different styles of object selection
select sound'i'
sound = selected()
sound$ = selected$("Sound")
select Sound 'sound$'
selectObject(sound[i])
selectObject: sound
# Pause commands
beginPause("Viewing " + sound$)
if i > 1
button = endPause("Stop", "Previous",
...if i = total_sounds then "Finish" else "Next" fi,
...3, 1)
else
button = endPause("Stop",
...if i = total_sounds then "Finish" else "Next" fi,
...2, 1)
endif
editor_name$ = if total_textgrids then "TextGrid " else "Sound " fi + name$
nocheck editor 'editor_name$'
nocheck Close
nocheck endeditor
# New-style standalone command call
Rename: "SomeName"
# Command call with assignment
duration = Get total duration
# Multi-line command with modifier
pitch = noprogress To Pitch (ac): 0, 75, 15, "no",
...0.03, 0.45, 0.01, 0.35, 0.14, 600
# do-style command with assignment
minimum = do("Get minimum...", 0, 0, "Hertz", "Parabolic")
# New-style multi-line command call with broken strings
table = Create Table with column names: "table", 0,
..."file subject speaker
...f0 f1 f2 f3 " +
..."duration response"
removeObject: pitch, table
# Picture window commands
selectObject: sound
# do-style command
do("Select inner viewport...", 1, 6, 0.5, 1.5)
Black
Draw... 0 0 0 0 "no" Curve
Draw inner box
Text bottom: "yes", sound$
Erase all
# Demo window commands
demo Erase all
demo Select inner viewport... 0 100 0 100
demo Axes... 0 100 0 100
demo Paint rectangle... white 0 100 0 100
demo Text... 50 centre 50 half Click to finish
demoWaitForInput ( )
demo Erase all
demo Text: 50, "centre", 50, "half", "Finished"
endfor
# An old-style sendpraat block
sendpraat Praat
...'newline$' Create Sound as pure tone... "tone" 1 0 0.4 44100 440 0.2 0.01 0.01
...'newline$' Play
...'newline$' Remove
# A new-style sendpraat block
beginSendPraat: "Praat"
Create Sound as pure tone: "tone", 1, 0, 0.4, 44100, 440, 0.2, 0.01, 0.01
duration = Get total duration
Remove
endSendPraat: "duration"
appendInfoLine: "The generated sound lasted for ", duration, "seconds"
time = stopwatch
clearinfo
echo This script took
print 'time' seconds to
printline execute.
# Old-style procedure declaration
procedure oldStyle .str1$ .num .str2$
.local = 1
endproc
# New-style procedure declaration
procedure newStyle (.str1$, .num, .str2$)
.local = 1
endproc

View file

@ -1,16 +0,0 @@
message Point {
required int32 x = 1;
required int32 y = 2;
optional string label = 3;
}
message Line {
required Point start = 1;
required Point end = 2;
optional string label = 3;
}
message Polyline {
repeated Point point = 1;
optional string label = 2;
}

View file

@ -20,7 +20,7 @@ class Range
end
end
{:id => ?", :key => "value"}
{:id => 34, :key => "value"}
herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment

View file

@ -2,9 +2,9 @@
# Script to open a browser to current branch
# Repo formats:
# ssh git@github.com:richo/gh_pr.git
# http https://richoH@github.com/richo/gh_pr.git
# git git://github.com/richo/gh_pr.git
# ssh git@github.com:richoH/gh_pr.git
# http https://richoH@github.com/richoH/gh_pr.git
# git git://github.com/richoH/gh_pr.git
username=`git config --get github.user`

View file

@ -1,28 +0,0 @@
var { each, map } = require('sjs:sequence');
var { get } = require('sjs:http');
function foo(items, nada) {
var component = { name: "Ace", role: "Editor" };
console.log("
Welcome, #{component.name}
".trim());
logging.debug(`Component added: $String(component) (${component})`);
console.log(`
Welcome, {${function() {
return { x: 1, y: "why?}"};
}()}
`.trim());
waitfor {
items .. each.par { |item|
get(item);
}
} and {
var lengths = items .. map(i -> i.length);
} or {
hold(1500);
throw new Error("timed out");
}
} // Real Tab.

View file

@ -1,7 +0,0 @@
{foreach $foo as $bar}
<a href="{$bar.zig}">{$bar.zag}</a>
<a href="{$bar.zig2}">{$bar.zag2}</a>
<a href="{$bar.zig3}">{$bar.zag3}</a>
{foreachelse}
There were no rows found.
{/foreach}

View file

@ -1,46 +0,0 @@
/**
* Greets a person using "Hello" by default.
* @param name The name of the person.
* @param? greetingWord Optional greeting word to use instead of "Hello".
*/
{template .helloName #eee}
{if not $greetingWord}
Hello {$name}!
{else}
{$greetingWord} {$name}!
{/if}
{/template}
/**
* Greets a person and optionally a list of other people.
* @param name The name of the person.
* @param additionalNames The additional names to greet. May be an empty list.
*/
{template .helloNames}
// Greet the person.
{call .helloName data="all" /}<br>
// Greet the additional people.
{foreach $additionalName in $additionalNames}
{call .helloName}
{param name: $additionalName /}
{/call}
{if not isLast($additionalName)}
<br> // break after every line except the last
{/if}
{ifempty}
No additional people to greet.
{/foreach}
{/template}
{/foreach}
{if length($items) > 5}
{msg desc="Says hello to the user."}
{namespace ns autoescape="contextual"}
/** Example. */
{template .example}
foo is {$ij.foo}
{/template}

View file

@ -1,56 +0,0 @@
query
count 10
created 2011-06-21T08:10:46Z
lang en-US
results
photo
0
farm 6
id 5855620975
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret f1f5e8515d
server 5110
title 7087 bandit cat
1
farm 4
id 5856170534
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret ff1efb2a6f
server 3217
title 6975 rusty cat
2
farm 6
id 5856172972
isfamily 0
isfriend 0
ispublic 1
owner 51249875@N03
secret 6c6887347c
server 5192
title watermarked-cats
3
farm 6
id 5856168328
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret 0c1cfdf64c
server 5078
title 7020 mandy cat
4
farm 3
id 5856171774
isfamily 0
isfriend 0
ispublic 1
owner 32021554@N04
secret 7f5a3180ab
server 2696
title 7448 bobby cat

View file

@ -1,72 +0,0 @@
-- =============================================
-- Author: Morgan Yarbrough
-- Create date: 4/27/2015
-- Description: Test procedure that shows off language features.
-- Includes non-standard folding with region comments using either
-- line comments or block comments (both are demonstrated below).
-- This mode imitates SSMS and it designed to be used with SQL Server theme.
-- =============================================
CREATE PROCEDURE dbo.TestProcedure
--#region parameters
@vint INT = 1
,@vdate DATE = NULL
,@vdatetime DATETIME = DATEADD(dd, 1, GETDATE())
,@vvarchar VARCHAR(MAX) = ''
--#endregion
AS
BEGIN
/*#region set statements */
SET NOCOUNT ON;
SET XACT_ABORT ON;
SET QUOTED_IDENTIFIER ON;
/*#endregion*/
/**
* These comments will produce a fold widget
*/
-- folding demonstration
SET @vint = CASE
WHEN @vdate IS NULL
THEN 1
ELSE 2
END
-- another folding demonstration
IF @vint = 1
BEGIN
SET @vvarchar = 'one'
SET @vint = DATEDIFF(dd, @vdate, @vdatetime)
END
-- this mode handles strings properly
DECLARE @sql NVARCHAR(4000) = N'SELECT TOP(1) OrderID
FROM Orders
WHERE @OrderDate > GETDATE()'
-- this mode is aware of built in stored procedures
EXECUTE sp_executesql @sql
-- demonstrating some syntax highlighting
SELECT Orders.OrderID
,Customers.CompanyName
,DATEFROMPARTS(YEAR(GETDATE()), 1, 1) AS FirstDayOfYear
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID = Customers.CustomerID
WHERE CompanyName NOT LIKE '%something'
OR CompanyName IS NULL
OR CompanyName IN ('bla', 'nothing')
-- this mode includes snippets
-- place your cusor at the end of the line below and trigger auto complete (Ctrl+Space)
createpr
-- SQL Server allows using keywords as object names (not recommended) as long as they are wrapped in brackets
DATABASE -- keyword
[DATABASE] -- not a keyword
END

View file

@ -1,30 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href|escape }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>
{% autoescape true %}
{{ var }}
{{ var|raw }} {# var won't be escaped #}
{{ var|escape }} {# var won't be doubled-escaped #}
{% endautoescape %}
{% if 1 not in [1, 2, 3] %}
{{ include('twig.html', sandboxed = true) }}
{# is equivalent to #}
{% if not (1 in [1, 2, 3]) %}
{% autoescape true %}
{{ var }}
{{ var|raw }} {# var won't be escaped #}
{{ var|escape }} {# var won't be doubled-escaped #}
{% endautoescape %}
{{ include('twig.html', sandboxed = true) }}
{{"string #{with} \" escapes" 'another#one' }}
<h1>My Webpage</h1>
{{ a_variable }}
</body>
</html>
{{"string #{with} \" escapes" 'another#one' }}

View file

@ -1,21 +0,0 @@
using Gtk;
int main (string[] args) {
Gtk.init (ref args);
var foo = new MyFoo<string[](), MyBar<string, int>>();
var window = new Window();
window.title = "Hello, World!";
window.border_width = 10;
window.window_position = WindowPosition.CENTER;
window.set_default_size(350, 70);
window.destroy.connect(Gtk.main_quit);
var label = new Label("Hello, World!");
window.add(label);
window.show_all();
Gtk.main();
return 0;
}

View file

@ -1,12 +0,0 @@
always @(negedge reset or posedge clk) begin
if (reset == 0) begin
d_out <= 16'h0000;
d_out_mem[resetcount] <= d_out;
laststoredvalue <= d_out;
end else begin
d_out <= d_out + 1'b1;
end
end
always @(bufreadaddr)
bufreadval = d_out_mem[bufreadaddr];

View file

@ -1,34 +0,0 @@
library IEEE
user IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity COUNT16 is
port (
cOut :out std_logic_vector(15 downto 0); -- counter output
clkEn :in std_logic; -- count enable
clk :in std_logic; -- clock input
rst :in std_logic -- reset input
);
end entity;
architecture count_rtl of COUNT16 is
signal count :std_logic_vector (15 downto 0);
begin
process (clk, rst) begin
if(rst = '1') then
count <= (others=>'0');
elsif(rising_edge(clk)) then
if(clkEn = '1') then
count <= count + 1;
end if;
end if;
end process;
cOut <= count;
end architecture;

View file

@ -1,73 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var config = require("ace/config");
var event = require("ace/lib/event");
var modelist = require("ace/ext/modelist");
module.exports = function(editor) {
event.addListener(editor.container, "dragover", function(e) {
var types = e.dataTransfer.types;
if (types && Array.prototype.indexOf.call(types, 'Files') !== -1)
return event.preventDefault(e);
});
event.addListener(editor.container, "drop", function(e) {
var file;
try {
file = e.dataTransfer.files[0];
if (window.FileReader) {
var reader = new FileReader();
reader.onload = function() {
var mode = modelist.getModeForPath(file.name);
editor.session.doc.setValue(reader.result);
editor.session.setMode(mode.mode);
editor.session.modeName = mode.name;
};
reader.readAsText(file);
}
return event.preventDefault(e);
} catch(err) {
return event.stopEvent(e);
}
});
};
var Editor = require("ace/editor").Editor;
config.defineOptions(Editor.prototype, "editor", {
loadDroppedFile: {
set: function() { module.exports(this); },
value: true
}
});
});

View file

@ -1,102 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var LineWidgets = require("ace/line_widgets").LineWidgets;
var Editor = require("ace/editor").Editor;
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
var dom = require("ace/lib/dom");
require("ace/commands/default_commands").commands.push({
name: "openInlineEditor",
bindKey: "F3",
exec: function(editor) {
var split = window.env.split;
var s = editor.session;
var inlineEditor = new Editor(new Renderer());
var splitSession = split.$cloneSession(s);
var row = editor.getCursorPosition().row;
if (editor.session.lineWidgets && editor.session.lineWidgets[row]) {
editor.session.lineWidgets[row].destroy();
return;
}
var rowCount = 10;
var w = {
row: row,
// rowCount: rowCount,
fixedWidth: true,
el: dom.createElement("div"),
editor: inlineEditor
};
var el = w.el;
el.appendChild(inlineEditor.container);
if (!editor.session.widgetManager) {
editor.session.widgetManager = new LineWidgets(editor.session);
editor.session.widgetManager.attach(editor);
}
var h = rowCount*editor.renderer.layerConfig.lineHeight;
inlineEditor.container.style.height = h + "px";
el.style.position = "absolute";
el.style.zIndex = "4";
el.style.borderTop = "solid blue 2px";
el.style.borderBottom = "solid blue 2px";
inlineEditor.setSession(splitSession);
editor.session.widgetManager.addLineWidget(w);
var kb = {
handleKeyboard:function(_,hashId, keyString) {
if (hashId === 0 && keyString === "esc") {
w.destroy();
return true;
}
}
};
w.destroy = function() {
editor.keyBinding.removeKeyboardHandler(kb);
s.widgetManager.removeLineWidget(w);
};
editor.keyBinding.addKeyboardHandler(kb);
inlineEditor.keyBinding.addKeyboardHandler(kb);
inlineEditor.setTheme("ace/theme/solarized_light");
}
});
});

View file

@ -103,6 +103,11 @@ var Split = function(){
exports.singleLineEditor = function(el) {
var renderer = new Renderer(el);
el.style.overflow = "hidden";
renderer.scrollBar.element.style.top = "0";
renderer.scrollBar.element.style.display = "none";
renderer.scrollBar.orginalWidth = renderer.scrollBar.width;
renderer.scrollBar.width = 0;
renderer.content.style.height = "auto";
renderer.screenToTextCoordinates = function(x, y) {
var pos = this.pixelToScreenCoordinates(x, y);
@ -112,15 +117,72 @@ exports.singleLineEditor = function(el) {
);
};
renderer.$maxLines = 4;
renderer.maxLines = 4;
renderer.$computeLayerConfigWithScroll = renderer.$computeLayerConfig;
renderer.$computeLayerConfig = function() {
var config = this.layerConfig;
var height = this.session.getScreenLength() * this.lineHeight;
if (config.height != height) {
var vScroll = height > this.maxLines * this.lineHeight;
if (vScroll != this.$vScroll) {
if (vScroll) {
this.scrollBar.element.style.display = "";
this.scrollBar.width = this.scrollBar.orginalWidth;
this.container.style.height = config.height + "px";
height = config.height;
this.scrollTop = height - this.maxLines * this.lineHeight;
} else {
this.scrollBar.element.style.display = "none";
this.scrollBar.width = 0;
}
this.onResize();
this.$vScroll = vScroll;
}
if (this.$vScroll)
return renderer.$computeLayerConfigWithScroll();
this.container.style.height = height + "px";
this.scroller.style.height = height + "px";
this.content.style.height = height + "px";
this._emit("resize");
}
var longestLine = this.$getLongestLine();
var firstRow = 0;
var lastRow = this.session.getLength();
this.scrollTop = 0;
config.width = longestLine;
config.padding = this.$padding;
config.firstRow = 0;
config.firstRowScreen = 0;
config.lastRow = lastRow;
config.lineHeight = this.lineHeight;
config.characterWidth = this.characterWidth;
config.minHeight = height;
config.maxHeight = height;
config.offset = 0;
config.height = height;
this.$gutterLayer.element.style.marginTop = 0 + "px";
this.content.style.marginTop = 0 + "px";
this.content.style.width = longestLine + 2 * this.$padding + "px";
};
renderer.isScrollableBy=function(){return false};
renderer.setStyle("ace_one-line");
var editor = new Editor(renderer);
new MultiSelect(editor);
editor.session.setUndoManager(new UndoManager());
editor.setHighlightActiveLine(false);
editor.setShowPrintMargin(false);
editor.renderer.setShowGutter(false);
editor.renderer.setHighlightGutterLine(false);
editor.$mouseHandler.$focusWaitTimout = 0;
return editor;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Before After
Before After

View file

@ -1,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.11+ Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
* @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) {
var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.11+',
version = '2.1.5',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/,
@ -22,7 +22,7 @@ var requirejs, require, define;
hasOwn = op.hasOwnProperty,
ap = Array.prototype,
apsp = ap.splice,
isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
isBrowser = !!(typeof window !== 'undefined' && navigator && document),
isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
//PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is 'loading', 'loaded', execution,
@ -108,10 +108,7 @@ var requirejs, require, define;
if (source) {
eachProp(source, function (value, prop) {
if (force || !hasProp(target, prop)) {
if (deepStringMixin && typeof value === 'object' && value &&
!isArray(value) && !isFunction(value) &&
!(value instanceof RegExp)) {
if (deepStringMixin && typeof value !== 'string') {
if (!target[prop]) {
target[prop] = {};
}
@ -137,11 +134,7 @@ var requirejs, require, define;
return document.getElementsByTagName('script');
}
function defaultOnError(err) {
throw err;
}
//Allow getting a global that is expressed in
//Allow getting a global that expressed in
//dot notation, like 'a.b.c'.
function getGlobal(value) {
if (!value) {
@ -180,7 +173,7 @@ var requirejs, require, define;
if (typeof requirejs !== 'undefined') {
if (isFunction(requirejs)) {
//Do not overwrite an existing requirejs instance.
//Do not overwrite and existing requirejs instance.
return;
}
cfg = requirejs;
@ -204,7 +197,6 @@ var requirejs, require, define;
waitSeconds: 7,
baseUrl: './',
paths: {},
bundles: {},
pkgs: {},
shim: {},
config: {}
@ -218,7 +210,6 @@ var requirejs, require, define;
defQueue = [],
defined = {},
urlFetched = {},
bundlesMap = {},
requireCounter = 1,
unnormalizedCounter = 1;
@ -232,8 +223,8 @@ var requirejs, require, define;
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part, length = ary.length;
for (i = 0; i < length; i++) {
var i, part;
for (i = 0; ary[i]; i += 1) {
part = ary[i];
if (part === '.') {
ary.splice(i, 1);
@ -266,7 +257,7 @@ var requirejs, require, define;
* @returns {String} normalized name
*/
function normalize(name, baseName, applyMap) {
var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
foundMap, foundI, foundStarMap, starI,
baseParts = baseName && baseName.split('/'),
normalizedBaseParts = baseParts,
@ -279,26 +270,29 @@ var requirejs, require, define;
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
//Convert baseName to array, and lop off the last part,
//so that . matches that 'directory' and not name of the baseName's
//module. For instance, baseName of 'one/two/three', maps to
//'one/two/three.js', but we want the directory, 'one/two' for
//this normalization.
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
name = name.split('/');
lastIndex = name.length - 1;
// If wanting node ID compatibility, strip .js from end
// of IDs. Have to do this here, and not in nameToUrl
// because node allows either .js or non .js to map
// to same file.
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
if (getOwn(config.pkgs, baseName)) {
//If the baseName is a package name, then just treat it as one
//name to concat the name with.
normalizedBaseParts = baseParts = [baseName];
} else {
//Convert baseName to array, and lop off the last part,
//so that . matches that 'directory' and not name of the baseName's
//module. For instance, baseName of 'one/two/three', maps to
//'one/two/three.js', but we want the directory, 'one/two' for
//this normalization.
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
}
name = normalizedBaseParts.concat(name);
name = normalizedBaseParts.concat(name.split('/'));
trimDots(name);
//Some use of packages may use a . path to reference the
//'main' module name, so normalize for that.
pkgConfig = getOwn(config.pkgs, (pkgName = name[0]));
name = name.join('/');
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
name = pkgName;
}
} else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
@ -310,7 +304,7 @@ var requirejs, require, define;
if (applyMap && map && (baseParts || starMap)) {
nameParts = name.split('/');
outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
for (i = nameParts.length; i > 0; i -= 1) {
nameSegment = nameParts.slice(0, i).join('/');
if (baseParts) {
@ -327,12 +321,16 @@ var requirejs, require, define;
//Match, update name to the new value.
foundMap = mapValue;
foundI = i;
break outerLoop;
break;
}
}
}
}
if (foundMap) {
break;
}
//Check for a star map match, but just hold on to it,
//if there is a shorter segment match later in a matching
//config, then favor over this star map.
@ -353,11 +351,7 @@ var requirejs, require, define;
}
}
// If the name points to a package's name, use
// the package main instead.
pkgMain = getOwn(config.pkgs, name);
return pkgMain ? pkgMain : name;
return name;
}
function removeScript(name) {
@ -375,17 +369,12 @@ var requirejs, require, define;
function hasPathFallback(id) {
var pathConfig = getOwn(config.paths, id);
if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
removeScript(id);
//Pop off the first array value, since it failed, and
//retry
pathConfig.shift();
context.require.undef(id);
//Custom require that does not do map translation, since
//ID is "absolute", already mapped/resolved.
context.makeRequire(null, {
skipMap: true
})([id]);
context.require([id]);
return true;
}
}
@ -511,12 +500,7 @@ var requirejs, require, define;
fn(defined[id]);
}
} else {
mod = getModule(depMap);
if (mod.error && name === 'error') {
fn(mod.error);
} else {
mod.on(name, fn);
}
getModule(depMap).on(name, fn);
}
}
@ -556,7 +540,7 @@ var requirejs, require, define;
//local var ref to defQueue, so cannot just reassign the one
//on context.
apsp.apply(defQueue,
[defQueue.length, 0].concat(globalDefQueue));
[defQueue.length - 1, 0].concat(globalDefQueue));
globalDefQueue = [];
}
}
@ -573,7 +557,7 @@ var requirejs, require, define;
mod.usingExports = true;
if (mod.map.isDefine) {
if (mod.exports) {
return (defined[mod.map.id] = mod.exports);
return mod.exports;
} else {
return (mod.exports = defined[mod.map.id] = {});
}
@ -587,9 +571,9 @@ var requirejs, require, define;
id: mod.map.id,
uri: mod.map.url,
config: function () {
return getOwn(config.config, mod.map.id) || {};
return (config.config && getOwn(config.config, mod.map.id)) || {};
},
exports: mod.exports || (mod.exports = {})
exports: defined[mod.map.id]
});
}
}
@ -630,7 +614,7 @@ var requirejs, require, define;
}
function checkLoaded() {
var err, usingPathFallback,
var map, modId, err, usingPathFallback,
waitInterval = config.waitSeconds * 1000,
//It is possible to disable the wait interval by using waitSeconds of 0.
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
@ -648,8 +632,8 @@ var requirejs, require, define;
//Figure out the state of all the modules.
eachProp(enabledRegistry, function (mod) {
var map = mod.map,
modId = map.id;
map = mod.map;
modId = map.id;
//Skip things that are not enabled or in error state.
if (!mod.enabled) {
@ -856,13 +840,8 @@ var requirejs, require, define;
if (this.depCount < 1 && !this.defined) {
if (isFunction(factory)) {
//If there is an error listener, favor passing
//to that instead of throwing an error. However,
//only do it for define()'d modules. require
//errbacks should not be called for failures in
//their callbacks (#699). However if a global
//onError is set, use that.
if ((this.events.error && this.map.isDefine) ||
req.onError !== defaultOnError) {
//to that instead of throwing an error.
if (this.events.error) {
try {
exports = context.execCb(id, factory, depExports, exports);
} catch (e) {
@ -872,14 +851,17 @@ var requirejs, require, define;
exports = context.execCb(id, factory, depExports, exports);
}
// Favor return value over exports. If node/cjs in play,
// then will not have a return value anyway. Favor
// module.exports assignment over exports object.
if (this.map.isDefine && exports === undefined) {
if (this.map.isDefine) {
//If setting exports via 'module' is in play,
//favor that over return value and exports. After that,
//favor a non-undefined return value over exports use.
cjsModule = this.module;
if (cjsModule) {
if (cjsModule &&
cjsModule.exports !== undefined &&
//Make sure it is not already the exports value
cjsModule.exports !== this.exports) {
exports = cjsModule.exports;
} else if (this.usingExports) {
} else if (exports === undefined && this.usingExports) {
//exports already set the defined value.
exports = this.exports;
}
@ -887,8 +869,8 @@ var requirejs, require, define;
if (err) {
err.requireMap = this.map;
err.requireModules = this.map.isDefine ? [this.map.id] : null;
err.requireType = this.map.isDefine ? 'define' : 'require';
err.requireModules = [this.map.id];
err.requireType = 'define';
return onError((this.error = err));
}
@ -939,7 +921,6 @@ var requirejs, require, define;
on(pluginMap, 'defined', bind(this, function (plugin) {
var load, normalizedMap, normalizedMod,
bundleId = getOwn(bundlesMap, this.map.id),
name = this.map.name,
parentName = this.map.parentMap ? this.map.parentMap.name : null,
localRequire = context.makeRequire(map.parentMap, {
@ -985,14 +966,6 @@ var requirejs, require, define;
return;
}
//If a paths config, then just load that file instead to
//resolve the plugin, as it is built into that paths layer.
if (bundleId) {
this.map.url = context.nameToUrl(bundleId);
this.load();
return;
}
load = bind(this, function (value) {
this.init([], function () { return value; }, null, {
enabled: true
@ -1120,7 +1093,7 @@ var requirejs, require, define;
}));
if (this.errback) {
on(depMap, 'error', bind(this, this.errback));
on(depMap, 'error', this.errback);
}
}
@ -1257,38 +1230,31 @@ var requirejs, require, define;
}
}
//Save off the paths since they require special processing,
//Save off the paths and packages since they require special processing,
//they are additive.
var shim = config.shim,
var pkgs = config.pkgs,
shim = config.shim,
objs = {
paths: true,
bundles: true,
config: true,
map: true
};
eachProp(cfg, function (value, prop) {
if (objs[prop]) {
if (!config[prop]) {
config[prop] = {};
if (prop === 'map') {
if (!config.map) {
config.map = {};
}
mixin(config[prop], value, true, true);
} else {
mixin(config[prop], value, true);
}
mixin(config[prop], value, true, true);
} else {
config[prop] = value;
}
});
//Reverse map the bundles
if (cfg.bundles) {
eachProp(cfg.bundles, function (value, prop) {
each(value, function (v) {
if (v !== prop) {
bundlesMap[v] = prop;
}
});
});
}
//Merge shim
if (cfg.shim) {
eachProp(cfg.shim, function (value, id) {
@ -1309,25 +1275,29 @@ var requirejs, require, define;
//Adjust packages if necessary.
if (cfg.packages) {
each(cfg.packages, function (pkgObj) {
var location, name;
var location;
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
name = pkgObj.name;
location = pkgObj.location;
if (location) {
config.paths[name] = pkgObj.location;
}
//Save pointer to main module ID for pkg name.
//Remove leading dot in main, so main paths are normalized,
//and remove any trailing .js, since different package
//envs have different conventions: some use a module name,
//some use a file name.
config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
.replace(currDirRegExp, '')
.replace(jsSuffixRegExp, '');
//Create a brand new object on pkgs, since currentPackages can
//be passed in again, and config.pkgs is the internal transformed
//state for all package configs.
pkgs[pkgObj.name] = {
name: pkgObj.name,
location: location || pkgObj.name,
//Remove leading dot in main, so main paths are normalized,
//and remove any trailing .js, since different package
//envs have different conventions: some use a module name,
//some use a file name.
main: (pkgObj.main || 'main')
.replace(currDirRegExp, '')
.replace(jsSuffixRegExp, '')
};
});
//Done with modifications, assing packages back to context config
config.pkgs = pkgs;
}
//If there are any "waiting to execute" modules in the registry,
@ -1474,21 +1444,10 @@ var requirejs, require, define;
var map = makeModuleMap(id, relMap, true),
mod = getOwn(registry, id);
removeScript(id);
delete defined[id];
delete urlFetched[map.url];
delete undefEvents[id];
//Clean queued defines too. Go backwards
//in array so that the splices do not
//mess up the iteration.
eachReverse(defQueue, function(args, i) {
if(args[0] === id) {
defQueue.splice(i, 1);
}
});
if (mod) {
//Hold on to listeners in case the
//module will be attempted to be reloaded
@ -1508,7 +1467,7 @@ var requirejs, require, define;
/**
* Called to enable a module if it is still in the registry
* awaiting enablement. A second arg, parent, the parent module,
* is passed in for context, when this method is overridden by
* is passed in for context, when this method is overriden by
* the optimizer. Not shown here to keep code compact.
*/
enable: function (depMap) {
@ -1582,19 +1541,8 @@ var requirejs, require, define;
* internal API, not a public one. Use toUrl for the public API.
*/
nameToUrl: function (moduleName, ext, skipExt) {
var paths, syms, i, parentModule, url,
parentPath, bundleId,
pkgMain = getOwn(config.pkgs, moduleName);
if (pkgMain) {
moduleName = pkgMain;
}
bundleId = getOwn(bundlesMap, moduleName);
if (bundleId) {
return context.nameToUrl(bundleId, ext, skipExt);
}
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
parentPath;
//If a colon is in the URL, it indicates a protocol is used and it is just
//an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
@ -1608,6 +1556,7 @@ var requirejs, require, define;
} else {
//A module that needs to be converted to a path.
paths = config.paths;
pkgs = config.pkgs;
syms = moduleName.split('/');
//For each module name segment, see if there is a path
@ -1615,7 +1564,7 @@ var requirejs, require, define;
//and work up from it.
for (i = syms.length; i > 0; i -= 1) {
parentModule = syms.slice(0, i).join('/');
pkg = getOwn(pkgs, parentModule);
parentPath = getOwn(paths, parentModule);
if (parentPath) {
//If an array, it means there are a few choices,
@ -1625,12 +1574,22 @@ var requirejs, require, define;
}
syms.splice(0, i, parentPath);
break;
} else if (pkg) {
//If module name is just the package name, then looking
//for the main module.
if (moduleName === pkg.name) {
pkgPath = pkg.location + '/' + pkg.main;
} else {
pkgPath = pkg.location;
}
syms.splice(0, i, pkgPath);
break;
}
}
//Join the path parts together, then figure out if baseUrl is needed.
url = syms.join('/');
url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
}
@ -1646,7 +1605,7 @@ var requirejs, require, define;
},
/**
* Executes a module callback function. Broken out as a separate function
* Executes a module callack function. Broken out as a separate function
* solely to allow the build system to sequence the files in the built
* layer in the right sequence.
*
@ -1684,7 +1643,7 @@ var requirejs, require, define;
onScriptError: function (evt) {
var data = getScriptData(evt);
if (!hasPathFallback(data.id)) {
return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
return onError(makeError('scripterror', 'Script error', evt, [data.id]));
}
}
};
@ -1813,19 +1772,8 @@ var requirejs, require, define;
* function. Intercept/override it if you want custom error handling.
* @param {Error} err the error object.
*/
req.onError = defaultOnError;
/**
* Creates the node for the load command. Only used in browser envs.
*/
req.createNode = function (config, moduleName, url) {
var node = config.xhtml ?
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
document.createElement('script');
node.type = config.scriptType || 'text/javascript';
node.charset = 'utf-8';
node.async = true;
return node;
req.onError = function (err) {
throw err;
};
/**
@ -1842,7 +1790,12 @@ var requirejs, require, define;
node;
if (isBrowser) {
//In the browser so use a script tag
node = req.createNode(config, moduleName, url);
node = config.xhtml ?
document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
document.createElement('script');
node.type = config.scriptType || 'text/javascript';
node.charset = 'utf-8';
node.async = true;
node.setAttribute('data-requirecontext', context.contextName);
node.setAttribute('data-requiremodule', moduleName);
@ -1939,7 +1892,7 @@ var requirejs, require, define;
}
//Look for a data-main script attribute, which could also adjust the baseUrl.
if (isBrowser && !cfg.skipDataMain) {
if (isBrowser) {
//Figure out baseUrl. Get it from the script tag with require.js in it.
eachReverse(scripts(), function (script) {
//Set the 'head' where we can append children by
@ -1953,31 +1906,24 @@ var requirejs, require, define;
//baseUrl, if it is not already set.
dataMain = script.getAttribute('data-main');
if (dataMain) {
//Preserve dataMain in case it is a path (i.e. contains '?')
mainScript = dataMain;
//Set final baseUrl if there is not already an explicit one.
if (!cfg.baseUrl) {
//Pull off the directory of data-main for use as the
//baseUrl.
src = mainScript.split('/');
src = dataMain.split('/');
mainScript = src.pop();
subPath = src.length ? src.join('/') + '/' : './';
cfg.baseUrl = subPath;
dataMain = mainScript;
}
//Strip off any trailing .js since mainScript is now
//Strip off any trailing .js since dataMain is now
//like a module name.
mainScript = mainScript.replace(jsSuffixRegExp, '');
//If mainScript is still a path, fall back to dataMain
if (req.jsExtRegExp.test(mainScript)) {
mainScript = dataMain;
}
dataMain = dataMain.replace(jsSuffixRegExp, '');
//Put the data-main script in the files to load.
cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain];
return true;
}

View file

@ -16,8 +16,9 @@ body {
color: white;
}
#c9-logo, #ace-logo {
padding: 0;
#logo {
padding: 15px;
margin-left: 70px;
border: none;
}
@ -46,10 +47,4 @@ body {
position: absolute;
right: 0;
border-left: 1px solid;
}
/* .ace_text-input {
z-index: 10!important;
opacity: 1!important;
background: rgb(84, 0, 255)!important;
}*/
}

View file

@ -32,26 +32,25 @@ define(function(require, exports, module) {
"use strict";
var dom = require("ace/lib/dom");
var oop = require("ace/lib/oop");
var event = require("ace/lib/event");
var Range = require("ace/range").Range;
var Tooltip = require("ace/tooltip").Tooltip;
function TokenTooltip (editor) {
var tooltipNode;
var TokenTooltip = function(editor) {
if (editor.tokenTooltip)
return;
Tooltip.call(this, editor.container);
editor.tokenTooltip = this;
editor.tokenTooltip = this;
this.editor = editor;
editor.tooltip = tooltipNode || this.$init();
this.update = this.update.bind(this);
this.onMouseMove = this.onMouseMove.bind(this);
this.onMouseOut = this.onMouseOut.bind(this);
event.addListener(editor.renderer.scroller, "mousemove", this.onMouseMove);
event.addListener(editor.renderer.content, "mouseout", this.onMouseOut);
}
oop.inherits(TokenTooltip, Tooltip);
};
(function(){
this.token = {};
@ -64,8 +63,8 @@ oop.inherits(TokenTooltip, Tooltip);
if (this.lastT - (r.timeStamp || 0) > 1000) {
r.rect = null;
r.timeStamp = this.lastT;
this.maxHeight = window.innerHeight;
this.maxWidth = window.innerWidth;
this.maxHeight = innerHeight;
this.maxWidth = innerWidth;
}
var canvasPos = r.rect || (r.rect = r.scroller.getBoundingClientRect());
@ -87,10 +86,15 @@ oop.inherits(TokenTooltip, Tooltip);
}
if (!token) {
session.removeMarker(this.marker);
this.hide();
tooltipNode.style.display = "none";
this.isOpen = false;
return;
}
if (!this.isOpen) {
tooltipNode.style.display = "";
this.isOpen = true;
}
var tokenText = token.type;
if (token.state)
tokenText += "|" + token.state;
@ -98,15 +102,15 @@ oop.inherits(TokenTooltip, Tooltip);
tokenText += "\n merge";
if (token.stateTransitions)
tokenText += "\n " + token.stateTransitions.join("\n ");
if (this.tokenText != tokenText) {
this.setText(tokenText);
this.width = this.getWidth();
this.height = this.getHeight();
tooltipNode.textContent = tokenText;
this.tooltipWidth = tooltipNode.offsetWidth;
this.tooltipHeight = tooltipNode.offsetHeight;
this.tokenText = tokenText;
}
this.show(null, this.x, this.y);
this.updateTooltipPosition(this.x, this.y);
this.token = token;
session.removeMarker(this.marker);
@ -119,34 +123,56 @@ oop.inherits(TokenTooltip, Tooltip);
this.y = e.clientY;
if (this.isOpen) {
this.lastT = e.timeStamp;
this.setPosition(this.x, this.y);
this.updateTooltipPosition(this.x, this.y);
}
if (!this.$timer)
this.$timer = setTimeout(this.update, 100);
};
this.onMouseOut = function(e) {
if (e && e.currentTarget.contains(e.relatedTarget))
return;
this.hide();
var t = e && e.relatedTarget;
var ct = e && e.currentTarget;
while(t && (t = t.parentNode)) {
if (t == ct)
return;
}
tooltipNode.style.display = "none";
this.editor.session.removeMarker(this.marker);
this.$timer = clearTimeout(this.$timer);
this.isOpen = false;
};
this.updateTooltipPosition = function(x, y) {
var st = tooltipNode.style;
if (x + 10 + this.tooltipWidth > this.maxWidth)
x = innerWidth - this.tooltipWidth - 10;
if (y > innerHeight * 0.75 || y + 20 + this.tooltipHeight > this.maxHeight)
y = y - this.tooltipHeight - 30;
st.left = x + 10 + "px";
st.top = y + 20 + "px";
};
this.setPosition = function(x, y) {
if (x + 10 + this.width > this.maxWidth)
x = window.innerWidth - this.width - 10;
if (y > window.innerHeight * 0.75 || y + 20 + this.height > this.maxHeight)
y = y - this.height - 30;
Tooltip.prototype.setPosition.call(this, x + 10, y + 20);
this.$init = function() {
tooltipNode = document.documentElement.appendChild(dom.createElement("div"));
var st = tooltipNode.style;
st.position = "fixed";
st.display = "none";
st.background = "lightyellow";
st.borderRadius = "";
st.border = "1px solid gray";
st.padding = "1px";
st.zIndex = 1000;
st.fontFamily = "monospace";
st.whiteSpace = "pre-line";
return tooltipNode;
};
this.destroy = function() {
this.onMouseOut();
event.removeListener(this.editor.renderer.scroller, "mousemove", this.onMouseMove);
event.removeListener(this.editor.renderer.content, "mouseout", this.onMouseOut);
delete this.editor.tokenTooltip;
delete this.editor.tokenTooltip;
};
}).call(TokenTooltip.prototype);
@ -154,3 +180,4 @@ oop.inherits(TokenTooltip, Tooltip);
exports.TokenTooltip = TokenTooltip;
});

View file

@ -42,7 +42,7 @@ var MultiSelect = require("ace/multi_select").MultiSelect;
exports.createEditor = function(el) {
return new Editor(new Renderer(el));
};
}
exports.createSplitEditor = function(el) {
if (typeof(el) == "string")
@ -62,6 +62,9 @@ exports.createSplitEditor = function(el) {
split.editor1 = split[1] = new Editor(new Renderer(e1));
split.splitter = s;
MultiSelect(split.editor0);
MultiSelect(split.editor1);
s.ratio = 0.5;
split.resize = function resize(){
@ -105,8 +108,8 @@ exports.createSplitEditor = function(el) {
};
var onResizeInterval = function() {
s.ratio = (x - rect.left) / rect.width;
split.resize();
s.ratio = (x - rect.left) / rect.width
split.resize()
};
event.capture(s, onMouseMove, onResizeEnd);
@ -218,7 +221,7 @@ function optgroup(values) {
return values.map(function(item) {
if (typeof item == "string")
item = {name: item, caption: item};
return elt("option", {value: item.value || item.name}, item.caption || item.desc);
return elt("option", {value: item.name}, item.caption || item.desc);
});
}

View file

@ -23,29 +23,26 @@
<pre id="editor"></pre>
<script src="kitchen-sink/require.js"></script>
<script src="../build/src-noconflict/ace.js"></script>
<script src="../build/src-noconflict/ext-modelist.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace", "ace/ext/modelist"], function(ace) {
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
(function () {
var modelist = ace.require("ace/ext/modelist");
var modelist = ace.require('ace/ext/modelist');
// the file path could come from an xmlhttp request, a drop event,
// or any other scriptable file loading process.
// Extensions could consume the modelist and use it to dynamically
// set the editor mode. Webmasters could use it in their scripts
// for site specific purposes as well.
var filePath = "blahblah/weee/some.js";
var filePath = 'blahblah/weee/some.js';
var mode = modelist.getModeForPath(filePath).mode;
console.log(mode);
editor.session.setMode(mode);
}());
})
</script>
<script src="./show_own_source.js"></script>
<script src="./demo_helper.js"></script>
</body>
</html>

View file

@ -1,20 +0,0 @@
({
optimize: "none",
preserveLicenseComments: false,
name: "node_modules/almond/almond",
baseUrl: "../../",
paths: {
ace : "lib/ace",
demo: "demo/kitchen-sink"
},
packages: [
],
include: [
"ace/ace"
],
exclude: [
],
out: "./packed.js",
useStrict: true,
wrap: false
})

View file

@ -1,36 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Editor</title>
<link rel="stylesheet" href="../kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
</head>
<body>
<div id="optionsPanel" style="position:absolute;height:100%;width:260px">
<a href="http://c9.io" title="Cloud9 IDE | Your code anywhere, anytime">
<img id="c9-logo" src="../kitchen-sink/logo.png" style="width: 172px;margin: -9px 30px -12px 51px;">
</a>
</div>
<pre id="editor-container">
<div style="color:black; padding: 10px">
demo showing Ace usage with r.js:
install r.js and almond
and run `<code>r.js -o demo/r.js/build.js</code>`
note that you also need ace/build/src to lazy load modes and themes
require("ace/config").set("basePath", "../../build/src");
require("ace/config").set("packaged", true);
<div>
</pre>
<script src="./packed.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
require("ace/config").set("basePath", "../../build/src")
require("ace/config").set("packaged", true)
var editor = require("ace/ace").edit("editor-container");
editor.session.setMode("ace/mode/javascript");
// editor.session.setValue("var editor = Ace!")
</script>
</body>
</html>

View file

@ -29,20 +29,14 @@
}</pre>
<script src="../demo/kitchen-sink/require.js"></script>
<script src="../build/src/ace.js" charset="utf-8"></script>
<script>
require.config({paths: {ace: "../build/src"}})
define('testace', ['ace/ace'],
function(ace, langtools) {
console.log("This is the testace module");
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/javascript");
require(["ace/requirejs/text!src/ace"], function(e){
editor.setValue(e);
})
}
);
require(['testace'])
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/javascript");
require(["ace/requirejs/text!src/ace"], function(e){
editor.setValue(e);
})
</script>
</body>

View file

@ -5,18 +5,19 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Editor</title>
<style type="text/css" media="screen">
.ace_editor {
position: relative !important;
border: 1px solid lightgray;
margin: auto;
height: 200px;
width: 80%;
}
.ace_editor {
position: relative !important;
border: 1px solid lightgray;
margin: auto;
height: 200px;
width: 80%;
}
.ace_editor.fullScreen {
height: auto;
width: auto;
border: 0;
height: auto;
width: auto;
border: 0;
margin: 0;
position: fixed !important;
top: 0;
@ -24,16 +25,17 @@
left: 0;
right: 0;
z-index: 10;
background: white;
}
.fullScreen {
overflow: hidden
}
.fullScreen {
overflow: hidden
}
.scrollmargin {
height: 500px;
.scrollmargin {
height: 500px;
text-align: center;
}
}
.large-button {
color: lightblue;
@ -54,7 +56,7 @@
<body>
<div class="scrollmargin">
<span onclick="scroll()" class="large-button">
scroll down &dArr;
scroll down &dArr;
</span>
</div>
<pre id="editor">function foo(items) {
@ -74,35 +76,28 @@
</div>
<script src="kitchen-sink/require.js"></script>
<script src="../build/src/ace.js"></script>
<script>
require.config({paths: { "ace" : "../lib/ace"}});
require(["ace/ace", "ace/ext/themelist"], function(ace) {
var $ = document.getElementById.bind(document);
var dom = require("ace/lib/dom");
//add command to all new editor instaces
require("ace/commands/default_commands").commands.push({
name: "Toggle Fullscreen",
bindKey: "F11",
exec: function(editor) {
var fullScreen = dom.toggleCssClass(document.body, "fullScreen")
dom.setCssClass(editor.container, "fullScreen", fullScreen)
editor.setAutoScrollEditorIntoView(!fullScreen)
editor.resize()
}
name: "Toggle Fullscreen",
bindKey: "F11",
exec: function(editor) {
dom.toggleCssClass(document.body, "fullScreen")
dom.toggleCssClass(editor.container, "fullScreen")
editor.setAutoScrollEditorIntoView()
editor.resize()
}
})
// create first editor
var editor = ace.edit("editor");
editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/javascript");
editor.renderer.setScrollMargin(10, 10);
editor.setOptions({
// "scrollPastEnd": 0.8,
autoScrollEditorIntoView: true
});
editor.setAutoScrollEditorIntoView();
var count = 1;
function add() {
@ -115,13 +110,12 @@ function add() {
oldEl.parentNode.insertBefore(el, pad.nextSibling)
count++
var theme = themes[Math.floor(themes.length * Math.random() - 1e-5)]
var theme = "ace/theme/" + themes[Math.floor(themes.length * Math.random() - 1e-5)]
editor = ace.edit(el)
editor.setOptions({
mode: "ace/mode/javascript",
theme: theme,
autoScrollEditorIntoView: true
})
editor.setTheme(theme)
editor.session.setMode("ace/mode/javascript")
editor.setAutoScrollEditorIntoView()
editor.setValue([
"this is editor number: ", count, "\n",
@ -132,6 +126,7 @@ function add() {
scroll()
}
function scroll(speed) {
var top = editor.container.getBoundingClientRect().top
speed = speed || 10
@ -144,11 +139,14 @@ function scroll(speed) {
}
}
var themes = require("ace/ext/themelist").themes.map(function(t){return t.theme});
window.add = add;
window.scroll = scroll;
});
var themes = {
bright: [ "chrome", "clouds", "crimson_editor", "dawn", "dreamweaver", "eclipse", "github",
"solarized_light", "textmate", "tomorrow"],
dark: [ "clouds_midnight", "cobalt", "idle_fingers", "kr_theme", "merbivore", "merbivore_soft",
"mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "terminal", "tomorrow_night",
"tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties", "twilight", "vibrant_ink"]
}
themes = [].concat(themes.bright, themes.dark);
</script>
</body>

View file

@ -23,12 +23,9 @@
<pre id="editor"></pre>
<script src="kitchen-sink/require.js"></script>
<script src="../build/src-noconflict/ace.js"></script>
<script src="../build/src-noconflict/ext-settings_menu.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace", "ace/ext/settings_menu"], function(ace) {
var editor = ace.edit("editor");
ace.require('ace/ext/settings_menu').init(editor);
editor.setTheme("ace/theme/twilight");
@ -41,9 +38,8 @@ require(["ace/ace", "ace/ext/settings_menu"], function(ace) {
},
readOnly: true
}]);
})
</script>
<script src="./show_own_source.js"></script>
<script src="./demo_helper.js"></script>
</body>
</html>

View file

@ -1,16 +0,0 @@
if (typeof ace == "undefined" && typeof require == "undefined") {
document.body.innerHTML = "<p style='padding: 20px 50px;'>couldn't find ace.js file, <br>"
+ "to build it run <code>node Makefile.dryice.js full<code>"
} else if (typeof ace == "undefined" && typeof require != "undefined") {
require(["ace/ace"], setValue)
} else {
require = ace.require;
setValue()
}
function setValue() {
require("ace/lib/net").get(document.baseURI, function(t){
var el = document.getElementById("editor");
el.env.editor.setValue(t, 1);
})
}

View file

@ -1,83 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Static Code highlighter using Ace</title>
<meta name="author" content="Matthew Kastor">
<style type="text/css">
.code {
width: 50%;
white-space: pre-wrap;
border: solid lightgrey 1px
}
</style>
</head>
<body>
<h2>Client Side Syntax Highlighting</h2>
<p>Syntax highlighting using Ace language modes and themes.</p>
<div class="code" ace-mode="ace/mode/css" ace-theme="ace/theme/chrome" ace-gutter="true">
.code {
width: 50%;
white-space: pre-wrap;
border: solid lightgrey 1px
}
</div>
<pre class="code" ace-mode="ace/mode/javascript" ace-theme="ace/theme/twilight">
function wobble (flam) {
return flam.wobbled = true;
}
</pre>
<div class="code" ace-mode="ace/mode/lua" ace-theme="ace/theme/chrome" ace-gutter="true" style="width: 30em;">
--[[--
num_args takes in 5.1 byte code and extracts the number of arguments from its function header.
--]]--
function int(t)
return t:byte(1) + t:byte(2) * 0x100 + t:byte(3) * 0x10000 + t:byte(4) * 0x1000000
end
function num_args(func)
local dump = string.dump(func)
local offset, cursor = int(dump:sub(13)), offset + 26
--Get the params and var flag (whether there's a ... in the param)
return dump:sub(cursor):byte(), dump:sub(cursor+1):byte()
end
</div>
<script src="kitchen-sink/require.js"></script>
<script>
require.config({paths: { "ace" : "../lib/ace"}});
require(["ace/ace", "ace/ext/static_highlight"], function(ace) {
var highlight = ace.require("ace/ext/static_highlight")
var dom = ace.require("ace/lib/dom")
function qsa(sel) {
return Array.apply(null, document.querySelectorAll(sel));
}
qsa(".code").forEach(function (codeEl) {
highlight(codeEl, {
mode: codeEl.getAttribute("ace-mode"),
theme: codeEl.getAttribute("ace-theme"),
startLineNumber: 1,
showGutter: codeEl.getAttribute("ace-gutter"),
trim: true
}, function (highlighted) {
});
});
})
</script>
</body>
</html>

View file

@ -0,0 +1,71 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Static Code highlighter using Ace</title>
<meta name="author" content="Matthew Kastor">
<style type="text/css">
.code {
width: 50%;
position: relative;
white-space: pre-wrap;
}
</style>
</head>
<body>
<h2>Client Side Syntax Highlighting</h2>
<p>Syntax highlighting using Ace language modes and themes.</p>
<div class="code" ace-mode="ace/mode/css" ace-theme="ace/theme/chrome">
.code {
width: 50%;
position: relative;
white-space: pre-wrap;
}
</div>
<pre class="code" ace-mode="ace/mode/javascript" ace-theme="ace/theme/twilight">
function wobble (flam) {
return flam.wobbled = true;
}
// the scrollbars are from overflow auto on .ace_editor.
</pre>
<script src="../../build/src-noconflict/ace.js"></script>
<script src="../../build/src-noconflict/ext-static_highlight.js"></script>
<script>
var highlighter = ace.require("ace/ext/static_highlight")
var dom = ace.require("ace/lib/dom")
function qsa(sel) {
return [].slice.call(document.querySelectorAll(sel));
}
qsa(".code").forEach(function (codeEl) {
var cs = getComputedStyle(codeEl);
codeEl.style.cssText = codeEl.style.cssText +
'width: ' + cs.width + ';' +
'height: ' + cs.height + ';';
var mode = codeEl.getAttribute('ace-mode');
var theme = codeEl.getAttribute('ace-theme');
var data = codeEl.textContent.trim();
highlighter.render(data, mode, theme, 1, false, function (highlighted) {
dom.importCssString(highlighted.css, "ace_highlight");
dom.importCssString('.ace_editor { overflow: auto; ' +
'position:absolute; top:0; bottom:0; right:0; left:0; }' +
'.ace_gutter { position: relative; }',
'atropa_hial');
codeEl.innerHTML = highlighted.html;
});
});
</script>
</body>
</html>

View file

@ -6,9 +6,11 @@
// include ace search path and modules
require("amd-loader");
// load jsdom, which is required by Ace
require("../../lib/ace/test/mockdom");
var http = require("http");
var fs = require("fs");
var resolve = require("path").resolve;
// load the highlighter and the desired mode and theme
var highlighter = require("../../lib/ace/ext/static_highlight");
@ -18,24 +20,15 @@ var theme = require("../../lib/ace/theme/twilight");
var port = process.env.PORT || 2222;
http.createServer(function(req, res) {
var url = req.url;
var path = /[^#?\x00]*/.exec(url)[0];
var root = resolve(__dirname + "/../../").replace(/\\/g, "/");
path = resolve(root + "/" + path).replace(/\\/g, "/");
if (path.indexOf(root + "/") != 0)
path = __filename;
res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"});
fs.readFile(path, "utf8", function(err, data) {
if (err) data = err.message;
fs.readFile(__filename, "utf8", function(err, data) {
var highlighted = highlighter.render(data, new JavaScriptMode(), theme);
res.end(
'<html><body>\n' +
'<style type="text/css" media="screen">\n' +
highlighted.css +
'</style>\n' +
highlighted.html +
'</body></html>'
);
res.end('<html><body>\n\
<style type="text/css" media="screen">\n\
:css:\n\
</style>\n\
:html:\n\
</body></html>'.replace(":css:", highlighted.css).replace(":html:", highlighted.html));
});
}).listen(port);

View file

@ -41,21 +41,17 @@
<pre id="editor"></pre>
<div id="statusBar">ace rocks!</div>
<script src="kitchen-sink/require.js"></script>
<script src="../build/src-noconflict/ace.js"></script>
<script src="../build/src-noconflict/ext-statusbar.js"></script>
<script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace", "ace/ext/statusbar"], function(ace) {
var editor = ace.edit("editor");
var StatusBar = ace.require("ace/ext/statusbar").StatusBar;
var StatusBar = ace.require('ace/ext/statusbar').StatusBar;
// create a simple selection status indicator
var statusBar = new StatusBar(editor, document.getElementById("statusBar"));
var statusBar = new StatusBar(editor, document.getElementById('statusBar'));
editor.setTheme("ace/theme/dawn");
editor.session.setMode("ace/mode/html");
});
</script>
<script src="./show_own_source.js"></script>
<script src="./demo_helper.js"></script>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

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