Merge remote-tracking branch 'remotes/origin/master' into v-1.2

Conflicts:
	lib/ace/anchor.js
	lib/ace/keyboard/vim/maps/operators.js
This commit is contained in:
nightwing 2014-07-02 21:58:13 +04:00
commit 1f7582b5a6
267 changed files with 107605 additions and 62551 deletions

View file

@ -1,3 +1,13 @@
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 2014.03.08 Version 1.1.3
* New Features * New Features

View file

@ -13,7 +13,6 @@ pre_build:
build: pre_build build: pre_build
./Makefile.dryice.js normal ./Makefile.dryice.js normal
./Makefile.dryice.js demo ./Makefile.dryice.js demo
./Makefile.dryice.js bm
# Minimal build: call Makefile.dryice.js only if our sources changed # Minimal build: call Makefile.dryice.js only if our sources changed
basic: build/src/ace.js basic: build/src/ace.js

File diff suppressed because it is too large Load diff

View file

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

View file

@ -35,7 +35,8 @@
// enable autocompletion and snippets // enable autocompletion and snippets
editor.setOptions({ editor.setOptions({
enableBasicAutocompletion: true, enableBasicAutocompletion: true,
enableSnippets: true enableSnippets: true,
enableLiveAutocompletion: false
}); });
</script> </script>

View file

@ -20,29 +20,41 @@
</style> </style>
</head> </head>
<body> <body>
<pre id="editor">autoresizing editor</pre> <pre id="editor1">autoresizing editor</pre>
<div class="scrollmargin"></div> <div class="scrollmargin"></div>
<pre id="editor2">minHeight = 2 lines</pre> <pre id="editor2">minHeight = 2 lines</pre>
<div class="scrollmargin"></div>
<pre id="editor"></pre>
<script src="../build/src/ace.js"></script> <script src="kitchen-sink/require.js"></script>
<script> <script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace"], function(ace) {
// create first editor var editor1 = ace.edit("editor1");
var editor = ace.edit("editor"); editor1.setTheme("ace/theme/tomorrow_night_eighties");
editor.setTheme("ace/theme/tomorrow"); editor1.session.setMode("ace/mode/html");
editor.session.setMode("ace/mode/html"); editor1.setAutoScrollEditorIntoView(true);
editor.setAutoScrollEditorIntoView(); editor1.setOption("maxLines", 30);
editor.setOption("maxLines", 100);
var editor2 = ace.edit("editor2");
editor2.setTheme("ace/theme/tomorrow_night_blue");
editor2.session.setMode("ace/mode/html");
editor2.setAutoScrollEditorIntoView();
editor2.setOption("maxLines", 30);
editor2.setOption("minLines", 2);
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("editor");
editor.setTheme("ace/theme/tomorrow");
editor.session.setMode("ace/mode/html");
editor.setAutoScrollEditorIntoView(true);
editor.setOption("maxLines", 100);
});
</script> </script>
<script src="./show_own_source.js"></script>
</body> </body>
</html> </html>

View file

@ -22,19 +22,20 @@
<pre id="editor"></pre> <pre id="editor"></pre>
<!-- load ace --> <!-- load emmet code and snippets compiled for browser -->
<script src="../build/src-noconflict/ace.js"></script> <script src="https://nightwing.github.io/emmet-core/emmet.js"></script>
<!-- load ace emmet extension -->
<script src="../build/src-noconflict/ext-emmet.js"></script> <script src="kitchen-sink/require.js"></script>
<!-- load core emmet files -->
<script src="http://nightwing.github.io/emmet-core/emmet.js"></script>
<script> <script>
// trigger extension // setup paths
ace.require("ace/ext/emmet"); require.config({paths: { "ace" : "../lib/ace"}});
// load ace and extensions
require(["ace/ace", "ace/ext/emmet"], function(ace) {
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.session.setMode("ace/mode/html"); editor.session.setMode("ace/mode/html");
// enable emmet on the current editor // enable emmet on the current editor
editor.setOption("enableEmmet", true); editor.setOption("enableEmmet", true);
});
</script> </script>
<script src="./show_own_source.js"></script> <script src="./show_own_source.js"></script>

View file

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ACE Editor StatusBar Demo</title> <title>ACE Editor StatusBar Demo</title>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
/*!important without this top: 0; bottom: 0 doesn't work */ /*!important without this top: 0; bottom: 0 doesn't work on old ie */
body, html { body, html {
position: absolute; position: absolute;
top: 0px; bottom: 0; left: 0; right: 0; top: 0px; bottom: 0; left: 0; right: 0;

View file

@ -22,8 +22,11 @@
<pre id="editor"></pre> <pre id="editor"></pre>
<script src="../build/src-noconflict/ace.js"></script> <script src="kitchen-sink/require.js"></script>
<script> <script>
// setup paths
require.config({paths: { "ace" : "../lib/ace"}});
require(["ace/ace"], function(ace) {
var editor = ace.edit("editor") var editor = ace.edit("editor")
editor.setTheme("ace/theme/twilight") editor.setTheme("ace/theme/twilight")
editor.session.setMode("ace/mode/html") editor.session.setMode("ace/mode/html")
@ -39,6 +42,8 @@
}) })
} }
}) })
editor.execCommand("showKeyboardShortcuts")
})
</script> </script>
<script src="./show_own_source.js"></script> <script src="./show_own_source.js"></script>

View file

@ -184,21 +184,21 @@ env.editor.commands.addCommands([{
} }
}, { }, {
name: "increaseFontSize", name: "increaseFontSize",
bindKey: "Ctrl-+", bindKey: "Ctrl-=|Ctrl-+",
exec: function(editor) { exec: function(editor) {
var size = parseInt(editor.getFontSize(), 10) || 12; var size = parseInt(editor.getFontSize(), 10) || 12;
editor.setFontSize(size + 1); editor.setFontSize(size + 1);
} }
}, { }, {
name: "decreaseFontSize", name: "decreaseFontSize",
bindKey: "Ctrl+-", bindKey: "Ctrl+-|Ctrl-_",
exec: function(editor) { exec: function(editor) {
var size = parseInt(editor.getFontSize(), 10) || 12; var size = parseInt(editor.getFontSize(), 10) || 12;
editor.setFontSize(Math.max(size - 1 || 1)); editor.setFontSize(Math.max(size - 1 || 1));
} }
}, { }, {
name: "resetFontSize", name: "resetFontSize",
bindKey: "Ctrl+0", bindKey: "Ctrl+0|Ctrl-Numpad0",
exec: function(editor) { exec: function(editor) {
editor.setFontSize(12); editor.setFontSize(12);
} }
@ -548,7 +548,7 @@ new StatusBar(env.editor, cmdLine.container);
var Emmet = require("ace/ext/emmet"); var Emmet = require("ace/ext/emmet");
net.loadScript("http://nightwing.github.io/emmet-core/emmet.js", function() { net.loadScript("https://nightwing.github.io/emmet-core/emmet.js", function() {
Emmet.setCore(window.emmet); Emmet.setCore(window.emmet);
env.editor.setOption("enableEmmet", true); env.editor.setOption("enableEmmet", true);
}); });
@ -592,7 +592,7 @@ env.editSnippets = function() {
require("ace/ext/language_tools"); require("ace/ext/language_tools");
env.editor.setOptions({ env.editor.setOptions({
enableBasicAutocompletion: true, enableBasicAutocompletion: true,
enableLiveAutocomplete: true, enableLiveAutocompletion: true,
enableSnippets: true enableSnippets: true
}); });

View file

@ -0,0 +1,53 @@
#
# 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

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

View file

@ -0,0 +1,21 @@
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,5 +1,5 @@
/** vim: et:ts=4:sw=4:sts=4 /** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.9+ Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * @license RequireJS 2.1.11+ Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license. * Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details * see: http://github.com/jrburke/requirejs for details
*/ */
@ -12,7 +12,7 @@ var requirejs, require, define;
(function (global) { (function (global) {
var req, s, head, baseElement, dataMain, src, var req, s, head, baseElement, dataMain, src,
interactiveScript, currentlyAddingScript, mainScript, subPath, interactiveScript, currentlyAddingScript, mainScript, subPath,
version = '2.1.9+', version = '2.1.11+',
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
jsSuffixRegExp = /\.js$/, jsSuffixRegExp = /\.js$/,
@ -108,7 +108,10 @@ var requirejs, require, define;
if (source) { if (source) {
eachProp(source, function (value, prop) { eachProp(source, function (value, prop) {
if (force || !hasProp(target, prop)) { if (force || !hasProp(target, prop)) {
if (deepStringMixin && typeof value !== 'string') { if (deepStringMixin && typeof value === 'object' && value &&
!isArray(value) && !isFunction(value) &&
!(value instanceof RegExp)) {
if (!target[prop]) { if (!target[prop]) {
target[prop] = {}; target[prop] = {};
} }
@ -138,7 +141,7 @@ var requirejs, require, define;
throw err; throw err;
} }
//Allow getting a global that expressed in //Allow getting a global that is expressed in
//dot notation, like 'a.b.c'. //dot notation, like 'a.b.c'.
function getGlobal(value) { function getGlobal(value) {
if (!value) { if (!value) {
@ -177,7 +180,7 @@ var requirejs, require, define;
if (typeof requirejs !== 'undefined') { if (typeof requirejs !== 'undefined') {
if (isFunction(requirejs)) { if (isFunction(requirejs)) {
//Do not overwrite and existing requirejs instance. //Do not overwrite an existing requirejs instance.
return; return;
} }
cfg = requirejs; cfg = requirejs;
@ -201,6 +204,7 @@ var requirejs, require, define;
waitSeconds: 7, waitSeconds: 7,
baseUrl: './', baseUrl: './',
paths: {}, paths: {},
bundles: {},
pkgs: {}, pkgs: {},
shim: {}, shim: {},
config: {} config: {}
@ -214,6 +218,7 @@ var requirejs, require, define;
defQueue = [], defQueue = [],
defined = {}, defined = {},
urlFetched = {}, urlFetched = {},
bundlesMap = {},
requireCounter = 1, requireCounter = 1,
unnormalizedCounter = 1; unnormalizedCounter = 1;
@ -227,8 +232,8 @@ var requirejs, require, define;
* @param {Array} ary the array of path segments. * @param {Array} ary the array of path segments.
*/ */
function trimDots(ary) { function trimDots(ary) {
var i, part; var i, part, length = ary.length;
for (i = 0; ary[i]; i += 1) { for (i = 0; i < length; i++) {
part = ary[i]; part = ary[i];
if (part === '.') { if (part === '.') {
ary.splice(i, 1); ary.splice(i, 1);
@ -261,7 +266,7 @@ var requirejs, require, define;
* @returns {String} normalized name * @returns {String} normalized name
*/ */
function normalize(name, baseName, applyMap) { function normalize(name, baseName, applyMap) {
var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment, var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
foundMap, foundI, foundStarMap, starI, foundMap, foundI, foundStarMap, starI,
baseParts = baseName && baseName.split('/'), baseParts = baseName && baseName.split('/'),
normalizedBaseParts = baseParts, normalizedBaseParts = baseParts,
@ -274,29 +279,26 @@ var requirejs, require, define;
//otherwise, assume it is a top-level require that will //otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end. //be relative to baseUrl in the end.
if (baseName) { if (baseName) {
if (getOwn(config.pkgs, baseName)) { //Convert baseName to array, and lop off the last part,
//If the baseName is a package name, then just treat it as one //so that . matches that 'directory' and not name of the baseName's
//name to concat the name with. //module. For instance, baseName of 'one/two/three', maps to
normalizedBaseParts = baseParts = [baseName]; //'one/two/three.js', but we want the directory, 'one/two' for
} else { //this normalization.
//Convert baseName to array, and lop off the last part, normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
//so that . matches that 'directory' and not name of the baseName's name = name.split('/');
//module. For instance, baseName of 'one/two/three', maps to lastIndex = name.length - 1;
//'one/two/three.js', but we want the directory, 'one/two' for
//this normalization. // If wanting node ID compatibility, strip .js from end
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); // 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, '');
} }
name = normalizedBaseParts.concat(name.split('/')); name = normalizedBaseParts.concat(name);
trimDots(name); 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('/'); name = name.join('/');
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
name = pkgName;
}
} else if (name.indexOf('./') === 0) { } else if (name.indexOf('./') === 0) {
// No baseName, so this is ID is resolved relative // No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot. // to baseUrl, pull off the leading dot.
@ -308,7 +310,7 @@ var requirejs, require, define;
if (applyMap && map && (baseParts || starMap)) { if (applyMap && map && (baseParts || starMap)) {
nameParts = name.split('/'); nameParts = name.split('/');
for (i = nameParts.length; i > 0; i -= 1) { outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
nameSegment = nameParts.slice(0, i).join('/'); nameSegment = nameParts.slice(0, i).join('/');
if (baseParts) { if (baseParts) {
@ -325,16 +327,12 @@ var requirejs, require, define;
//Match, update name to the new value. //Match, update name to the new value.
foundMap = mapValue; foundMap = mapValue;
foundI = i; foundI = i;
break; break outerLoop;
} }
} }
} }
} }
if (foundMap) {
break;
}
//Check for a star map match, but just hold on to it, //Check for a star map match, but just hold on to it,
//if there is a shorter segment match later in a matching //if there is a shorter segment match later in a matching
//config, then favor over this star map. //config, then favor over this star map.
@ -355,7 +353,11 @@ var requirejs, require, define;
} }
} }
return name; // If the name points to a package's name, use
// the package main instead.
pkgMain = getOwn(config.pkgs, name);
return pkgMain ? pkgMain : name;
} }
function removeScript(name) { function removeScript(name) {
@ -377,7 +379,13 @@ var requirejs, require, define;
//retry //retry
pathConfig.shift(); pathConfig.shift();
context.require.undef(id); context.require.undef(id);
context.require([id]);
//Custom require that does not do map translation, since
//ID is "absolute", already mapped/resolved.
context.makeRequire(null, {
skipMap: true
})([id]);
return true; return true;
} }
} }
@ -565,7 +573,7 @@ var requirejs, require, define;
mod.usingExports = true; mod.usingExports = true;
if (mod.map.isDefine) { if (mod.map.isDefine) {
if (mod.exports) { if (mod.exports) {
return mod.exports; return (defined[mod.map.id] = mod.exports);
} else { } else {
return (mod.exports = defined[mod.map.id] = {}); return (mod.exports = defined[mod.map.id] = {});
} }
@ -579,15 +587,9 @@ var requirejs, require, define;
id: mod.map.id, id: mod.map.id,
uri: mod.map.url, uri: mod.map.url,
config: function () { config: function () {
var c, return getOwn(config.config, mod.map.id) || {};
pkg = getOwn(config.pkgs, mod.map.id);
// For packages, only support config targeted
// at the main module.
c = pkg ? getOwn(config.config, mod.map.id + '/' + pkg.main) :
getOwn(config.config, mod.map.id);
return c || {};
}, },
exports: defined[mod.map.id] exports: mod.exports || (mod.exports = {})
}); });
} }
} }
@ -870,17 +872,14 @@ var requirejs, require, define;
exports = context.execCb(id, factory, depExports, exports); exports = context.execCb(id, factory, depExports, exports);
} }
if (this.map.isDefine) { // Favor return value over exports. If node/cjs in play,
//If setting exports via 'module' is in play, // then will not have a return value anyway. Favor
//favor that over return value and exports. After that, // module.exports assignment over exports object.
//favor a non-undefined return value over exports use. if (this.map.isDefine && exports === undefined) {
cjsModule = this.module; 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; exports = cjsModule.exports;
} else if (exports === undefined && this.usingExports) { } else if (this.usingExports) {
//exports already set the defined value. //exports already set the defined value.
exports = this.exports; exports = this.exports;
} }
@ -940,6 +939,7 @@ var requirejs, require, define;
on(pluginMap, 'defined', bind(this, function (plugin) { on(pluginMap, 'defined', bind(this, function (plugin) {
var load, normalizedMap, normalizedMod, var load, normalizedMap, normalizedMod,
bundleId = getOwn(bundlesMap, this.map.id),
name = this.map.name, name = this.map.name,
parentName = this.map.parentMap ? this.map.parentMap.name : null, parentName = this.map.parentMap ? this.map.parentMap.name : null,
localRequire = context.makeRequire(map.parentMap, { localRequire = context.makeRequire(map.parentMap, {
@ -985,6 +985,14 @@ var requirejs, require, define;
return; 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) { load = bind(this, function (value) {
this.init([], function () { return value; }, null, { this.init([], function () { return value; }, null, {
enabled: true enabled: true
@ -1249,31 +1257,38 @@ var requirejs, require, define;
} }
} }
//Save off the paths and packages since they require special processing, //Save off the paths since they require special processing,
//they are additive. //they are additive.
var pkgs = config.pkgs, var shim = config.shim,
shim = config.shim,
objs = { objs = {
paths: true, paths: true,
bundles: true,
config: true, config: true,
map: true map: true
}; };
eachProp(cfg, function (value, prop) { eachProp(cfg, function (value, prop) {
if (objs[prop]) { if (objs[prop]) {
if (prop === 'map') { if (!config[prop]) {
if (!config.map) { config[prop] = {};
config.map = {};
}
mixin(config[prop], value, true, true);
} else {
mixin(config[prop], value, true);
} }
mixin(config[prop], value, true, true);
} else { } else {
config[prop] = value; 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 //Merge shim
if (cfg.shim) { if (cfg.shim) {
eachProp(cfg.shim, function (value, id) { eachProp(cfg.shim, function (value, id) {
@ -1294,29 +1309,25 @@ var requirejs, require, define;
//Adjust packages if necessary. //Adjust packages if necessary.
if (cfg.packages) { if (cfg.packages) {
each(cfg.packages, function (pkgObj) { each(cfg.packages, function (pkgObj) {
var location; var location, name;
pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
name = pkgObj.name;
location = pkgObj.location; location = pkgObj.location;
if (location) {
config.paths[name] = pkgObj.location;
}
//Create a brand new object on pkgs, since currentPackages can //Save pointer to main module ID for pkg name.
//be passed in again, and config.pkgs is the internal transformed //Remove leading dot in main, so main paths are normalized,
//state for all package configs. //and remove any trailing .js, since different package
pkgs[pkgObj.name] = { //envs have different conventions: some use a module name,
name: pkgObj.name, //some use a file name.
location: location || pkgObj.name, config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
//Remove leading dot in main, so main paths are normalized, .replace(currDirRegExp, '')
//and remove any trailing .js, since different package .replace(jsSuffixRegExp, '');
//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, //If there are any "waiting to execute" modules in the registry,
@ -1497,7 +1508,7 @@ var requirejs, require, define;
/** /**
* Called to enable a module if it is still in the registry * Called to enable a module if it is still in the registry
* awaiting enablement. A second arg, parent, the parent module, * awaiting enablement. A second arg, parent, the parent module,
* is passed in for context, when this method is overriden by * is passed in for context, when this method is overridden by
* the optimizer. Not shown here to keep code compact. * the optimizer. Not shown here to keep code compact.
*/ */
enable: function (depMap) { enable: function (depMap) {
@ -1571,8 +1582,19 @@ var requirejs, require, define;
* internal API, not a public one. Use toUrl for the public API. * internal API, not a public one. Use toUrl for the public API.
*/ */
nameToUrl: function (moduleName, ext, skipExt) { nameToUrl: function (moduleName, ext, skipExt) {
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url, var paths, syms, i, parentModule, url,
parentPath; parentPath, bundleId,
pkgMain = getOwn(config.pkgs, moduleName);
if (pkgMain) {
moduleName = pkgMain;
}
bundleId = getOwn(bundlesMap, moduleName);
if (bundleId) {
return context.nameToUrl(bundleId, ext, skipExt);
}
//If a colon is in the URL, it indicates a protocol is used and it is just //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. ?) //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
@ -1586,7 +1608,6 @@ var requirejs, require, define;
} else { } else {
//A module that needs to be converted to a path. //A module that needs to be converted to a path.
paths = config.paths; paths = config.paths;
pkgs = config.pkgs;
syms = moduleName.split('/'); syms = moduleName.split('/');
//For each module name segment, see if there is a path //For each module name segment, see if there is a path
@ -1594,7 +1615,7 @@ var requirejs, require, define;
//and work up from it. //and work up from it.
for (i = syms.length; i > 0; i -= 1) { for (i = syms.length; i > 0; i -= 1) {
parentModule = syms.slice(0, i).join('/'); parentModule = syms.slice(0, i).join('/');
pkg = getOwn(pkgs, parentModule);
parentPath = getOwn(paths, parentModule); parentPath = getOwn(paths, parentModule);
if (parentPath) { if (parentPath) {
//If an array, it means there are a few choices, //If an array, it means there are a few choices,
@ -1604,16 +1625,6 @@ var requirejs, require, define;
} }
syms.splice(0, i, parentPath); syms.splice(0, i, parentPath);
break; 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;
} }
} }

View file

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

20
demo/r.js/build.js Normal file
View file

@ -0,0 +1,20 @@
({
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
})

36
demo/r.js/editor.html Normal file
View file

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

View file

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

View file

@ -23,9 +23,12 @@
<pre id="editor"></pre> <pre id="editor"></pre>
<script src="../build/src-noconflict/ace.js"></script> <script src="kitchen-sink/require.js"></script>
<script src="../build/src-noconflict/ext-settings_menu.js"></script>
<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"); var editor = ace.edit("editor");
ace.require('ace/ext/settings_menu').init(editor); ace.require('ace/ext/settings_menu').init(editor);
editor.setTheme("ace/theme/twilight"); editor.setTheme("ace/theme/twilight");
@ -38,6 +41,7 @@
}, },
readOnly: true readOnly: true
}]); }]);
})
</script> </script>
<script src="./show_own_source.js"></script> <script src="./show_own_source.js"></script>

View file

@ -1,3 +1,16 @@
ace.require("ace/lib/net").get(document.baseURI, function(t){ if (typeof ace == "undefined" && typeof require == "undefined") {
editor.setValue(t, 1); 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,5 +1,4 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" <!DOCTYPE html>
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@ -34,30 +33,31 @@ function wobble (flam) {
return flam.wobbled = true; return flam.wobbled = true;
} }
// the scrollbars are from overflow auto on .ace_editor.
</pre> </pre>
<script src="../../build/src-noconflict/ace.js"></script> <script src="kitchen-sink/require.js"></script>
<script src="../../build/src-noconflict/ext-static_highlight.js"></script>
<script> <script>
var highlight = ace.require("ace/ext/static_highlight") require.config({paths: { "ace" : "../lib/ace"}});
var dom = ace.require("ace/lib/dom")
function qsa(sel) {
return [].slice.call(document.querySelectorAll(sel));
}
qsa(".code").forEach(function (codeEl) { require(["ace/ace", "ace/ext/static_highlight"], function(ace) {
highlight(codeEl, { var highlight = ace.require("ace/ext/static_highlight")
mode: codeEl.getAttribute('ace-mode'), var dom = ace.require("ace/lib/dom")
theme: codeEl.getAttribute('ace-theme'), function qsa(sel) {
startLineNumber: 1, return Array.apply(null, document.querySelectorAll(sel));
showGutter: codeEl.getAttribute("ace-gutter"), }
trim: true
}, function (highlighted) { 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> </script>
</body> </body>

View file

@ -41,15 +41,19 @@
<pre id="editor"></pre> <pre id="editor"></pre>
<div id="statusBar">ace rocks!</div> <div id="statusBar">ace rocks!</div>
<script src="../build/src-noconflict/ace.js"></script> <script src="kitchen-sink/require.js"></script>
<script src="../build/src-noconflict/ext-statusbar.js"></script>
<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 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 // 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.setTheme("ace/theme/dawn");
editor.session.setMode("ace/mode/html"); editor.session.setMode("ace/mode/html");
});
</script> </script>
<script src="./show_own_source.js"></script> <script src="./show_own_source.js"></script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -161,7 +161,7 @@ function highlight() {
var highlighter = ace.require("ace/ext/static_highlight") var highlighter = ace.require("ace/ext/static_highlight")
var dom = ace.require("ace/lib/dom") var dom = ace.require("ace/lib/dom")
function qsa(sel) { function qsa(sel) {
return [].slice.call(document.querySelectorAll(sel)); return Array.apply(null, document.querySelectorAll(sel));
} }
qsa("code[class]").forEach(function(el) { qsa("code[class]").forEach(function(el) {

View file

@ -9,12 +9,15 @@
<link href="./doc/site/style.css" rel="stylesheet" type="text/css" /> <link href="./doc/site/style.css" rel="stylesheet" type="text/css" />
<link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon" /> <link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon" />
<script src="./build/src-min/ace.js"></script> <script src="./build/src/ace.js"></script>
<script src="./build/src-min/ext-static_highlight.js"></script> <script src="./build/src/ext-static_highlight.js"></script>
<!--[if lt IE 9]>
<script src="./build/src/ext-old_ie.js"></script>
<![endif]-->
</head> </head>
<body> <body>
<a href="http://github.com/ajaxorg/ace"> <a href="http://github.com/ajaxorg/ace">
<img style="z-index: 50000; position: absolute; top: 0; right: 0; border: 0; width: 125px; height: 125px" src="https://a248.e.akamai.net/camo.github.com/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" /> <img style="z-index: 50000; position: absolute; top: 0; right: 0; border: 0; width: 125px; height: 125px" src="https://camo.githubusercontent.com/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub" />
</a> </a>
<div id="wrapper"> <div id="wrapper">
<div class="content"> <div class="content">
@ -65,7 +68,7 @@
and is the successor of the Mozilla Skywriter (Bespin) project. and is the successor of the Mozilla Skywriter (Bespin) project.
</p> </p>
<div id="ace_editor_demo" style="opacity:0">/** <pre id="ace_editor_demo" style="opacity:0">/**
* In fact, you're looking at ACE right now. Go ahead and play with it! * In fact, you're looking at ACE right now. Go ahead and play with it!
* *
* We are currently showing off the JavaScript mode. ACE has support for 45 * We are currently showing off the JavaScript mode. ACE has support for 45
@ -80,7 +83,7 @@ function add(x, y) {
var addResult = add(3, 2); var addResult = add(3, 2);
console.log(addResult); console.log(addResult);
</div> </pre>
<p id="embed_link"><a href="#nav=embedding">Learn how to embed this in your own site</a></p> <p id="embed_link"><a href="#nav=embedding">Learn how to embed this in your own site</a></p>
<p class="highlight_note">Looking for a more full-featured demo? Check out the <p class="highlight_note">Looking for a more full-featured demo? Check out the
<a href="build/kitchen-sink.html" target="_blank">kitchen sink</a>. <a href="build/kitchen-sink.html" target="_blank">kitchen sink</a>.
@ -140,7 +143,7 @@ console.log(addResult);
<h1>Embedding Ace in Your Site</h1> <h1>Embedding Ace in Your Site</h1>
<p>Ace can be easily embedded into a web page. Get prebuilt version of ace from <p>Ace can be easily embedded into a web page. Get prebuilt version of ace from
<a href="https://github.com/ajaxorg/ace-builds/">ace-builds</a> repository and use the code below:</p> <a href="https://github.com/ajaxorg/ace-builds/">ace-builds</a> repository and use the code below:</p>
<div id="embedded_ace_code" style="opacity:0">&lt;!DOCTYPE html> <pre id="embedded_ace_code" style="opacity:0">&lt;!DOCTYPE html>
&lt;html lang="en"> &lt;html lang="en">
&lt;head> &lt;head>
&lt;title>ACE in Action&lt;/title> &lt;title>ACE in Action&lt;/title>
@ -168,7 +171,7 @@ console.log(addResult);
editor.getSession().setMode("ace/mode/javascript"); editor.getSession().setMode("ace/mode/javascript");
&lt;/script> &lt;/script>
&lt;/body> &lt;/body>
&lt;/html></div> &lt;/html></pre>
<p>Now check out the <a href="#nav=howto">How-To Guide</a> for instructions on <p>Now check out the <a href="#nav=howto">How-To Guide</a> for instructions on
common operations, such as setting a different language mode or common operations, such as setting a different language mode or
getting the contents from the editor. getting the contents from the editor.
@ -785,7 +788,7 @@ if (match) {
<img src="doc/site/images/zorba-logo.png" <img src="doc/site/images/zorba-logo.png"
style="left: -5px; top: 16px; style="left: -5px; top: 16px;
padding: 6px 4px 6px 6px; width: 100px" /> padding: 6px 4px 6px 6px; width: 100px" />
<a href="http://www.zorba-xquery.com/html/demo">Zorba XQuery</a> <a href="http://try.zorba.io/queries/xquery">Zorba XQuery</a>
</li> </li>
<li> <li>
<img src="doc/site/images/plunker.png" <img src="doc/site/images/plunker.png"
@ -871,9 +874,9 @@ if (match) {
<a href="https://drivenotepad.appspot.com/support">Drive Notepad</a> <a href="https://drivenotepad.appspot.com/support">Drive Notepad</a>
</li> </li>
<li> <li>
<img src="doc/site/images/FineCut_small_logo.png" <img src="http://textor.houfeng.net/images/textor.png"
style="left: 12px; top: -4px" /> style="position: relative; left: 13px; top: -3px; width: 75px" />
<a href="http://finecut.info/">Fine Cut Engine</a> <a href="http://textor.houfeng.net/">Textor</a>
</li> </li>
<li> <li>
<img src="http://phpassist.com/images/logo-large.png" <img src="http://phpassist.com/images/logo-large.png"
@ -907,9 +910,9 @@ if (match) {
<a href="http://orbit.bonsaijs.org/">BonsaiJS playground</a> <a href="http://orbit.bonsaijs.org/">BonsaiJS playground</a>
</li> </li>
<li> <li>
<img src="doc/site/images/acebug-logo.png" <img src="http://approximatrix.com/products/simplytext/logo-320x320.png"
style="left: 20px; top: 5px;"> style="width: 106px; left: -4px; top: -22px;">
<a href="https://addons.mozilla.org/en-US/firefox/addon/acebug/">Acebug</a> <a href="http://approximatrix.com/products/simplytext">Simply Text</a>
</li> </li>
<li> <li>
<div class="text-logo" style="font-size: 18px;">ShareLaTeX</div> <div class="text-logo" style="font-size: 18px;">ShareLaTeX</div>
@ -1109,7 +1112,7 @@ if (match) {
<a href="http://bakemycss.mypathforpython.appspot.com/">BakeMyCss</a> <a href="http://bakemycss.mypathforpython.appspot.com/">BakeMyCss</a>
</li> </li>
<li> <li>
<div class="" style=" <div style="
background: url(https://s3.amazonaws.com/spark-website/spark.png) no-repeat; background: url(https://s3.amazonaws.com/spark-website/spark.png) no-repeat;
position: absolute; height: 65px; width: 83px; background-size: 200px 65px; position: absolute; height: 65px; width: 83px; background-size: 200px 65px;
background-position: 19px;"></div> background-position: 19px;"></div>
@ -1128,7 +1131,56 @@ if (match) {
<a href=" http://www.praczone.com/editor">pracZone</a> <a href=" http://www.praczone.com/editor">pracZone</a>
</li> </li>
<li> <li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a> <img src="http://resources.qooxdoo.org/images/logo.gif"
style="width: 125px; left: -13px; top: 18px;">
<a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a>
</li>
<li>
<div class="text-logo">ShareJS</div>
<a href="http://sharejs.org/hello-ace.html">ShareJS</a>
</li>
<li>
<img src="https://neutron-drive.appspot.com/static/img/neutron_face_high.png"
style="width: 86px; left: 7px; top: -11px;">
<a href="http://neutronide.com/">Neutron IDE</a>
</li>
<li>
<div style="
background: url(https://www.pythonanywhere.com/static/anywhere/images/logo-234x35.png) no-repeat;
position: absolute; height: 65px; width: 94px; background-size: 234px 35px;
background-position: 19px;"></div>
<a href="http://www.pythonanywhere.com/">PythonAnywhere</a>
</li>
<li>
<img src="http://subtexteditor.com/images/subtext-icon-4.png"
style="width: 86px; left: 7px; top: -11px;">
<a href="http://subtexteditor.com/">Subtext Editor</a>
</li>
<li>
<img src="http://climbi.com/static/img/logo.png"
style="width: 86px; left: 7px; top: -11px;">
<a href="http://climbi.com/">Climbi</a>
</li>
<li>
<div style="
background: url(http://gpupowered.org/sites/default/files/favicon.png) rgba(0, 0, 0, 0.66) no-repeat;
position: absolute;
height: 75px;
width: 99px; background-size: 27px 32px;
background-position: 37px;"></div>
<a href="http://www.gpupowered.org/sand2/launch2/#">GPUPowered</a>
</li>
<li style="width: 248px;">
<img src="http://www.codeavengers.com/image/RedLogoSmall.png" style="width: 248px; top: 30px;">
<a href="http://www.codeavengers.com/image/RedLogoSmall.png">Code Avengers</a>
</li>
<li style="width: 248px;">
<img src="http://www.codemonkey.co.il/images/logoSmallFaceTop.png" style="width: 248px; top: -3px;">
<a href="http://www.codemonkey.co.il/">CodeMonkey</a>
</li>
<li style="width: 248px;">
<img src="http://learn-angular.org/Content/Images/LearnAngular-small.png" style="width: 275px; left: -12px; top: 7px;">
<a href="http://learn-angular.org">Learn Angular</a>
</li> </li>
<li> <li>
<a href="http://www.wavemaker.com/">WaveMaker</a> <a href="http://www.wavemaker.com/">WaveMaker</a>
@ -1136,35 +1188,15 @@ if (match) {
<li> <li>
<a href="http://www.playmycode.com/">Play My Code</a> <a href="http://www.playmycode.com/">Play My Code</a>
</li> </li>
<li>
<img src="http://resources.qooxdoo.org/images/logo.gif"
style="width: 125px; left: -13px; top: 18px;">
<a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a>
</li>
<li> <li>
<a href="http://ext.radiantcms.org/extensions/264-ace">Radiant CMS</a> <a href="http://ext.radiantcms.org/extensions/264-ace">Radiant CMS</a>
</li> </li>
<li> <li>
<a href="http://developercompanion.com/">Developer Companion</a> <a href="http://developercompanion.com/">Developer Companion</a>
</li> </li>
<li>
<a href="http://www.pythonanywhere.com/">PythonAnywhere</a>
</li>
<li>
<div class="text-logo">ShareJS</div>
<a href="http://sharejs.org/hello-ace.html">ShareJS</a>
</li>
<li>
<img src="https://neutron-drive.appspot.com/static/img/neutron_face_high.png"
style="width: 76px; left: 7px; top: -11px;">
<a href="http://neutronide.com/">Neutron IDE</a>
</li>
<li> <li>
<a href="http://www.akshell.com/">Akshell</a> <a href="http://www.akshell.com/">Akshell</a>
</li> </li>
<li>
<a href="http://beanstalkapp.com/">beanstalk</a>
</li>
<li> <li>
<div class="text-logo">tmpltr</div> <div class="text-logo">tmpltr</div>

View file

@ -11,16 +11,10 @@
commit %commit% commit %commit%
--> -->
<!--DEVEL--> <link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
<link rel="stylesheet" href="demo/kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8"> <script async="true" src="https://use.edgefonts.net/source-code-pro.js"></script>
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
<!--DEVEL-->
<link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon"> <link href="./doc/site/images/favicon.ico" rel="icon" type="image/x-icon">
<!--PACKAGE
<link rel="stylesheet" href="kitchen-sink/styles.css" type="text/css" media="screen" charset="utf-8">
<script async="true" src="http://use.edgefonts.net/source-code-pro.js"></script>
PACKAGE-->
</head> </head>
<body> <body>
<div id="optionsPanel" style="position:absolute;height:100%;width:260px"> <div id="optionsPanel" style="position:absolute;height:100%;width:260px">
@ -287,7 +281,7 @@
<script src="src/ace.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script> <script src="src/ace.js" data-ace-base="src" type="text/javascript" charset="utf-8"></script>
<script src="src/keybinding-vim.js"></script> <script src="src/keybinding-vim.js"></script>
<script src="src/keybinding-emacs.js"></script> <script src="src/keybinding-emacs.js"></script>
<script src="kitchen-sink/demo.js"></script> <script src="demo/kitchen-sink/demo.js"></script>
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
require("kitchen-sink/demo"); require("kitchen-sink/demo");
</script> </script>

View file

@ -46,12 +46,12 @@ var Editor = require("./editor").Editor;
var EditSession = require("./edit_session").EditSession; var EditSession = require("./edit_session").EditSession;
var UndoManager = require("./undomanager").UndoManager; var UndoManager = require("./undomanager").UndoManager;
var Renderer = require("./virtual_renderer").VirtualRenderer; var Renderer = require("./virtual_renderer").VirtualRenderer;
var MultiSelect = require("./multi_select").MultiSelect;
// The following require()s are for inclusion in the built ace file // The following require()s are for inclusion in the built ace file
require("./worker/worker_client"); require("./worker/worker_client");
require("./keyboard/hash_handler"); require("./keyboard/hash_handler");
require("./placeholder"); require("./placeholder");
require("./multi_select");
require("./mode/folding/fold_mode"); require("./mode/folding/fold_mode");
require("./theme/textmate"); require("./theme/textmate");
require("./ext/error_marker"); require("./ext/error_marker");
@ -74,7 +74,7 @@ exports.require = require;
exports.edit = function(el) { exports.edit = function(el) {
if (typeof(el) == "string") { if (typeof(el) == "string") {
var _id = el; var _id = el;
var el = document.getElementById(_id); el = document.getElementById(_id);
if (!el) if (!el)
throw new Error("ace.edit can't find div #" + _id); throw new Error("ace.edit can't find div #" + _id);
} }
@ -86,7 +86,6 @@ exports.edit = function(el) {
el.innerHTML = ''; el.innerHTML = '';
var editor = new Editor(new Renderer(el)); var editor = new Editor(new Renderer(el));
new MultiSelect(editor);
editor.setSession(doc); editor.setSession(doc);
var env = { var env = {

View file

@ -58,6 +58,15 @@ module.exports = {
assert.position(anchor.getPosition(), 1, 7); assert.position(anchor.getPosition(), 1, 7);
}, },
"test insert text at anchor should not move anchor when insertRight is true": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4);
anchor.$insertRight = true;
doc.insert({row: 1, column: 4}, "123");
assert.position(anchor.getPosition(), 1, 4);
},
"test insert lines before cursor should move anchor row": function() { "test insert lines before cursor should move anchor row": function() {
var doc = new Document("juhu\nkinners"); var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4); var anchor = new Anchor(doc, 1, 4);
@ -66,6 +75,32 @@ module.exports = {
assert.position(anchor.getPosition(), 3, 4); assert.position(anchor.getPosition(), 3, 4);
}, },
"test insert lines at anchor position should move anchor down": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 0);
doc.insertLines(1, ["line"]);
assert.position(anchor.getPosition(), 2, 0);
},
"test insert lines at anchor position should not move anchor down when insertRight is true and column is 0": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 0);
anchor.$insertRight = true;
doc.insertLines(1, ["line"]);
assert.position(anchor.getPosition(), 1, 0);
},
"test insert lines at anchor row should move anchor down when column > 0": function() {
var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 2);
anchor.$insertRight = true;
doc.insertLines(1, ["line"]);
assert.position(anchor.getPosition(), 2, 2);
},
"test insert new line before cursor should move anchor column": function() { "test insert new line before cursor should move anchor column": function() {
var doc = new Document("juhu\nkinners"); var doc = new Document("juhu\nkinners");
var anchor = new Anchor(doc, 1, 4); var anchor = new Anchor(doc, 1, 4);

View file

@ -51,7 +51,7 @@ var Autocomplete = function() {
this.changeTimer = lang.delayedCall(function() { this.changeTimer = lang.delayedCall(function() {
this.updateCompletions(true); this.updateCompletions(true);
}.bind(this)) }.bind(this));
}; };
(function() { (function() {
@ -63,6 +63,7 @@ var Autocomplete = function() {
this.insertMatch(); this.insertMatch();
e.stop(); e.stop();
}.bind(this)); }.bind(this));
this.popup.focus = this.editor.focus.bind(this.editor);
}; };
this.openPopup = function(editor, prefix, keepPopupPosition) { this.openPopup = function(editor, prefix, keepPopupPosition) {
@ -122,7 +123,10 @@ var Autocomplete = function() {
}; };
this.blurListener = function() { this.blurListener = function() {
if (document.activeElement != this.editor.textInput.getElement()) // we have to check if activeElement is a child of popup because
// on IE preventDefault doesn't stop scrollbar from being focussed
var el = document.activeElement;
if (el != this.editor.textInput.getElement() && el.parentNode != this.popup.container)
this.detach(); this.detach();
}; };
@ -139,7 +143,7 @@ var Autocomplete = function() {
var max = this.popup.session.getLength() - 1; var max = this.popup.session.getLength() - 1;
switch(where) { switch(where) {
case "up": row = row < 0 ? max : row - 1; break; case "up": row = row <= 0 ? max : row - 1; break;
case "down": row = row >= max ? -1 : row + 1; break; case "down": row = row >= max ? -1 : row + 1; break;
case "start": row = 0; break; case "start": row = 0; break;
case "end": row = max; break; case "end": row = max; break;
@ -180,13 +184,15 @@ var Autocomplete = function() {
"Esc": function(editor) { editor.completer.detach(); }, "Esc": function(editor) { editor.completer.detach(); },
"Space": function(editor) { editor.completer.detach(); editor.insert(" ");}, "Space": function(editor) { editor.completer.detach(); editor.insert(" ");},
"Return": function(editor) { "Return": function(editor) { return editor.completer.insertMatch(); },
if (editor.completer.popup.getRow() == -1)
return false;
editor.completer.insertMatch();
},
"Shift-Return": function(editor) { editor.completer.insertMatch(true); }, "Shift-Return": function(editor) { editor.completer.insertMatch(true); },
"Tab": function(editor) { editor.completer.insertMatch(); }, "Tab": function(editor) {
var result = editor.completer.insertMatch();
if (!result && !editor.tabstopManager)
editor.completer.goTo("down");
else
return result;
},
"PageUp": function(editor) { editor.completer.popup.gotoPageUp(); }, "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
"PageDown": function(editor) { editor.completer.popup.gotoPageDown(); } "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
@ -208,16 +214,16 @@ var Autocomplete = function() {
completer.getCompletions(editor, session, pos, prefix, function(err, results) { completer.getCompletions(editor, session, pos, prefix, function(err, results) {
if (!err) if (!err)
matches = matches.concat(results); matches = matches.concat(results);
// Fetch prefix again, because they may have changed by now // Fetch prefix again, because they may have changed by now
var pos = editor.getCursorPosition(); var pos = editor.getCursorPosition();
var line = session.getLine(pos.row); var line = session.getLine(pos.row);
callback(null, { callback(null, {
prefix: util.retrievePrecedingIdentifier(line, pos.column), prefix: util.retrievePrecedingIdentifier(line, pos.column, results[0] && results[0].identifierRegex),
matches: matches, matches: matches,
finished: (--total === 0) finished: (--total === 0)
});
}); });
}); });
});
return true; return true;
}; };
@ -264,31 +270,19 @@ var Autocomplete = function() {
var _id = this.gatherCompletionsId; var _id = this.gatherCompletionsId;
this.gatherCompletions(this.editor, function(err, results) { this.gatherCompletions(this.editor, function(err, results) {
// Only detach if result gathering is finished // Only detach if result gathering is finished
var doDetach = function() { var detachIfFinished = function() {
if (!results.finished) return; if (!results.finished) return;
return this.detach(); return this.detach();
}.bind(this); }.bind(this);
// Calcul prefix var prefix = results.prefix;
var session = this.editor.getSession();
var pos = this.editor.getCursorPosition();
var line = session.getLine(pos.row);
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
// Results matches
var matches = results && results.matches; var matches = results && results.matches;
if (!matches || !matches.length)
return this.detach();
// TODO reenable this when we have proper change tracking
// if (matches.length == 1)
// return this.insertMatch(matches[0]);
// No prefix or no results -> close if (!matches || !matches.length)
if (!prefix || !prefix.length || !matches || !matches.length) return detachIfFinished();
return doDetach();
// Wrong prefix or wrong session -> ignore // Wrong prefix or wrong session -> ignore
if (prefix.indexOf(results.prefix) != 0 || _id != this.gatherCompletionsId) if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
return; return;
this.completions = new FilteredList(matches); this.completions = new FilteredList(matches);
@ -297,11 +291,11 @@ var Autocomplete = function() {
// No results // No results
if (!filtered.length) if (!filtered.length)
return doDetach(); return detachIfFinished();
// One result equals to the prefix // One result equals to the prefix
if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
return doDetach(); return detachIfFinished();
// Autoinsert if one result // Autoinsert if one result
if (this.autoInsert && filtered.length == 1) if (this.autoInsert && filtered.length == 1)
@ -312,13 +306,7 @@ var Autocomplete = function() {
}; };
this.cancelContextMenu = function() { this.cancelContextMenu = function() {
var stop = function(e) { this.editor.$mouseHandler.cancelContextMenu();
this.editor.off("nativecontextmenu", stop);
if (e && e.domEvent)
event.stopEvent(e.domEvent);
}.bind(this);
setTimeout(stop, 10);
this.editor.on("nativecontextmenu", stop);
}; };
}).call(Autocomplete.prototype); }).call(Autocomplete.prototype);
@ -328,6 +316,8 @@ Autocomplete.startCommand = {
exec: function(editor) { exec: function(editor) {
if (!editor.completer) if (!editor.completer)
editor.completer = new Autocomplete(); editor.completer = new Autocomplete();
editor.completer.autoInsert =
editor.completer.autoSelect = true;
editor.completer.showPopup(editor); editor.completer.showPopup(editor);
// needed for firefox on mac // needed for firefox on mac
editor.completer.cancelContextMenu(); editor.completer.cancelContextMenu();

View file

@ -31,7 +31,7 @@
define(function(require, exports, module) { define(function(require, exports, module) {
var Range = require("../range").Range; var Range = require("../range").Range;
var splitRegex = /[^a-zA-Z_0-9\$\-]+/; var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;
function getWordIndex(doc, pos) { function getWordIndex(doc, pos) {
var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos)); var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));

View file

@ -43,9 +43,9 @@ exports.parForEach = function(array, fn, callback) {
callback(result, err); callback(result, err);
}); });
} }
} };
var ID_REGEX = /[a-zA-Z_0-9\$-]/; var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/;
exports.retrievePrecedingIdentifier = function(text, pos, regex) { exports.retrievePrecedingIdentifier = function(text, pos, regex) {
regex = regex || ID_REGEX; regex = regex || ID_REGEX;
@ -57,7 +57,7 @@ exports.retrievePrecedingIdentifier = function(text, pos, regex) {
break; break;
} }
return buf.reverse().join(""); return buf.reverse().join("");
} };
exports.retrieveFollowingIdentifier = function(text, pos, regex) { exports.retrieveFollowingIdentifier = function(text, pos, regex) {
regex = regex || ID_REGEX; regex = regex || ID_REGEX;
@ -69,6 +69,6 @@ exports.retrieveFollowingIdentifier = function(text, pos, regex) {
break; break;
} }
return buf; return buf;
} };
}); });

View file

@ -33,6 +33,7 @@ define(function(require, exports, module) {
var lang = require("../lib/lang"); var lang = require("../lib/lang");
var config = require("../config"); var config = require("../config");
var Range = require("../range").Range;
function bindKey(win, mac) { function bindKey(win, mac) {
return {win: win, mac: mac}; return {win: win, mac: mac};
@ -141,15 +142,19 @@ exports.commands = [{
name: "findnext", name: "findnext",
bindKey: bindKey("Ctrl-K", "Command-G"), bindKey: bindKey("Ctrl-K", "Command-G"),
exec: function(editor) { editor.findNext(); }, exec: function(editor) { editor.findNext(); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true readOnly: true
}, { }, {
name: "findprevious", name: "findprevious",
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
exec: function(editor) { editor.findPrevious(); }, exec: function(editor) { editor.findPrevious(); },
multiSelectAction: "forEach",
scrollIntoView: "center",
readOnly: true readOnly: true
}, { }, {
name: "selectOrFindNext", name: "selectOrFindNext",
bindKey: bindKey("ALt-K", "Ctrl-G"), bindKey: bindKey("Alt-K", "Ctrl-G"),
exec: function(editor) { exec: function(editor) {
if (editor.selection.isEmpty()) if (editor.selection.isEmpty())
editor.selection.selectWord(); editor.selection.selectWord();
@ -387,16 +392,22 @@ exports.commands = [{
readOnly: true readOnly: true
}, { }, {
name: "jumptomatching", name: "jumptomatching",
bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"), bindKey: bindKey("Ctrl-P", "Ctrl-P"),
exec: function(editor) { editor.jumpToMatching(); }, exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true readOnly: true
}, { }, {
name: "selecttomatching", name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", null), bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(true); }, exec: function(editor) { editor.jumpToMatching(true); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true readOnly: true
}, {
name: "passKeysToBrowser",
bindKey: bindKey("null", "null"),
exec: function() {},
passEvent: true,
readOnly: true
}, },
// commands disabled in readOnly mode // commands disabled in readOnly mode
@ -598,6 +609,100 @@ exports.commands = [{
exec: function(editor) { editor.toLowerCase(); }, exec: function(editor) { editor.toLowerCase(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
scrollIntoView: "cursor" scrollIntoView: "cursor"
}, {
name: "expandtoline",
bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"),
exec: function(editor) {
var range = editor.selection.getRange();
range.start.column = range.end.column = 0;
range.end.row++;
editor.selection.setRange(range, false);
},
multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true
}, {
name: "joinlines",
bindKey: bindKey(null, null),
exec: function(editor) {
var isBackwards = editor.selection.isBackwards();
var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor();
var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead();
var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length
var selectedText = editor.session.doc.getTextRange(editor.selection.getRange());
var selectedCount = selectedText.replace(/\n\s*/, " ").length;
var insertLine = editor.session.doc.getLine(selectionStart.row);
for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) {
var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i)));
if (curLine.length !== 0) {
curLine = " " + curLine;
}
insertLine += curLine;
};
if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) {
// Don't insert a newline at the end of the document
insertLine += editor.session.doc.getNewLineCharacter();
}
editor.clearSelection();
editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine);
if (selectedCount > 0) {
// Select the text that was previously selected
editor.selection.moveCursorTo(selectionStart.row, selectionStart.column);
editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount);
} else {
// If the joined line had something in it, start the cursor at that something
firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol;
editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol);
}
},
multiSelectAction: "forEach",
readOnly: true
}, {
name: "invertSelection",
bindKey: bindKey(null, null),
exec: function(editor) {
var endRow = editor.session.doc.getLength() - 1;
var endCol = editor.session.doc.getLine(endRow).length;
var ranges = editor.selection.rangeList.ranges;
var newRanges = [];
// If multiple selections don't exist, rangeList will return 0 so replace with single range
if (ranges.length < 1) {
ranges = [editor.selection.getRange()];
}
for (var i = 0; i < ranges.length; i++) {
if (i == (ranges.length - 1)) {
// The last selection must connect to the end of the document, unless it already does
if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) {
newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol));
}
}
if (i === 0) {
// The first selection must connect to the start of the document, unless it already does
if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) {
newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column));
}
} else {
newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column));
}
}
editor.exitMultiSelectMode();
editor.clearSelection();
for(var i = 0; i < newRanges.length; i++) {
editor.selection.addRange(newRanges[i], false);
}
},
readOnly: true,
scrollIntoView: "none"
}]; }];
}); });

View file

@ -80,6 +80,11 @@ exports.defaultCommands = [{
name: "alignCursors", name: "alignCursors",
exec: function(editor) { editor.alignCursors(); }, exec: function(editor) { editor.alignCursors(); },
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"} bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
}, {
name: "findAll",
exec: function(editor) { editor.findAll(); },
bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"},
readonly: true
}]; }];
// commands active only in multiselect mode // commands active only in multiselect mode

View file

@ -153,7 +153,11 @@ function init(packaged) {
var scriptOptions = {}; var scriptOptions = {};
var scriptUrl = ""; var scriptUrl = "";
var scripts = document.getElementsByTagName("script"); // Use currentScript.ownerDocument in case this file was loaded from imported document. (HTML Imports)
var currentScript = (document.currentScript || document._currentScript ); // native or polyfill
var currentDocument = currentScript && currentScript.ownerDocument || document;
var scripts = currentDocument.getElementsByTagName("script");
for (var i=0; i<scripts.length; i++) { for (var i=0; i<scripts.length; i++) {
var script = scripts[i]; var script = scripts[i];

View file

@ -485,15 +485,15 @@ function Folding() {
}; };
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
if (startRow == null) { if (startRow == null)
startRow = foldLine.start.row; startRow = foldLine.start.row;
if (startColumn == null)
startColumn = 0; startColumn = 0;
} if (endRow == null)
if (endRow == null) {
endRow = foldLine.end.row; endRow = foldLine.end.row;
if (endColumn == null)
endColumn = this.getLine(endRow).length; endColumn = this.getLine(endRow).length;
}
// Build the textline using the FoldLine walker. // Build the textline using the FoldLine walker.
var doc = this.doc; var doc = this.doc;

View file

@ -48,6 +48,7 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
var CommandManager = require("./commands/command_manager").CommandManager; var CommandManager = require("./commands/command_manager").CommandManager;
var defaultCommands = require("./commands/default_commands").commands; var defaultCommands = require("./commands/default_commands").commands;
var config = require("./config"); var config = require("./config");
var TokenIterator = require("./token_iterator").TokenIterator;
/** /**
* The main entry point into the Ace functionality. * The main entry point into the Ace functionality.
@ -210,13 +211,14 @@ var Editor = function(renderer, session) {
} }
}; };
// TODO use property on commands instead of this
this.$mergeableCommands = ["backspace", "del", "insertstring"];
this.$historyTracker = function(e) { this.$historyTracker = function(e) {
if (!this.$mergeUndoDeltas) if (!this.$mergeUndoDeltas)
return; return;
var prev = this.prevOp; var prev = this.prevOp;
var mergeableCommands = ["backspace", "del", "insertstring"]; var mergeableCommands = this.$mergeableCommands;
// previous command was the same // previous command was the same
var shouldMerge = prev.command && (e.command.name == prev.command.name); var shouldMerge = prev.command && (e.command.name == prev.command.name);
if (e.command.name == "insertstring") { if (e.command.name == "insertstring") {
@ -535,6 +537,89 @@ var Editor = function(renderer, session) {
}, 50); }, 50);
}; };
// todo: move to mode.getMatching
this.$highlightTags = function() {
var session = this.session;
if (this.$highlightTagPending) {
return;
}
// perform highlight async to not block the browser during navigation
var self = this;
this.$highlightTagPending = true;
setTimeout(function() {
self.$highlightTagPending = false;
var pos = self.getCursorPosition();
var iterator = new TokenIterator(self.session, pos.row, pos.column);
var token = iterator.getCurrentToken();
if (!token || token.type.indexOf('tag-name') === -1) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
return;
}
var tag = token.value;
var depth = 0;
var prevToken = iterator.stepBackward();
if (prevToken.value == '<'){
//find closing tag
do {
prevToken = token;
token = iterator.stepForward();
if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
if (prevToken.value==='<'){
depth++;
} else if (prevToken.value==='</'){
depth--;
}
}
} while (token && depth>=0);
}else{
//find opening tag
do {
token = prevToken;
prevToken = iterator.stepBackward();
if(token && token.value === tag && token.type.indexOf('tag-name') !== -1) {
if (prevToken.value==='<') {
depth++;
} else if( prevToken.value==='</') {
depth--;
}
}
} while (prevToken && depth<=0);
//select tag again
iterator.stepForward();
}
if (!token) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
return;
}
var row = iterator.getCurrentTokenRow();
var column = iterator.getCurrentTokenColumn();
var range = new Range(row, column, row, column+token.value.length);
//remove range if different
if (session.$tagHighlight && range.compareRange(session.$backMarkers[session.$tagHighlight].range)!==0) {
session.removeMarker(session.$tagHighlight);
session.$tagHighlight = null;
}
if (range && !session.$tagHighlight)
session.$tagHighlight = session.addMarker(range, "ace_bracket", "text");
}, 50);
};
/** /**
* *
* Brings the current `textInput` into focus. * Brings the current `textInput` into focus.
@ -645,6 +730,7 @@ var Editor = function(renderer, session) {
} }
this.$highlightBrackets(); this.$highlightBrackets();
this.$highlightTags();
this.$updateHighlightActiveLine(); this.$updateHighlightActiveLine();
this._signal("changeSelection"); this._signal("changeSelection");
}; };
@ -1901,24 +1987,157 @@ var Editor = function(renderer, session) {
}; };
/** /**
* Moves the cursor's row and column to the next matching bracket. * Moves the cursor's row and column to the next matching bracket or HTML tag.
* *
**/ **/
this.jumpToMatching = function(select) { this.jumpToMatching = function(select) {
var cursor = this.getCursorPosition(); var cursor = this.getCursorPosition();
var iterator = new TokenIterator(this.session, cursor.row, cursor.column);
var prevToken = iterator.getCurrentToken();
var token = prevToken;
var range = this.session.getBracketRange(cursor); if (!token)
if (!range) { token = iterator.stepForward();
range = this.find({
needle: /[{}()\[\]]/g, if (!token)
preventScroll:true, return;
start: {row: cursor.row, column: cursor.column - 1}
}); //get next closing tag or bracket
if (!range) var matchType;
var found = false;
var depth = {};
var i = cursor.column - token.start;
var bracketType;
var brackets = {
")": "(",
"(": "(",
"]": "[",
"[": "[",
"{": "{",
"}": "{"
};
do {
if (token.value.match(/[{}()\[\]]/g)) {
for (; i<token.value.length && !found; i++) {
if (!brackets[token.value[i]]) {
continue;
}
bracketType = brackets[token.value[i]]+'.'+token.type.replace("rparen", "lparen");
if (isNaN(depth[bracketType])) {
depth[bracketType] = 0;
}
switch (token.value[i]) {
case '(':
case '[':
case '{':
depth[bracketType]++;
break;
case ')':
case ']':
case '}':
depth[bracketType]--;
if (depth[bracketType]===-1) {
matchType = 'bracket';
found = true;
}
break;
}
}
} else if (token && token.type.indexOf('tag-name') !== -1) {
if (isNaN(depth[token.value])) {
depth[token.value] = 0;
}
if (prevToken.value === '<') {
depth[token.value]++;
} else if (prevToken.value === '</') {
depth[token.value]--;
}
if (depth[token.value] === -1) {
matchType = 'tag';
found = true;
}
}
if (!found) {
prevToken = token;
token = iterator.stepForward();
i = 0;
}
} while (token && !found);
//no match found
if (!matchType) {
return;
}
var range;
if (matchType==='bracket') {
range = this.session.getBracketRange(cursor);
if (!range) {
range = new Range(
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn()+i-1,
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn()+i-1
);
if (!range)
return;
var pos = range.start;
if (pos.row === cursor.row && Math.abs(pos.column - cursor.column) < 2)
range = this.session.getBracketRange(pos);
}
} else if(matchType==='tag') {
if (token && token.type.indexOf('tag-name') !== -1)
var tag = token.value;
else
return; return;
var pos = range.start;
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2) var range = new Range(
range = this.session.getBracketRange(pos); iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn()-2,
iterator.getCurrentTokenRow(),
iterator.getCurrentTokenColumn()-2
);
//find matching tag
if (range.compare(cursor.row, cursor.column) === 0) {
found = false;
do {
token = prevToken;
prevToken = iterator.stepBackward();
if (prevToken) {
if (prevToken.type.indexOf('tag-close') !== -1) {
range.setEnd(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn()+1);
}
if (token.value === tag && token.type.indexOf('tag-name') !== -1) {
if (prevToken.value === '<') {
depth[tag]++;
} else if ( prevToken.value === '</') {
depth[tag]--;
}
if (depth[tag]===0)
found = true;
}
}
} while (prevToken && !found);
}
//we found it
if (token && token.type.indexOf('tag-name')) {
var pos = range.start;
if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
pos = range.end;
}
} }
pos = range && range.cursor || pos; pos = range && range.cursor || pos;
@ -2349,8 +2568,9 @@ var Editor = function(renderer, session) {
var cursorLayer = this.renderer.$cursorLayer; var cursorLayer = this.renderer.$cursorLayer;
if (!cursorLayer) if (!cursorLayer)
return; return;
cursorLayer.setSmoothBlinking(style == "smooth"); cursorLayer.setSmoothBlinking(/smooth/.test(style));
cursorLayer.isBlinking = !this.$readOnly && style != "wide"; cursorLayer.isBlinking = !this.$readOnly && style != "wide";
dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
}; };
}).call(Editor.prototype); }).call(Editor.prototype);
@ -2375,7 +2595,8 @@ config.defineOptions(Editor.prototype, "editor", {
}, },
readOnly: { readOnly: {
set: function(readOnly) { set: function(readOnly) {
this.textInput.setReadOnly(readOnly); // disabled to not break vim mode!
// this.textInput.setReadOnly(readOnly);
this.$resetCursorStyle(); this.$resetCursorStyle();
}, },
initialValue: false initialValue: false

View file

@ -368,6 +368,7 @@ exports.runEmmetCommand = function(editor) {
} catch(e) { } catch(e) {
editor._signal("changeStatus", typeof e == "string" ? e : e.message); editor._signal("changeStatus", typeof e == "string" ? e : e.message);
console.log(e); console.log(e);
result = false
} }
return result; return result;
}; };

View file

@ -72,6 +72,11 @@ exports.addCompleter = function(completer) {
completers.push(completer); completers.push(completer);
}; };
// Exports existing completer so that user can construct his own set of completers.
exports.textCompleter = textCompleter;
exports.keyWordCompleter = keyWordCompleter;
exports.snippetCompleter = snippetCompleter;
var expandSnippet = { var expandSnippet = {
name: "expandSnippet", name: "expandSnippet",
exec: function(editor) { exec: function(editor) {
@ -79,7 +84,7 @@ var expandSnippet = {
if (!success) if (!success)
editor.execCommand("indent"); editor.execCommand("indent");
}, },
bindKey: "tab" bindKey: "Tab"
}; };
var onChangeMode = function(e, editor) { var onChangeMode = function(e, editor) {
@ -103,8 +108,9 @@ var loadSnippetFile = function(id) {
config.loadModule(snippetFilePath, function(m) { config.loadModule(snippetFilePath, function(m) {
if (m) { if (m) {
snippetManager.files[id] = m; snippetManager.files[id] = m;
m.snippets = snippetManager.parseSnippetFile(m.snippetText); if (!m.snippets && m.snippetText)
snippetManager.register(m.snippets, m.scope); m.snippets = snippetManager.parseSnippetFile(m.snippetText);
snippetManager.register(m.snippets || [], m.scope);
if (m.includeScopes) { if (m.includeScopes) {
snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes; snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes;
m.includeScopes.forEach(function(x) { m.includeScopes.forEach(function(x) {
@ -115,55 +121,51 @@ var loadSnippetFile = function(id) {
}); });
}; };
function getCompletionPrefix(editor) {
var pos = editor.getCursorPosition();
var line = editor.session.getLine(pos.row);
var prefix = util.retrievePrecedingIdentifier(line, pos.column);
// Try to find custom prefixes on the completers
editor.completers.forEach(function(completer) {
if (completer.identifierRegexps) {
completer.identifierRegexps.forEach(function(identifierRegex) {
if (!prefix && identifierRegex)
prefix = util.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
});
}
});
return prefix;
}
var doLiveAutocomplete = function(e) { var doLiveAutocomplete = function(e) {
var editor = e.editor; var editor = e.editor;
var session = editor.getSession();
var pos = editor.getCursorPosition();
var line = session.getLine(pos.row);
var hasCompleter = (editor.completer && editor.completer.activated);
var text = e.args || ""; var text = e.args || "";
var hasCompleter = editor.completer && editor.completer.activated;
// Is the user entering text
// we only want to automatically show the autocomplete dialog
// whenever the user is typing in text not pasting, deleting, ...
var typing = (e.command.name === "insertstring" && text.length === 1);
// We don't want to autocomplete with no prefix // We don't want to autocomplete with no prefix
if( if (e.command.name === "backspace") {
e.command.name === 'backspace' && if (hasCompleter && !getCompletionPrefix(editor))
util.retrievePrecedingIdentifier(line, pos.column) === '' editor.completer.detach();
) {
if(hasCompleter) editor.completer.detach();
return;
} }
else if (e.command.name === "insertstring") {
// we don't want to autocomplete on paste events var prefix = getCompletionPrefix(editor);
if(!typing) { // Only autocomplete if there's a prefix that can be matched
return; if (prefix && !hasCompleter) {
} if (!editor.completer) {
// Create new autocompleter
// The prefix to autocomplete for editor.completer = new Autocomplete();
var prefix = util.retrievePrecedingIdentifier(line, pos.column); }
// Only autocomplete if there's a prefix that can be matched
if(prefix !== '' && !(hasCompleter)) {
if (!editor.completer) {
// Create new autocompleter
editor.completer = new Autocomplete();
// Disable autoInsert // Disable autoInsert
editor.completer.autoSelect = false;
editor.completer.autoInsert = false; editor.completer.autoInsert = false;
editor.completer.showPopup(editor);
} else if (!prefix && hasCompleter) {
// When the prefix is empty
// close the autocomplete dialog
editor.completer.detach();
} }
editor.completer.showPopup(editor);
// needed for firefox on mac
editor.completer.cancelContextMenu();
} else if(prefix === '' && hasCompleter) {
// When the prefix is empty
// close the autocomplete dialog
editor.completer.detach();
} }
}; };
@ -172,7 +174,8 @@ require("../config").defineOptions(Editor.prototype, "editor", {
enableBasicAutocompletion: { enableBasicAutocompletion: {
set: function(val) { set: function(val) {
if (val) { if (val) {
this.completers = completers; if (!this.completers)
this.completers = Array.isArray(val)? val: completers;
this.commands.addCommand(Autocomplete.startCommand); this.commands.addCommand(Autocomplete.startCommand);
} else { } else {
this.commands.removeCommand(Autocomplete.startCommand); this.commands.removeCommand(Autocomplete.startCommand);
@ -180,9 +183,15 @@ require("../config").defineOptions(Editor.prototype, "editor", {
}, },
value: false value: false
}, },
enableLiveAutocomplete: { /**
* Enable live autocomplete. If the value is an array, it is assumed to be an array of completers
* and will use them instead of the default completers.
*/
enableLiveAutocompletion: {
set: function(val) { set: function(val) {
if (val) { if (val) {
if (!this.completers)
this.completers = Array.isArray(val)? val: completers;
// On each change automatically trigger the autocomplete // On each change automatically trigger the autocomplete
this.commands.on('afterExec', doLiveAutocomplete); this.commands.on('afterExec', doLiveAutocomplete);
} else { } else {
@ -205,5 +214,4 @@ require("../config").defineOptions(Editor.prototype, "editor", {
value: false value: false
} }
}); });
}); });

78
lib/ace/ext/linking.js Normal file
View file

@ -0,0 +1,78 @@
/* ***** 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 Editor = require("ace/editor").Editor;
require("../config").defineOptions(Editor.prototype, "editor", {
enableLinking: {
set: function(val) {
if (val) {
this.on("click", onClick);
this.on("mousemove", onMouseMove);
} else {
this.off("click", onClick);
this.off("mousemove", onMouseMove);
}
},
value: false
}
})
function onMouseMove(e) {
var editor = e.editor;
var ctrl = e.getAccelKey();
if (ctrl) {
var editor = e.editor;
var docPos = e.getDocumentPosition();
var session = editor.session;
var token = session.getTokenAt(docPos.row, docPos.column);
editor._emit("linkHover", {position: docPos, token: token});
}
}
function onClick(e) {
var ctrl = e.getAccelKey();
var button = e.getButton();
if (button == 0 && ctrl) {
var editor = e.editor;
var docPos = e.getDocumentPosition();
var session = editor.session;
var token = session.getTokenAt(docPos.row, docPos.column);
editor._emit("linkClick", {position: docPos, token: token});
}
}
});

View file

@ -60,41 +60,47 @@ module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
var modelist = require('../modelist'); var modelist = require('../modelist');
var themelist = require('../themelist'); var themelist = require('../themelist');
editor.menuOptions = { editor.menuOptions = {
"setNewLineMode" : [{ setNewLineMode: [{
"textContent" : "unix", textContent: "unix",
"value" : "unix" value: "unix"
}, { }, {
"textContent" : "windows", textContent: "windows",
"value" : "windows" value: "windows"
}, { }, {
"textContent" : "auto", textContent: "auto",
"value" : "auto" value: "auto"
}], }],
"setTheme" : [], setTheme: [],
"setMode" : [], setMode: [],
"setKeyboardHandler": [{ setKeyboardHandler: [{
"textContent" : "ace", textContent: "ace",
"value" : "" value: ""
}, { }, {
"textContent" : "vim", textContent: "vim",
"value" : "ace/keyboard/vim" value: "ace/keyboard/vim"
}, { }, {
"textContent" : "emacs", textContent: "emacs",
"value" : "ace/keyboard/emacs" value: "ace/keyboard/emacs"
}, {
textContent: "textarea",
value: "ace/keyboard/textarea"
}, {
textContent: "sublime",
value: "ace/keyboard/sublime"
}] }]
}; };
editor.menuOptions.setTheme = themelist.themes.map(function(theme) { editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
return { return {
'textContent' : theme.caption, textContent: theme.caption,
'value' : theme.theme value: theme.theme
}; };
}); });
editor.menuOptions.setMode = modelist.modes.map(function(mode) { editor.menuOptions.setMode = modelist.modes.map(function(mode) {
return { return {
'textContent' : mode.name, textContent: mode.name,
'value' : mode.mode value: mode.mode
}; };
}); });
}; };

View file

@ -53,7 +53,7 @@ var supportedModes = {
C9Search: ["c9search_results"], C9Search: ["c9search_results"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
Cirru: ["cirru|cr"], Cirru: ["cirru|cr"],
Clojure: ["clj"], Clojure: ["clj|cljs"],
Cobol: ["CBL|COB"], Cobol: ["CBL|COB"],
coffee: ["coffee|cf|cson|^Cakefile"], coffee: ["coffee|cf|cson|^Cakefile"],
ColdFusion: ["cfm"], ColdFusion: ["cfm"],
@ -63,6 +63,7 @@ var supportedModes = {
D: ["d|di"], D: ["d|di"],
Dart: ["dart"], Dart: ["dart"],
Diff: ["diff|patch"], Diff: ["diff|patch"],
Dockerfile: ["^Dockerfile"],
Dot: ["dot"], Dot: ["dot"],
Erlang: ["erl|hrl"], Erlang: ["erl|hrl"],
EJS: ["ejs"], EJS: ["ejs"],
@ -142,6 +143,7 @@ var supportedModes = {
Toml: ["toml"], Toml: ["toml"],
Twig: ["twig"], Twig: ["twig"],
Typescript: ["ts|typescript|str"], Typescript: ["ts|typescript|str"],
Vala: ["vala"],
VBScript: ["vbs"], VBScript: ["vbs"],
Velocity: ["vm"], Velocity: ["vm"],
Verilog: ["v|vh|sv|svh"], Verilog: ["v|vh|sv|svh"],

View file

@ -103,6 +103,12 @@ patch(
}" }"
); );
patch(
require("../mode/text").Mode.prototype, "getTokenizer",
/Tokenizer/,
"TokenizerModule.Tokenizer"
);
useragent.isOldIE = true; useragent.isOldIE = true;
}); });

View file

@ -100,7 +100,7 @@ var highlight = function(el, opts, callback) {
*/ */
highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) { highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) {
var waiting = 0; var waiting = 1;
var modeCache = EditSession.prototype.$modes; var modeCache = EditSession.prototype.$modes;
// if either the theme or the mode were specified as objects // if either the theme or the mode were specified as objects
@ -127,7 +127,7 @@ highlight.render = function(input, mode, theme, lineStart, disableGutter, callba
var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter); var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter);
return callback ? callback(result) : result; return callback ? callback(result) : result;
} }
return waiting || done(); return --waiting || done();
}; };
/* /*

View file

@ -155,7 +155,7 @@ function setupContainer(element, getValue) {
return container; return container;
} }
exports.transformTextarea = function(element, loader) { exports.transformTextarea = function(element, options) {
var session; var session;
var container = setupContainer(element, function() { var container = setupContainer(element, function() {
return session.getValue(); return session.getValue();
@ -215,9 +215,8 @@ exports.transformTextarea = function(element, loader) {
applyStyles(settingDiv, settingDivStyles); applyStyles(settingDiv, settingDivStyles);
container.appendChild(settingDiv); container.appendChild(settingDiv);
options = options || exports.defaultOptions;
// Power up ace on the textarea: // Power up ace on the textarea:
var options = {};
var editor = ace.edit(editorDiv); var editor = ace.edit(editorDiv);
session = editor.getSession(); session = editor.getSession();
@ -228,10 +227,10 @@ exports.transformTextarea = function(element, loader) {
container.appendChild(settingOpener); container.appendChild(settingOpener);
// Create the API. // Create the API.
setupApi(editor, editorDiv, settingDiv, ace, options, loader); setupApi(editor, editorDiv, settingDiv, ace, options, load);
// Create the setting's panel. // Create the setting's panel.
setupSettingPanel(settingDiv, settingOpener, editor, options); setupSettingPanel(settingDiv, settingOpener, editor);
var state = ""; var state = "";
event.addListener(settingOpener, "mousemove", function(e) { event.addListener(settingOpener, "mousemove", function(e) {
@ -296,37 +295,15 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
}; };
editor.$setOption = editor.setOption; editor.$setOption = editor.setOption;
editor.$getOption = editor.getOption;
editor.setOption = function(key, value) { editor.setOption = function(key, value) {
if (options[key] == value) return;
switch (key) { switch (key) {
case "mode": case "mode":
if (value != "text") { editor.$setOption("mode", "ace/mode/" + value)
// Load the required mode file. Files get loaded only once.
loader("mode-" + value + ".js", "ace/mode/" + value, function() {
var aceMode = require("../mode/" + value).Mode;
session.setMode(new aceMode());
});
} else {
session.setMode(new (require("../mode/text").Mode));
}
break; break;
case "theme": case "theme":
if (value != "textmate") { editor.$setOption("theme", "ace/theme/" + value)
// Load the required theme file. Files get loaded only once.
loader("theme-" + value + ".js", "ace/theme/" + value, function() {
editor.setTheme("ace/theme/" + value);
});
} else {
editor.setTheme("ace/theme/textmate");
}
break; break;
case "fontSize":
editorDiv.style.fontSize = value;
break;
case "keybindings": case "keybindings":
switch (value) { switch (value) {
case "vim": case "vim":
@ -341,58 +318,55 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
break; break;
case "softWrap": case "softWrap":
switch (value) { case "fontSize":
case "off": editor.$setOption(key, value);
session.setUseWrapMode(false);
renderer.setPrintMarginColumn(80);
break;
case "40":
session.setUseWrapMode(true);
session.setWrapLimitRange(40, 40);
renderer.setPrintMarginColumn(40);
break;
case "80":
session.setUseWrapMode(true);
session.setWrapLimitRange(80, 80);
renderer.setPrintMarginColumn(80);
break;
case "free":
session.setUseWrapMode(true);
session.setWrapLimitRange(null, null);
renderer.setPrintMarginColumn(80);
break;
}
break; break;
default: default:
editor.$setOption(key, toBool(value)); editor.$setOption(key, toBool(value));
} }
options[key] = value;
}; };
editor.getOption = function(key) { editor.getOption = function(key) {
return options[key]; switch (key) {
case "mode":
return editor.$getOption("mode").substr("ace/mode/".length)
break;
case "theme":
return editor.$getOption("theme").substr("ace/theme/".length)
break;
case "keybindings":
var value = editor.getKeyboardHandler()
switch (value && value.$id) {
case "ace/keyboard/vim":
return "vim";
case "ace/keyboard/emacs":
return "emacs";
default:
return "ace";
}
break;
default:
return editor.$getOption(key);
}
}; };
editor.getOptions = function() { editor.setOptions(options);
return options;
};
editor.setOptions(exports.options);
return editor; return editor;
} }
function setupSettingPanel(settingDiv, settingOpener, editor, options) { function setupSettingPanel(settingDiv, settingOpener, editor) {
var BOOL = null; var BOOL = null;
var desc = { var desc = {
mode: "Mode:", mode: "Mode:",
gutter: "Display Gutter:", wrap: "Soft Wrap:",
theme: "Theme:", theme: "Theme:",
fontSize: "Font Size:", fontSize: "Font Size:",
softWrap: "Soft Wrap:", showGutter: "Display Gutter:",
keybindings: "Keyboard", keybindings: "Keyboard",
showPrintMargin: "Show Print Margin:", showPrintMargin: "Show Print Margin:",
useSoftTabs: "Use Soft Tabs:", useSoftTabs: "Use Soft Tabs:",
@ -445,7 +419,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
twilight: "Twilight", twilight: "Twilight",
vibrant_ink: "Vibrant Ink" vibrant_ink: "Vibrant Ink"
}, },
gutter: BOOL, showGutter: BOOL,
fontSize: { fontSize: {
"10px": "10px", "10px": "10px",
"11px": "11px", "11px": "11px",
@ -453,7 +427,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
"14px": "14px", "14px": "14px",
"16px": "16px" "16px": "16px"
}, },
softWrap: { wrap: {
off: "Off", off: "Off",
40: "40", 40: "40",
80: "80", 80: "80",
@ -476,7 +450,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
if (!obj) { if (!obj) {
builder.push( builder.push(
"<input type='checkbox' title='", option, "' ", "<input type='checkbox' title='", option, "' ",
cValue == "true" ? "checked='true'" : "", cValue + "" == "true" ? "checked='true'" : "",
"'></input>" "'></input>"
); );
return; return;
@ -496,10 +470,10 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
builder.push("</select>"); builder.push("</select>");
} }
for (var option in options) { for (var option in exports.defaultOptions) {
table.push("<tr><td>", desc[option], "</td>"); table.push("<tr><td>", desc[option], "</td>");
table.push("<td>"); table.push("<td>");
renderOption(table, option, optionValues[option], options[option]); renderOption(table, option, optionValues[option], editor.getOption(option));
table.push("</td></tr>"); table.push("</td></tr>");
} }
table.push("</table>"); table.push("</table>");
@ -532,12 +506,12 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
} }
// Default startup options. // Default startup options.
exports.options = { exports.defaultOptions = {
mode: "text", mode: "javascript",
theme: "textmate", theme: "textmate",
gutter: "false", wrap: "off",
fontSize: "12px", fontSize: "12px",
softWrap: "off", showGutter: "false",
keybindings: "ace", keybindings: "ace",
showPrintMargin: "false", showPrintMargin: "false",
useSoftTabs: "true", useSoftTabs: "true",

View file

@ -41,6 +41,7 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
require("ace/lib/fixoldbrowsers");
var themeData = [ var themeData = [
["Chrome" ], ["Chrome" ],

View file

@ -46,7 +46,6 @@ exports.$detectIndentation = function(lines, fallback) {
if (!/^\s*[^*+\-\s]/.test(line)) if (!/^\s*[^*+\-\s]/.test(line))
continue; continue;
var tabs = line.match(/^\t*/)[0].length;
if (line[0] == "\t") if (line[0] == "\t")
tabIndents++; tabIndents++;
@ -65,9 +64,6 @@ exports.$detectIndentation = function(lines, fallback) {
line = lines[i++]; line = lines[i++];
} }
if (!stats.length)
return;
function getScore(indent) { function getScore(indent) {
var score = 0; var score = 0;
for (var i = indent; i < stats.length; i += indent) for (var i = indent; i < stats.length; i += indent)
@ -82,13 +78,12 @@ exports.$detectIndentation = function(lines, fallback) {
for (var i = 1; i < 12; i++) { for (var i = 1; i < 12; i++) {
if (i == 1) { if (i == 1) {
spaceIndents = getScore(i); spaceIndents = getScore(i);
var score = 1; var score = stats.length && 1;
} else } else
var score = getScore(i) / spaceIndents; var score = getScore(i) / spaceIndents;
if (changes[i]) { if (changes[i])
score += changes[i] / changesTotal; score += changes[i] / changesTotal;
}
if (score > first.score) if (score > first.score)
first = {score: score, length: i}; first = {score: score, length: i};
@ -100,7 +95,7 @@ exports.$detectIndentation = function(lines, fallback) {
if (tabIndents > spaceIndents + 1) if (tabIndents > spaceIndents + 1)
return {ch: "\t", length: tabLength}; return {ch: "\t", length: tabLength};
if (spaceIndents + 1 > tabIndents) if (spaceIndents > tabIndents + 1)
return {ch: " ", length: tabLength}; return {ch: " ", length: tabLength};
}; };

View file

@ -0,0 +1,116 @@
if (typeof process !== "undefined") {
require("amd-loader");
require("../test/mockdom");
}
define(function(require, exports, module) {
"use strict";
var assert = require("assert");
var EditSession = require("../edit_session").EditSession;
var whitespace = require("./whitespace");
// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
module.exports = {
timeout: 10000,
"test tab detection": function(next) {
var s = new EditSession([
"define({",
"\tfoo:1,",
"\tbar:2,",
"\tbaz:{,",
"\t\tx:3",
"\t}",
"})"
]);
var indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, "\t");
assert.equal(indent.length, undefined);
s.insert({row: 0, column: 0}, " ");
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, "\t");
assert.equal(indent.length, 4);
s.setValue("");
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.ok(!indent);
next();
},
"test empty session": function(next) {
var s = new EditSession([
"define({",
"foo:1,",
"})"
]);
var indent = whitespace.$detectIndentation(s.doc.$lines);
assert.ok(!indent);
s.insert({row: 1, column: 0}, " x\n ");
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, " ");
assert.equal(indent.length, 4);
next();
},
"!test one line": function(next) {
var s = new EditSession([
"define({",
" foo:1,",
"})"
]);
var indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, " ");
assert.equal(indent.length, 4);
next();
},
"test 1 width indents": function(next) {
var s = new EditSession([
"define({",
" foo:1,",
"})",
"define({",
" bar:1,",
"})",
" t",
" t",
" t",
" t",
" t",
" t",
" t",
" t"
]);
var indent = whitespace.$detectIndentation(s.doc.$lines);
// assert.equal(indent.ch, " ");
// assert.equal(indent.length, 4);
s = new EditSession([
"{",
" foo:1,",
" bar: {",
" baz:2",
" }",
"}"
]);
indent = whitespace.$detectIndentation(s.doc.$lines);
assert.equal(indent.ch, " ");
assert.equal(indent.length, 1);
next();
},
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec();
}

View file

@ -36,7 +36,7 @@ var event = require("../lib/event");
var KeyBinding = function(editor) { var KeyBinding = function(editor) {
this.$editor = editor; this.$editor = editor;
this.$data = {}; this.$data = {editor: editor};
this.$handlers = []; this.$handlers = [];
this.setDefaultHandler(editor.commands); this.setDefaultHandler(editor.commands);
}; };
@ -46,7 +46,6 @@ var KeyBinding = function(editor) {
this.removeKeyboardHandler(this.$defaultHandler); this.removeKeyboardHandler(this.$defaultHandler);
this.$defaultHandler = kb; this.$defaultHandler = kb;
this.addKeyboardHandler(kb, 0); this.addKeyboardHandler(kb, 0);
this.$data = {editor: this.$editor};
}; };
this.setKeyboardHandler = function(kb) { this.setKeyboardHandler = function(kb) {

View file

@ -0,0 +1,82 @@
/* ***** 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 HashHandler = require("./hash_handler").HashHandler;
exports.handler = new HashHandler();
[{
bindKey: "Shift-Tab|Tab",
command: "passKeysToBrowser"
}, {
bindKey: {win: "Ctrl-L", mac: "Cmd-L"},
command: "passKeysToBrowser"
}, {
bindKey: {win: "Ctrl-G", mac: "Cmd-G"},
command: "gotoline"
}, {
bindKey: {win: "Ctrl-T|Ctrl-Shift-T", mac: "Cmd-T|Cmd-Shift-T"},
command: "passKeysToBrowser"
}, {
bindKey: {win: "Ctrl-G", mac: "Cmd-G"},
command: "passKeysToBrowser"
}, {
bindKey: {win: "Ctrl-G", mac: "Cmd-G"},
command: "passKeysToBrowser"
}, {
name: "golineup",
bindKey: {win: null, mac: "Ctrl-P"},
}, {
name: "golinedown",
bindKey: {win: null, mac: "Ctrl-N"},
}, {
name: "gotoleft",
bindKey: {win: null, mac: "Ctrl-B"},
}, {
name: "gotoright",
bindKey: {win: null, mac: "Ctrl-F"},
}, {
name: "gotolineend",
bindKey: {win: null, mac: "Ctrl-E"},
}, {
name: "gotolinestart",
bindKey: {win: null, mac: "Ctrl-A"},
}
].forEach(function(k) {
var bindKey = k.bindKey;
if (typeof bindKey == "object")
bindKey = bindKey[exports.handler.platform];
exports.handler.bindKey(bindKey, k.command);
});
exports.handler.$id = "ace/keyboard/textarea";
});

View file

@ -36,6 +36,7 @@ var useragent = require("../lib/useragent");
var dom = require("../lib/dom"); var dom = require("../lib/dom");
var lang = require("../lib/lang"); var lang = require("../lib/lang");
var BROKEN_SETDATA = useragent.isChrome < 18; var BROKEN_SETDATA = useragent.isChrome < 18;
var USE_IE_MIME_TYPE = useragent.isIE;
var TextInput = function(parentNode, host) { var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea"); var text = dom.createElement("textarea");
@ -54,7 +55,6 @@ var TextInput = function(parentNode, host) {
var PLACEHOLDER = "\x01\x01"; var PLACEHOLDER = "\x01\x01";
var cut = false;
var copied = false; var copied = false;
var pasted = false; var pasted = false;
var inComposition = false; var inComposition = false;
@ -186,9 +186,7 @@ var TextInput = function(parentNode, host) {
} }
var onSelect = function(e) { var onSelect = function(e) {
if (cut) { if (copied) {
cut = false;
} else if (copied) {
copied = false; copied = false;
} else if (isAllSelected(text)) { } else if (isAllSelected(text)) {
host.selectAll(); host.selectAll();
@ -244,54 +242,30 @@ var TextInput = function(parentNode, host) {
resetValue(); resetValue();
}; };
var onCut = function(e) { var handleClipboardData = function(e, data) {
var data = host.getCopyText();
if (!data) {
event.preventDefault(e);
return;
}
var clipboardData = e.clipboardData || window.clipboardData; var clipboardData = e.clipboardData || window.clipboardData;
if (!clipboardData || BROKEN_SETDATA)
if (clipboardData && !BROKEN_SETDATA) {
// Safari 5 has clipboardData object, but does not handle setData()
var supported = clipboardData.setData("Text", data);
if (supported) {
host.onCut();
event.preventDefault(e);
}
}
if (!supported) {
cut = true;
text.value = data;
text.select();
setTimeout(function(){
cut = false;
resetValue();
resetSelection();
host.onCut();
});
}
};
var onCopy = function(e) {
var data = host.getCopyText();
if (!data) {
event.preventDefault(e);
return; return;
} // using "Text" doesn't work on old webkit but ie needs it
// TODO are there other browsers that require "Text"?
var clipboardData = e.clipboardData || window.clipboardData; var mime = USE_IE_MIME_TYPE ? "Text" : "text/plain";
if (clipboardData && !BROKEN_SETDATA) { if (data) {
// Safari 5 has clipboardData object, but does not handle setData() // Safari 5 has clipboardData object, but does not handle setData()
var supported = clipboardData.setData("Text", data); return clipboardData.setData(mime, data) !== false;
if (supported) { } else {
host.onCopy(); return clipboardData.getData(mime);
event.preventDefault(e);
}
} }
if (!supported) { }
var doCopy = function(e, isCut) {
var data = host.getCopyText();
if (!data)
return event.preventDefault(e);
if (handleClipboardData(e, data)) {
isCut ? host.onCut() : host.onCopy();
event.preventDefault(e);
} else {
copied = true; copied = true;
text.value = data; text.value = data;
text.select(); text.select();
@ -299,16 +273,22 @@ var TextInput = function(parentNode, host) {
copied = false; copied = false;
resetValue(); resetValue();
resetSelection(); resetSelection();
host.onCopy(); isCut ? host.onCut() : host.onCopy();
}); });
} }
}; };
var onPaste = function(e) { var onCut = function(e) {
var clipboardData = e.clipboardData || window.clipboardData; doCopy(e, true);
}
if (clipboardData) { var onCopy = function(e) {
var data = clipboardData.getData("Text"); doCopy(e, false);
}
var onPaste = function(e) {
var data = handleClipboardData(e);
if (typeof data == "string") {
if (data) if (data)
host.onPaste(data); host.onPaste(data);
if (useragent.isIE) if (useragent.isIE)
@ -336,7 +316,7 @@ var TextInput = function(parentNode, host) {
if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){ if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
event.addListener(parentNode, "keydown", function(e) { event.addListener(parentNode, "keydown", function(e) {
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
return; return;
switch (e.keyCode) { switch (e.keyCode) {
case 67: case 67:

View file

@ -120,13 +120,14 @@ exports.handler = {
return null; return null;
var editor = data.editor; var editor = data.editor;
var vimState = data.vimState || "start";
if (hashId == 1) if (hashId == 1)
key = "ctrl-" + key; key = "ctrl-" + key;
if (key == "ctrl-c") { if (key == "ctrl-c") {
if (!useragent.isMac && editor.getCopyText()) { if (!useragent.isMac && editor.getCopyText()) {
editor.once("copy", function() { editor.once("copy", function() {
if (data.state == "start") if (vimState == "start")
coreCommands.stop.exec(editor); coreCommands.stop.exec(editor);
else else
editor.selection.clearSelection(); editor.selection.clearSelection();
@ -136,7 +137,7 @@ exports.handler = {
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} else if ((key == "esc" && hashId === 0) || key == "ctrl-[") { } else if ((key == "esc" && hashId === 0) || key == "ctrl-[") {
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} else if (data.state == "start") { } else if (vimState == "start") {
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) { if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
hashId = -1; hashId = -1;
key = data.inputChar; key = data.inputChar;
@ -146,13 +147,16 @@ exports.handler = {
if (cmds.inputBuffer.idle && startCommands[key]) if (cmds.inputBuffer.idle && startCommands[key])
return startCommands[key]; return startCommands[key];
var isHandled = cmds.inputBuffer.push(editor, key); var isHandled = cmds.inputBuffer.push(editor, key);
if (!isHandled && hashId !== -1)
return;
return {command: "null", passEvent: !isHandled}; return {command: "null", passEvent: !isHandled};
} // if no modifier || shift: wait for input.
else if (key.length == 1 && (hashId === 0 || hashId == 4)) {
return {command: "null", passEvent: true};
} else if (key == "esc" && hashId === 0) { } else if (key == "esc" && hashId === 0) {
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} }
// if no modifier || shift: wait for input.
else if (hashId === 0 || hashId == 4) {
return {command: "null", passEvent: true};
}
} else { } else {
if (key == "ctrl-w") { if (key == "ctrl-w") {
return {command: "removewordleft"}; return {command: "removewordleft"};

View file

@ -123,10 +123,12 @@ var actions = exports.actions = {
range.end.column++; range.end.column++;
var text = editor.session.getTextRange(range); var text = editor.session.getTextRange(range);
var toggled = text.toUpperCase(); var toggled = text.toUpperCase();
if (toggled == text) if (toggled != text)
editor.navigateRight();
else
editor.session.replace(range, toggled); editor.session.replace(range, toggled);
else if (text.toLowerCase() != text)
editor.session.replace(range, text.toLowerCase())
else
editor.navigateRight();
}, count || 1); }, count || 1);
} }
}, },
@ -164,6 +166,7 @@ var actions = exports.actions = {
fn: function(editor, range, count, param) { fn: function(editor, range, count, param) {
var options = editor.getLastSearchOptions(); var options = editor.getLastSearchOptions();
options.backwards = false; options.backwards = false;
options.start = null;
editor.selection.moveCursorRight(); editor.selection.moveCursorRight();
editor.selection.clearSelection(); editor.selection.clearSelection();
@ -180,6 +183,7 @@ var actions = exports.actions = {
fn: function(editor, range, count, param) { fn: function(editor, range, count, param) {
var options = editor.getLastSearchOptions(); var options = editor.getLastSearchOptions();
options.backwards = true; options.backwards = true;
options.start = null;
editor.findPrevious(options); editor.findPrevious(options);
ensureScrollMargin(editor); ensureScrollMargin(editor);
@ -340,6 +344,7 @@ var inputBuffer = exports.inputBuffer = {
currentCmd: null, currentCmd: null,
//currentMode: 0, //currentMode: 0,
currentCount: "", currentCount: "",
pendingCount: "",
status: "", status: "",
// Types // Types
@ -440,8 +445,9 @@ var inputBuffer = exports.inputBuffer = {
}, },
getCount: function() { getCount: function() {
var count = this.currentCount; var count = this.currentCount || this.pendingCount;
this.currentCount = ""; this.currentCount = "";
this.pendingCount = count;
return count && parseInt(count, 10); return count && parseInt(count, 10);
}, },
@ -497,7 +503,8 @@ var inputBuffer = exports.inputBuffer = {
else if (selectable) { else if (selectable) {
repeat(function() { repeat(function() {
run(motionObj.sel); run(motionObj.sel);
operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param); operators[o.ch].fn(editor, editor.getSelectionRange(),
o.count, motionObj.param ? motionObj : param);
}, o.count || 1); }, o.count || 1);
} }
this.reset(); this.reset();
@ -517,6 +524,7 @@ var inputBuffer = exports.inputBuffer = {
this.operator = null; this.operator = null;
this.motion = null; this.motion = null;
this.currentCount = ""; this.currentCount = "";
this.pendingCount = "";
this.status = ""; this.status = "";
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
this.idle = true; this.idle = true;

View file

@ -350,6 +350,10 @@ module.exports = {
case "W": case "W":
editor.selection.selectAWord(); editor.selection.selectAWord();
break; break;
case ")":
case "}":
case "]":
param = editor.session.$brackets[param];
case "(": case "(":
case "{": case "{":
case "[": case "[":
@ -383,6 +387,7 @@ module.exports = {
param: true, param: true,
handlesCount: true, handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) { getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat) if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "f", param: param}; LAST_SEARCH_MOTION = {ch: "f", param: param};
var cursor = editor.getCursorPosition(); var cursor = editor.getCursorPosition();
@ -398,6 +403,7 @@ module.exports = {
param: true, param: true,
handlesCount: true, handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) { getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat) if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "F", param: param}; LAST_SEARCH_MOTION = {ch: "F", param: param};
var cursor = editor.getCursorPosition(); var cursor = editor.getCursorPosition();
@ -413,6 +419,7 @@ module.exports = {
param: true, param: true,
handlesCount: true, handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) { getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat) if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "t", param: param}; LAST_SEARCH_MOTION = {ch: "t", param: param};
var cursor = editor.getCursorPosition(); var cursor = editor.getCursorPosition();
@ -431,6 +438,7 @@ module.exports = {
param: true, param: true,
handlesCount: true, handlesCount: true,
getPos: function(editor, range, count, param, isSel, isRepeat) { getPos: function(editor, range, count, param, isSel, isRepeat) {
if (param == "space") param = " ";
if (!isRepeat) if (!isRepeat)
LAST_SEARCH_MOTION = {ch: "T", param: param}; LAST_SEARCH_MOTION = {ch: "T", param: param};
var cursor = editor.getCursorPosition(); var cursor = editor.getCursorPosition();
@ -656,7 +664,8 @@ module.exports = {
pos.column = line.length; pos.column = line.length;
return pos; return pos;
} }
} },
isLine: true
}) })
}; };

View file

@ -34,6 +34,7 @@ define(function(require, exports, module) {
var util = require("./util"); var util = require("./util");
var registers = require("../registers"); var registers = require("../registers");
var Range = require("../../../range").Range;
module.exports = { module.exports = {
"d": { "d": {
@ -90,10 +91,15 @@ module.exports = {
count = count || 1; count = count || 1;
switch (param) { switch (param) {
case "c": case "c":
for (var i = 0; i < count; i++) { editor.$blockScrolling++;
editor.removeLines(); editor.selection.$moveSelection(function() {
util.insertMode(editor); editor.selection.moveCursorBy(count - 1, 0);
} });
var rows = editor.$getSelectedRows();
range = new Range(rows.first, 0, rows.last, Infinity);
editor.session.remove(range);
editor.$blockScrolling--;
util.insertMode(editor);
break; break;
default: default:
if (range) { if (range) {
@ -113,6 +119,8 @@ module.exports = {
}, },
fn: function(editor, range, count, param) { fn: function(editor, range, count, param) {
count = count || 1; count = count || 1;
if (param && param.isLine)
param = "y";
switch (param) { switch (param) {
case "y": case "y":
var pos = editor.getCursorPosition(); var pos = editor.getCursorPosition();

View file

@ -33,7 +33,7 @@ module.exports = {
editor.setOverwrite(false); editor.setOverwrite(false);
editor.keyBinding.$data.buffer = ""; editor.keyBinding.$data.buffer = "";
editor.keyBinding.$data.state = "insertMode"; editor.keyBinding.$data.vimState = "insertMode";
this.onVisualMode = false; this.onVisualMode = false;
this.onVisualLineMode = false; this.onVisualLineMode = false;
if(this.onInsertReplaySequence) { if(this.onInsertReplaySequence) {
@ -66,7 +66,7 @@ module.exports = {
editor.setOverwrite(true); editor.setOverwrite(true);
editor.keyBinding.$data.buffer = ""; editor.keyBinding.$data.buffer = "";
editor.keyBinding.$data.state = "start"; editor.keyBinding.$data.vimState = "start";
this.onVisualMode = false; this.onVisualMode = false;
this.onVisualLineMode = false; this.onVisualLineMode = false;
editor._emit("changeStatus"); editor._emit("changeStatus");

View file

@ -33,6 +33,7 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var dom = require("../lib/dom"); var dom = require("../lib/dom");
var lang = require("../lib/lang"); var lang = require("../lib/lang");
var useragent = require("../lib/useragent");
var EventEmitter = require("../lib/event_emitter").EventEmitter; var EventEmitter = require("../lib/event_emitter").EventEmitter;
var CHAR_COUNT = 0; var CHAR_COUNT = 0;
@ -54,7 +55,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
if (!CHAR_COUNT) if (!CHAR_COUNT)
this.$testFractionalRect(); this.$testFractionalRect();
this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT); this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT);
this.$characterSize = {width: 0, height: 0}; this.$characterSize = {width: 0, height: 0};
this.checkForSizeChanges(); this.checkForSizeChanges();
@ -85,7 +86,12 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
style.visibility = "hidden"; style.visibility = "hidden";
style.position = "fixed"; style.position = "fixed";
style.whiteSpace = "pre"; style.whiteSpace = "pre";
style.font = "inherit";
if (useragent.isIE < 8) {
style["font-family"] = "inherit";
} else {
style.font = "inherit";
}
style.overflow = isRoot ? "hidden" : "visible"; style.overflow = isRoot ? "hidden" : "visible";
}; };
@ -121,11 +127,18 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
}; };
this.$measureSizes = function() { this.$measureSizes = function() {
var rect = this.$measureNode.getBoundingClientRect(); if (CHAR_COUNT === 1) {
var size = { var rect = this.$measureNode.getBoundingClientRect();
height: rect.height, var size = {
width: rect.width / CHAR_COUNT height: rect.height,
}; width: rect.width
};
} else {
var size = {
height: this.$measureNode.clientHeight,
width: this.$measureNode.clientWidth / CHAR_COUNT
};
}
// Size and width can be null if the editor is not visible or // Size and width can be null if the editor is not visible or
// detached from the document // detached from the document
if (size.width === 0 || size.height === 0) if (size.width === 0 || size.height === 0)
@ -134,7 +147,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) {
}; };
this.$measureCharWidth = function(ch) { this.$measureCharWidth = function(ch) {
this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT); this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT);
var rect = this.$main.getBoundingClientRect(); var rect = this.$main.getBoundingClientRect();
return rect.width / CHAR_COUNT; return rect.width / CHAR_COUNT;
}; };

View file

@ -85,7 +85,7 @@ exports.preventDefault = function(e) {
exports.getButton = function(e) { exports.getButton = function(e) {
if (e.type == "dblclick") if (e.type == "dblclick")
return 0; return 0;
if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac)) if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey)))
return 2; return 2;
// DOM Event // DOM Event
@ -180,9 +180,12 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
} }
if (useragent.isIE) { if (useragent.isIE) {
var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5; var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
if (isNewClick) { if (!timer || isNewClick)
clicks = 1; clicks = 1;
} if (timer)
clearTimeout(timer);
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
if (clicks == 1) { if (clicks == 1) {
startX = e.clientX; startX = e.clientX;
startY = e.clientY; startY = e.clientY;
@ -277,6 +280,14 @@ function normalizeCommandKeys(callback, e, keyCode) {
} }
} }
if (useragent.isChromeOS && hashId & 8) {
callback(e, hashId, keyCode);
if (e.defaultPrevented)
return;
else
hashId &= ~8;
}
// If there is no hashId and the keyCode is not a function key, then // If there is no hashId and the keyCode is not a function key, then
// we don't call the callback as we don't handle a command key here // we don't call the callback as we don't handle a command key here
// (it's a normal key/character input). // (it's a normal key/character input).

View file

@ -103,7 +103,7 @@ var Keys = (function() {
80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.', 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[', 187: '=', 188: ',', 189: '-', 190: '.', 191: '/', 192: '`', 219: '[',
220: '\\',221: ']', 222: '\'', 220: '\\',221: ']', 222: '\''
} }
}; };
@ -148,7 +148,11 @@ var Keys = (function() {
oop.mixin(exports, Keys); oop.mixin(exports, Keys);
exports.keyCodeToString = function(keyCode) { exports.keyCodeToString = function(keyCode) {
return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase(); // Language-switching keystroke in Chrome/Linux emits keyCode 0.
var keyString = Keys[keyCode];
if (typeof keyString != "string")
keyString = String.fromCharCode(keyCode);
return keyString.toLowerCase();
}; };
}); });

View file

@ -76,15 +76,16 @@ exports.isLinux = (os == "linux");
// Windows Store JavaScript apps (aka Metro apps written in HTML5 and JavaScript) do not use the "Microsoft Internet Explorer" string in their user agent, but "MSAppHost" instead. // Windows Store JavaScript apps (aka Metro apps written in HTML5 and JavaScript) do not use the "Microsoft Internet Explorer" string in their user agent, but "MSAppHost" instead.
exports.isIE = exports.isIE =
(navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0) (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
&& parseFloat(navigator.userAgent.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:|MSIE )([0-9]+[\.0-9]+)/)[1]); ? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1])
: parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]); // for ie
exports.isOldIE = exports.isIE && exports.isIE < 9; exports.isOldIE = exports.isIE && exports.isIE < 9;
// Is this Firefox or related? // Is this Firefox or related?
exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko"; exports.isGecko = exports.isMozilla = (window.Controllers || window.controllers) && window.navigator.product === "Gecko";
// oldGecko == rev < 2.0 // oldGecko == rev < 2.0
exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4; exports.isOldGecko = exports.isGecko && parseInt((ua.match(/rv\:(\d+)/)||[])[1], 10) < 4;
// Is this Opera // Is this Opera
exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
@ -100,4 +101,6 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
exports.isTouchPad = ua.indexOf("TouchPad") >= 0; exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
exports.isChromeOS = ua.indexOf(" CrOS ") >= 0;
}); });

View file

@ -87,7 +87,6 @@ function LineWidgets(session) {
editor.widgetManager = this; editor.widgetManager = this;
editor.setOption("enableLineWidgets", true);
editor.renderer.on("beforeRender", this.measureWidgets); editor.renderer.on("beforeRender", this.measureWidgets);
editor.renderer.on("afterRender", this.renderWidgets); editor.renderer.on("afterRender", this.renderWidgets);
}; };

View file

@ -1,5 +1,7 @@
<html> <html>
<script a='a'>var</script>'123' <scripts>
<script a='a'>var "</scripts></script>'123'
</scripts>
<a href="abc <a href="abc
def"> def">
<a href='abc <a href='abc

View file

@ -330,7 +330,7 @@
["text",";"] ["text",";"]
],[ ],[
"start", "start",
["identifier","assert"], ["keyword.control.dart","assert"],
["text","("], ["text","("],
["identifier","unicorn"], ["identifier","unicorn"],
["text"," "], ["text"," "],
@ -357,7 +357,7 @@
["text",";"] ["text",";"]
],[ ],[
"start", "start",
["identifier","assert"], ["keyword.control.dart","assert"],
["text","("], ["text","("],
["identifier","iMeantToDoThis"], ["identifier","iMeantToDoThis"],
["text","."], ["text","."],

View file

@ -4,393 +4,257 @@
["variable"," --git"], ["variable"," --git"],
["keyword"," a/lib/ace/edit_session.js"], ["keyword"," a/lib/ace/edit_session.js"],
["variable"," b/lib/ace/edit_session.js"] ["variable"," b/lib/ace/edit_session.js"]
],[
"start"
],[ ],[
"start", "start",
["variable","index 23fc3fc..ed3b273 100644"] ["variable","index 23fc3fc..ed3b273 100644"]
],[
"start"
],[ ],[
"start", "start",
["constant.numeric","---"], ["constant.numeric","---"],
["meta.tag"," a/lib/ace/edit_session.js"] ["meta.tag"," a/lib/ace/edit_session.js"]
],[
"start"
],[ ],[
"start", "start",
["constant.numeric","+++"], ["constant.numeric","+++"],
["meta.tag"," b/lib/ace/edit_session.js"] ["meta.tag"," b/lib/ace/edit_session.js"]
],[
"start"
],[ ],[
"start", "start",
["constant","@@"], ["constant","@@"],
["constant.numeric"," -51,6 +51,7 "], ["constant.numeric"," -51,6 +51,7 "],
["constant","@@"], ["constant","@@"],
["comment.doc.tag"," var TextMode = require(\"./mode/text\").Mode;"] ["comment.doc.tag"," var TextMode = require(\"./mode/text\").Mode;"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," var Range = require(\"./range\").Range;"] ["invisible"," var Range = require(\"./range\").Range;"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," var Document = require(\"./document\").Document;"] ["invisible"," var Document = require(\"./document\").Document;"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;"] ["invisible"," var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text","var SearchHighlight = require(\"./search_highlight\").SearchHighlight;"] ["text","var SearchHighlight = require(\"./search_highlight\").SearchHighlight;"]
],[
"start"
],[ ],[
"start", "start",
["text"," "] ["text"," "]
],[
"start"
],[ ],[
"start", "start",
["invisible"," /**"] ["invisible"," /**"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," * class EditSession"] ["invisible"," * class EditSession"]
],[
"start"
],[ ],[
"start", "start",
["constant","@@"], ["constant","@@"],
["constant.numeric"," -307,6 +308,13 "], ["constant.numeric"," -307,6 +308,13 "],
["constant","@@"], ["constant","@@"],
["comment.doc.tag"," var EditSession = function(text, mode) {"] ["comment.doc.tag"," var EditSession = function(text, mode) {"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," return token;"] ["invisible"," return token;"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," };"] ["invisible"," };"]
],[
"start"
],[ ],[
"start", "start",
["text"," "] ["text"," "]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," this.highlight = function(re) {"] ["text"," this.highlight = function(re) {"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," if (!this.$searchHighlight) {"] ["text"," if (!this.$searchHighlight) {"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");"] ["text"," var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," this.$searchHighlight = this.addDynamicMarker(highlight);"] ["text"," this.$searchHighlight = this.addDynamicMarker(highlight);"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," }"] ["text"," }"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," this.$searchHighlight.setRegexp(re);"] ["text"," this.$searchHighlight.setRegexp(re);"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," }"] ["text"," }"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," /**"] ["invisible"," /**"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," * EditSession.setUndoManager(undoManager)"] ["invisible"," * EditSession.setUndoManager(undoManager)"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," * - undoManager (UndoManager): The new undo manager"] ["invisible"," * - undoManager (UndoManager): The new undo manager"]
],[
"start"
],[ ],[
"start", "start",
["constant","@@"], ["constant","@@"],
["constant.numeric"," -556,7 +564,8 "], ["constant.numeric"," -556,7 +564,8 "],
["constant","@@"], ["constant","@@"],
["comment.doc.tag"," var EditSession = function(text, mode) {"] ["comment.doc.tag"," var EditSession = function(text, mode) {"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," type : type || \"line\","] ["invisible"," type : type || \"line\","]
],[
"start"
],[ ],[
"start", "start",
["invisible"," renderer: typeof type == \"function\" ? type : null,"] ["invisible"," renderer: typeof type == \"function\" ? type : null,"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," clazz : clazz,"] ["invisible"," clazz : clazz,"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," inFront: !!inFront"] ["string"," inFront: !!inFront"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," inFront: !!inFront,"] ["text"," inFront: !!inFront,"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," id: id"] ["text"," id: id"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," }"] ["invisible"," }"]
],[
"start"
],[ ],[
"start", "start",
["text"," "] ["text"," "]
],[
"start"
],[ ],[
"start", "start",
["invisible"," if (inFront) {"] ["invisible"," if (inFront) {"]
],[
"start"
],[ ],[
"start", "start",
["variable","diff"], ["variable","diff"],
["variable"," --git"], ["variable"," --git"],
["keyword"," a/lib/ace/editor.js"], ["keyword"," a/lib/ace/editor.js"],
["variable"," b/lib/ace/editor.js"] ["variable"," b/lib/ace/editor.js"]
],[
"start"
],[ ],[
"start", "start",
["variable","index 834e603..b27ec73 100644"] ["variable","index 834e603..b27ec73 100644"]
],[
"start"
],[ ],[
"start", "start",
["constant.numeric","---"], ["constant.numeric","---"],
["meta.tag"," a/lib/ace/editor.js"] ["meta.tag"," a/lib/ace/editor.js"]
],[
"start"
],[ ],[
"start", "start",
["constant.numeric","+++"], ["constant.numeric","+++"],
["meta.tag"," b/lib/ace/editor.js"] ["meta.tag"," b/lib/ace/editor.js"]
],[
"start"
],[ ],[
"start", "start",
["constant","@@"], ["constant","@@"],
["constant.numeric"," -494,7 +494,7 "], ["constant.numeric"," -494,7 +494,7 "],
["constant","@@"], ["constant","@@"],
["comment.doc.tag"," var Editor = function(renderer, session) {"] ["comment.doc.tag"," var Editor = function(renderer, session) {"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," * Emitted when a selection has changed."] ["invisible"," * Emitted when a selection has changed."]
],[
"start"
],[ ],[
"start", "start",
["invisible"," **/"] ["invisible"," **/"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," this.onSelectionChange = function(e) {"] ["invisible"," this.onSelectionChange = function(e) {"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," var session = this.getSession();"] ["string"," var session = this.getSession();"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," var session = this.session;"] ["text"," var session = this.session;"]
],[
"start"
],[ ],[
"start", "start",
["text"," "] ["text"," "]
],[
"start"
],[ ],[
"start", "start",
["invisible"," if (session.$selectionMarker) {"] ["invisible"," if (session.$selectionMarker) {"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," session.removeMarker(session.$selectionMarker);"] ["invisible"," session.removeMarker(session.$selectionMarker);"]
],[
"start"
],[ ],[
"start", "start",
["constant","@@"], ["constant","@@"],
["constant.numeric"," -509,12 +509,40 "], ["constant.numeric"," -509,12 +509,40 "],
["constant","@@"], ["constant","@@"],
["comment.doc.tag"," var Editor = function(renderer, session) {"] ["comment.doc.tag"," var Editor = function(renderer, session) {"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," this.$updateHighlightActiveLine();"] ["invisible"," this.$updateHighlightActiveLine();"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," }"] ["invisible"," }"]
],[
"start"
],[ ],[
"start", "start",
["text"," "] ["text"," "]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," var self = this;"] ["string"," var self = this;"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," if (this.$highlightSelectedWord && !this.$wordHighlightTimer)"] ["string"," if (this.$highlightSelectedWord && !this.$wordHighlightTimer)"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," this.$wordHighlightTimer = setTimeout(function() {"] ["string"," this.$wordHighlightTimer = setTimeout(function() {"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," self.session.$mode.highlightSelection(self);"] ["string"," self.session.$mode.highlightSelection(self);"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," self.$wordHighlightTimer = null;"] ["string"," self.$wordHighlightTimer = null;"]
],[
"start"
],[ ],[
"start", "start",
["support.function","-"], ["support.function","-"],
["string"," }, 30, this);"] ["string"," }, 30, this);"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text"," var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()"] ["text"," var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()"]
],[
"start"
],[ ],[
"start", "start",
["invisible"," };"] ["invisible"," };"]
],[
"start"
],[ ],[
"start", "start",
["variable","diff"], ["variable","diff"],
["variable"," --git"], ["variable"," --git"],
["keyword"," a/lib/ace/search_highlight.js"], ["keyword"," a/lib/ace/search_highlight.js"],
["variable"," b/lib/ace/search_highlight.js"] ["variable"," b/lib/ace/search_highlight.js"]
],[
"start"
],[ ],[
"start", "start",
["invisible","new file mode 100644"] ["invisible","new file mode 100644"]
],[
"start"
],[ ],[
"start", "start",
["variable","index 0000000..b2df779"] ["variable","index 0000000..b2df779"]
],[
"start"
],[ ],[
"start", "start",
["constant.numeric","---"], ["constant.numeric","---"],
["meta.tag"," /dev/null"] ["meta.tag"," /dev/null"]
],[
"start"
],[ ],[
"start", "start",
["constant.numeric","+++"], ["constant.numeric","+++"],
["meta.tag"," b/lib/ace/search_highlight.js"] ["meta.tag"," b/lib/ace/search_highlight.js"]
],[
"start"
],[ ],[
"start", "start",
["constant","@@"], ["constant","@@"],
["constant.numeric"," -0,0 +1,3 "], ["constant.numeric"," -0,0 +1,3 "],
["constant","@@"] ["constant","@@"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],
["text","new"] ["text","new"]
],[
"start"
],[ ],[
"start", "start",
["support.constant","+"], ["support.constant","+"],

View file

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

View file

@ -3,6 +3,11 @@
["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.tag-name.xml","html"], ["meta.tag.tag-name.xml","html"],
["meta.tag.punctuation.tag-close.xml",">"] ["meta.tag.punctuation.tag-close.xml",">"]
],[
"start",
["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.tag-name.xml","scripts"],
["meta.tag.punctuation.tag-close.xml",">"]
],[ ],[
"start", "start",
["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.punctuation.tag-open.xml","<"],
@ -13,10 +18,17 @@
["string.attribute-value.xml","'a'"], ["string.attribute-value.xml","'a'"],
["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-close.xml",">"],
["storage.type","var"], ["storage.type","var"],
["text"," "],
["string","\"</scripts>"],
["meta.tag.punctuation.end-tag-open.xml","</"], ["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.script.tag-name.xml","script"], ["meta.tag.script.tag-name.xml","script"],
["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-close.xml",">"],
["text.xml","'123'"] ["text.xml","'123'"]
],[
"start",
["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.tag-name.xml","scripts"],
["meta.tag.punctuation.tag-close.xml",">"]
],[ ],[
["string.attribute-value.xml0","tag_stuff"], ["string.attribute-value.xml0","tag_stuff"],
["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.punctuation.tag-open.xml","<"],

View file

@ -0,0 +1,23 @@
[[
"start",
["punctuation.definition.entity.ini","["],
["constant.section.group-title.ini",".ShellClassInfo"],
["punctuation.definition.entity.ini","]"]
],[
"start",
["keyword.other.definition.ini","IconResource"],
["punctuation.separator.key-value.ini","="],
["text","..\\logo.png"]
],[
"start",
["punctuation.definition.entity.ini","["],
["constant.section.group-title.ini","ViewState"],
["punctuation.definition.entity.ini","]"]
],[
"start",
["keyword.other.definition.ini","FolderType"],
["punctuation.separator.key-value.ini","="],
["text","Generic"]
],[
"start"
]]

View file

@ -38,7 +38,13 @@
],[ ],[
"start" "start"
],[ ],[
"start" "start",
["text","v "],
["keyword.operator.update.julia","="],
["text"," "],
["variable","α"],
["keyword.operator.transposed-variable.julia","'"],
["text",";"]
],[ ],[
"start", "start",
["keyword.other.julia","function"], ["keyword.other.julia","function"],

View file

@ -0,0 +1,4 @@
[[
"start",
["identifier","TODO"]
]]

View file

@ -0,0 +1,4 @@
[[
"start",
["identifier","TODO"]
]]

View file

@ -297,10 +297,10 @@
["comment.doc","* Dollar quotes starting at the end of the line are colored as SQL unless"] ["comment.doc","* Dollar quotes starting at the end of the line are colored as SQL unless"]
],[ ],[
"doc-start", "doc-start",
["comment.doc","* a special language tag is used. Pearl and Python are currently implemented"] ["comment.doc","* a special language tag is used. Dollar quote syntax coloring is implemented"]
],[ ],[
"doc-start", "doc-start",
["comment.doc","* but lots of others are possible."] ["comment.doc","* for Perl, Python, JavaScript, and Json."]
],[ ],[
"start", "start",
["comment.doc","*/"] ["comment.doc","*/"]
@ -662,6 +662,160 @@
["statementEnd",";"] ["statementEnd",";"]
],[ ],[
"start" "start"
],[
"start",
["comment","-- pl/v8 (javascript)"]
],[
"javascript-start",
["keyword.statementBegin","CREATE"],
["text"," "],
["keyword","FUNCTION"],
["text"," "],
["identifier","plv8_test"],
["paren.lparen","("],
["identifier","keys"],
["text"," "],
["keyword","text"],
["text","[], "],
["identifier","vals"],
["text"," "],
["keyword","text"],
["text","[]"],
["paren.rparen",")"],
["text"," "],
["keyword","RETURNS"],
["text"," "],
["keyword","text"],
["text"," "],
["keyword","AS"],
["text"," "],
["string","$javascript$"]
],[
"javascript-start",
["storage.type","var"],
["text"," "],
["identifier","o"],
["text"," "],
["keyword.operator","="],
["text"," "],
["paren.lparen","{"],
["paren.rparen","}"],
["punctuation.operator",";"]
],[
"javascript-start",
["keyword","for"],
["paren.lparen","("],
["storage.type","var"],
["text"," "],
["identifier","i"],
["keyword.operator","="],
["constant.numeric","0"],
["punctuation.operator",";"],
["text"," "],
["identifier","i"],
["keyword.operator","<"],
["identifier","keys"],
["punctuation.operator","."],
["support.constant","length"],
["punctuation.operator",";"],
["text"," "],
["identifier","i"],
["keyword.operator","++"],
["paren.rparen",")"],
["paren.lparen","{"]
],[
"javascript-start",
["text"," "],
["identifier","o"],
["paren.lparen","["],
["identifier","keys"],
["paren.lparen","["],
["identifier","i"],
["paren.rparen","]]"],
["text"," "],
["keyword.operator","="],
["text"," "],
["identifier","vals"],
["paren.lparen","["],
["identifier","i"],
["paren.rparen","]"],
["punctuation.operator",";"]
],[
"javascript-no_regex",
["paren.rparen","}"]
],[
"javascript-start",
["keyword","return"],
["text"," "],
["variable.language","JSON"],
["punctuation.operator","."],
["identifier","stringify"],
["paren.lparen","("],
["identifier","o"],
["paren.rparen",")"],
["punctuation.operator",";"]
],[
"start",
["string","$javascript$"],
["text"," "],
["keyword","LANGUAGE"],
["text"," "],
["identifier","plv8"],
["text"," "],
["keyword","IMMUTABLE"],
["text"," "],
["keyword","STRICT"],
["statementEnd",";"]
],[
"start"
],[
"start",
["comment","-- json"]
],[
"json-start",
["keyword.statementBegin","select"],
["text"," "],
["keyword.operator","*"],
["text"," "],
["keyword","from"],
["text"," "],
["support.function","json_object_keys"],
["paren.lparen","("],
["string","$json$"]
],[
"json-start",
["paren.lparen","{"]
],[
"json-start",
["text"," "],
["variable","\"f1\""],
["text",": "],
["constant.numeric","5"],
["text",","]
],[
"json-start",
["text"," "],
["variable","\"f2\""],
["text",": "],
["string","\"test\""],
["text",","]
],[
"json-start",
["text"," "],
["variable","\"f3\""],
["text",": "],
["paren.lparen","{"],
["paren.rparen","}"]
],[
"json-start",
["paren.rparen","}"]
],[
"start",
["string","$json$"],
["paren.rparen",")"],
["statementEnd",";"]
],[
"start"
],[ ],[
"start" "start"
],[ ],[

View file

@ -0,0 +1,98 @@
[[
"start",
["punctuation.section.embedded.begin.smarty","{"],
["keyword.control.smarty","foreach"],
["source.smarty"," "],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","foo"],
["source.smarty"," as "],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["punctuation.section.embedded.end.smarty","}"]
],[
"start",
["text.xml"," "],
["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.anchor.tag-name.xml","a"],
["text.tag-whitespace.xml"," "],
["entity.other.attribute-name.xml","href"],
["keyword.operator.attribute-equals.xml","="],
["string.attribute-value.xml","\""],
["punctuation.section.embedded.begin.smarty","{"],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["source.smarty",".zig"],
["punctuation.section.embedded.end.smarty","}"],
["string.attribute-value.xml","\""],
["meta.tag.punctuation.tag-close.xml",">"],
["punctuation.section.embedded.begin.smarty","{"],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["source.smarty",".zag"],
["punctuation.section.embedded.end.smarty","}"],
["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.anchor.tag-name.xml","a"],
["meta.tag.punctuation.tag-close.xml",">"]
],[
"start",
["text.xml"," "],
["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.anchor.tag-name.xml","a"],
["text.tag-whitespace.xml"," "],
["entity.other.attribute-name.xml","href"],
["keyword.operator.attribute-equals.xml","="],
["string.attribute-value.xml","\""],
["punctuation.section.embedded.begin.smarty","{"],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["source.smarty",".zig2"],
["punctuation.section.embedded.end.smarty","}"],
["string.attribute-value.xml","\""],
["meta.tag.punctuation.tag-close.xml",">"],
["punctuation.section.embedded.begin.smarty","{"],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["source.smarty",".zag2"],
["punctuation.section.embedded.end.smarty","}"],
["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.anchor.tag-name.xml","a"],
["meta.tag.punctuation.tag-close.xml",">"]
],[
"start",
["text.xml"," "],
["meta.tag.punctuation.tag-open.xml","<"],
["meta.tag.anchor.tag-name.xml","a"],
["text.tag-whitespace.xml"," "],
["entity.other.attribute-name.xml","href"],
["keyword.operator.attribute-equals.xml","="],
["string.attribute-value.xml","\""],
["punctuation.section.embedded.begin.smarty","{"],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["source.smarty",".zig3"],
["punctuation.section.embedded.end.smarty","}"],
["string.attribute-value.xml","\""],
["meta.tag.punctuation.tag-close.xml",">"],
["punctuation.section.embedded.begin.smarty","{"],
["punctuation.definition.variable.smarty","$"],
["variable.other.smarty","bar"],
["source.smarty",".zag3"],
["punctuation.section.embedded.end.smarty","}"],
["meta.tag.punctuation.end-tag-open.xml","</"],
["meta.tag.anchor.tag-name.xml","a"],
["meta.tag.punctuation.tag-close.xml",">"]
],[
"start",
["punctuation.section.embedded.begin.smarty","{"],
["keyword.control.smarty","foreachelse"],
["punctuation.section.embedded.end.smarty","}"]
],[
"start",
["text.xml"," There were no rows found."]
],[
"start",
["punctuation.section.embedded.begin.smarty","{"],
["source.smarty","/"],
["keyword.control.smarty","foreach"],
["punctuation.section.embedded.end.smarty","}"]
]]

View file

@ -5,18 +5,12 @@
["text"," "], ["text"," "],
["punctuation.definition.string.begin.asp","\""], ["punctuation.definition.string.begin.asp","\""],
["string.quoted.double.asp","C:\\Wikipedia - VBScript - Example - Hello World.txt\""] ["string.quoted.double.asp","C:\\Wikipedia - VBScript - Example - Hello World.txt\""]
],[
"start"
],[ ],[
"start", "start",
["text","MakeHelloWorldFile myfilename"] ["text","MakeHelloWorldFile myfilename"]
],[
"start"
],[ ],[
"state_4", "state_4",
["meta.leading-space"," "] ["meta.leading-space"," "]
],[
"state_4"
],[ ],[
"start", "start",
["storage.type.function.asp","Sub"], ["storage.type.function.asp","Sub"],
@ -26,14 +20,10 @@
["punctuation.definition.parameters.asp","("], ["punctuation.definition.parameters.asp","("],
["variable.parameter.function.asp","FileName"], ["variable.parameter.function.asp","FileName"],
["punctuation.definition.parameters.asp",")"] ["punctuation.definition.parameters.asp",")"]
],[
"start"
],[ ],[
"start", "start",
["punctuation.definition.comment.asp","'"], ["punctuation.definition.comment.asp","'"],
["comment.line.apostrophe.asp","Create a new file in C: drive or overwrite existing file"] ["comment.line.apostrophe.asp","Create a new file in C: drive or overwrite existing file"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -47,8 +37,6 @@
["punctuation.definition.string.begin.asp","\""], ["punctuation.definition.string.begin.asp","\""],
["string.quoted.double.asp","Scripting.FileSystemObject\""], ["string.quoted.double.asp","Scripting.FileSystemObject\""],
["text",")"] ["text",")"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -59,8 +47,6 @@
["text","(FileName) "], ["text","(FileName) "],
["keyword.control.asp","Then"], ["keyword.control.asp","Then"],
["text"," "] ["text"," "]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -81,8 +67,6 @@
["punctuation.definition.string.begin.asp","\""], ["punctuation.definition.string.begin.asp","\""],
["string.quoted.double.asp"," exists ... OK to overwrite?\""], ["string.quoted.double.asp"," exists ... OK to overwrite?\""],
["text",", vbOKCancel)"] ["text",", vbOKCancel)"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -90,8 +74,6 @@
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
["punctuation.definition.comment.asp","'"], ["punctuation.definition.comment.asp","'"],
["comment.line.apostrophe.asp","If button selected is not OK, then quit now"] ["comment.line.apostrophe.asp","If button selected is not OK, then quit now"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -99,8 +81,6 @@
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
["punctuation.definition.comment.asp","'"], ["punctuation.definition.comment.asp","'"],
["comment.line.apostrophe.asp","vbOK is a language constant"] ["comment.line.apostrophe.asp","vbOK is a language constant"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -113,15 +93,11 @@
["keyword.control.asp","Then"], ["keyword.control.asp","Then"],
["text"," "], ["text"," "],
["keyword.control.asp","Exit Sub"] ["keyword.control.asp","Exit Sub"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
["meta.leading-space"," "], ["meta.leading-space"," "],
["keyword.control.asp","Else"] ["keyword.control.asp","Else"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -129,8 +105,6 @@
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
["punctuation.definition.comment.asp","'"], ["punctuation.definition.comment.asp","'"],
["comment.line.apostrophe.asp","Confirm OK to create"] ["comment.line.apostrophe.asp","Confirm OK to create"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -151,8 +125,6 @@
["punctuation.definition.string.begin.asp","\""], ["punctuation.definition.string.begin.asp","\""],
["string.quoted.double.asp"," ... OK to create?\""], ["string.quoted.double.asp"," ... OK to create?\""],
["text",", vbOKCancel)"] ["text",", vbOKCancel)"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -165,23 +137,17 @@
["keyword.control.asp","Then"], ["keyword.control.asp","Then"],
["text"," "], ["text"," "],
["keyword.control.asp","Exit Sub"] ["keyword.control.asp","Exit Sub"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
["meta.leading-space"," "], ["meta.leading-space"," "],
["keyword.control.asp","End If"] ["keyword.control.asp","End If"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
["meta.leading-space"," "], ["meta.leading-space"," "],
["punctuation.definition.comment.asp","'"], ["punctuation.definition.comment.asp","'"],
["comment.line.apostrophe.asp","Create new file (or replace an existing file)"] ["comment.line.apostrophe.asp","Create new file (or replace an existing file)"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -190,8 +156,6 @@
["text"," FileObject "], ["text"," FileObject "],
["keyword.operator.asp","="], ["keyword.operator.asp","="],
["text"," FSO.CreateTextFile (FileName)"] ["text"," FSO.CreateTextFile (FileName)"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -204,8 +168,6 @@
["text"," "], ["text"," "],
["support.function.vb.asp","Now"], ["support.function.vb.asp","Now"],
["text","()"] ["text","()"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -213,8 +175,6 @@
["text","FileObject.WriteLine "], ["text","FileObject.WriteLine "],
["punctuation.definition.string.begin.asp","\""], ["punctuation.definition.string.begin.asp","\""],
["string.quoted.double.asp","Hello World\""] ["string.quoted.double.asp","Hello World\""]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -222,8 +182,6 @@
["text","FileObject."], ["text","FileObject."],
["entity.name.function.asp","Close"], ["entity.name.function.asp","Close"],
["text","()"] ["text","()"]
],[
"start"
],[ ],[
"start", "start",
["meta.odd-tab.spaces"," "], ["meta.odd-tab.spaces"," "],
@ -239,8 +197,6 @@
["text"," "], ["text"," "],
["punctuation.definition.string.begin.asp","\""], ["punctuation.definition.string.begin.asp","\""],
["string.quoted.double.asp"," ... updated.\""] ["string.quoted.double.asp"," ... updated.\""]
],[
"start"
],[ ],[
"start", "start",
["support.function.asp","End"], ["support.function.asp","End"],

View file

@ -31,7 +31,6 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
var Tokenizer = require("../tokenizer").Tokenizer;
var Rules = require("./abap_highlight_rules").AbapHighlightRules; var Rules = require("./abap_highlight_rules").AbapHighlightRules;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
var Range = require("../range").Range; var Range = require("../range").Range;

View file

@ -42,7 +42,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules; var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules;
// TODO: pick appropriate fold mode // TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode; var FoldMode = require("./folding/cstyle").FoldMode;

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
var Range = require("../range").Range; var Range = require("../range").Range;

View file

@ -42,7 +42,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ApacheConfHighlightRules = require("./apache_conf_highlight_rules").ApacheConfHighlightRules; var ApacheConfHighlightRules = require("./apache_conf_highlight_rules").ApacheConfHighlightRules;
// TODO: pick appropriate fold mode // TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode; var FoldMode = require("./folding/cstyle").FoldMode;

View file

@ -0,0 +1,55 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, 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 oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.HighlightRules = AppleScriptHighlightRules;
this.foldingRules = new FoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "--";
this.blockComment = {start: "(*", end: "*)"};
this.$id = "ace/mode/applescript";
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

View file

@ -0,0 +1,139 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2012, 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 oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var AppleScriptHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
var keywords = (
"about|above|after|against|and|around|as|at|back|before|beginning|" +
"behind|below|beneath|beside|between|but|by|considering|" +
"contain|contains|continue|copy|div|does|eighth|else|end|equal|" +
"equals|error|every|exit|fifth|first|for|fourth|from|front|" +
"get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" +
"middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" +
"reference|repeat|returning|script|second|set|seventh|since|" +
"sixth|some|tell|tenth|that|the|then|third|through|thru|" +
"timeout|times|to|transaction|try|until|where|while|whose|with|without"
);
var builtinConstants = (
"AppleScript|false|linefeed|return|pi|quote|result|space|tab|true"
);
var builtinFunctions = (
"activate|beep|count|delay|launch|log|offset|read|round|run|say|" +
"summarize|write"
);
var builtinTypes = (
"alias|application|boolean|class|constant|date|file|integer|list|" +
"number|real|record|string|text|character|characters|contents|day|" +
"frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" +
"reverse|running|time|version|weekday|word|words|year"
);
var keywordMapper = this.createKeywordMapper({
"support.function": builtinFunctions,
"constant.language": builtinConstants,
"support.type": builtinTypes,
"keyword": keywords
}, "identifier");
this.$rules = {
"start": [
{
token: "comment",
regex: "--.*$"
},
{
token : "comment", // multi line comment
regex : "\\(\\*",
next : "comment"
},
{
token: "string", // " string
regex: '".*?"'
},
{
token: "support.type",
regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b'
},
{
token: "support.function",
regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' +
'mount volume|path to|(close|open for) access|(get|set) eof|' +
'current date|do shell script|get volume settings|random number|' +
'set volume|system attribute|system info|time to GMT|' +
'(load|run|store) script|scripting components|' +
'ASCII (character|number)|localized string|' +
'choose (application|color|file|file name|' +
'folder|from list|remote application|URL)|' +
'display (alert|dialog))\\b|^\\s*return\\b'
},
{
token: "constant.language",
regex: '\\b(text item delimiters|current application|missing value)\\b'
},
{
token: "keyword",
regex: '\\b(apart from|aside from|instead of|out of|greater than|' +
"isn't|(doesn't|does not) (equal|come before|come after|contain)|" +
'(greater|less) than( or equal)?|(starts?|ends|begins?) with|' +
'contained by|comes (before|after)|a (ref|reference))\\b'
},
{
token: keywordMapper,
regex: "[a-zA-Z][a-zA-Z0-9_]*\\b"
}
],
"comment": [
{
token: "comment", // closing comment
regex: "\\*\\)",
next: "start"
}, {
defaultToken: "comment"
}
]
}
this.normalizeRules();
};
oop.inherits(AppleScriptHighlightRules, TextHighlightRules);
exports.AppleScriptHighlightRules = AppleScriptHighlightRules;
});

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules; var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
var AsciidocFoldMode = require("./folding/asciidoc").FoldMode; var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;

View file

@ -38,7 +38,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules; var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;

View file

@ -42,7 +42,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules; var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules;
// TODO: pick appropriate fold mode // TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode; var FoldMode = require("./folding/cstyle").FoldMode;

View file

@ -42,7 +42,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules; var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
var FoldMode = require("./folding/cstyle").FoldMode; var FoldMode = require("./folding/cstyle").FoldMode;

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules; var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var C9StyleFoldMode = require("./folding/c9search").FoldMode; var C9StyleFoldMode = require("./folding/c9search").FoldMode;

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Range = require("../range").Range; var Range = require("../range").Range;

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules; var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules;
var CoffeeFoldMode = require("./folding/coffee").FoldMode; var CoffeeFoldMode = require("./folding/coffee").FoldMode;

View file

@ -33,10 +33,8 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules; var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent; var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
var Range = require("../range").Range;
var Mode = function() { var Mode = function() {
this.HighlightRules = ClojureHighlightRules; this.HighlightRules = ClojureHighlightRules;
@ -47,29 +45,72 @@ oop.inherits(Mode, TextMode);
(function() { (function() {
this.lineCommentStart = ";"; this.lineCommentStart = ";";
this.minorIndentFunctions = ["defn", "defn-", "defmacro", "def", "deftest", "testing"];
this.$toIndent = function(str) {
return str.split('').map(function(ch) {
if (/\s/.exec(ch)) {
return ch;
} else {
return ' ';
}
}).join('');
};
this.$calculateIndent = function(line, tab) {
var baseIndent = this.$getIndent(line);
var delta = 0;
var isParen, ch;
// Walk back from end of line, find matching braces
for (var i = line.length - 1; i >= 0; i--) {
ch = line[i];
if (ch === '(') {
delta--;
isParen = true;
} else if (ch === '(' || ch === '[' || ch === '{') {
delta--;
isParen = false;
} else if (ch === ')' || ch === ']' || ch === '}') {
delta++;
}
if (delta < 0) {
break;
}
}
if (delta < 0 && isParen) {
// Were more brackets opened than closed and was a ( left open?
i += 1;
var iBefore = i;
var fn = '';
while (true) {
ch = line[i];
if (ch === ' ' || ch === '\t') {
if(this.minorIndentFunctions.indexOf(fn) !== -1) {
return this.$toIndent(line.substring(0, iBefore - 1) + tab);
} else {
return this.$toIndent(line.substring(0, i + 1));
}
} else if (ch === undefined) {
return this.$toIndent(line.substring(0, iBefore - 1) + tab);
}
fn += line[i];
i++;
}
} else if(delta < 0 && !isParen) {
// Were more brackets openend than closed and was it not a (?
return this.$toIndent(line.substring(0, i+1));
} else if(delta > 0) {
// Mere more brackets closed than opened? Outdent.
baseIndent = baseIndent.substring(0, baseIndent.length - tab.length);
return baseIndent;
} else {
// Were they nicely matched? Just indent like line before.
return baseIndent;
}
};
this.getNextLineIndent = function(state, line, tab) { this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line); return this.$calculateIndent(line, tab);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start") {
var match = line.match(/[\(\[]/);
if (match) {
indent += " ";
}
match = line.match(/[\)]/);
if (match) {
indent = "";
}
}
return indent;
}; };
this.checkOutdent = function(state, line, input) { this.checkOutdent = function(state, line, input) {

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules; var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
var Range = require("../range").Range; var Range = require("../range").Range;

View file

@ -31,7 +31,6 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
var Tokenizer = require("../tokenizer").Tokenizer;
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules; var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var FoldMode = require("./folding/coffee").FoldMode; var FoldMode = require("./folding/coffee").FoldMode;
@ -50,7 +49,28 @@ oop.inherits(Mode, TextMode);
(function() { (function() {
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/; /*:
[({[=:] # Opening parentheses or brackets
|[-=]> # OR single or double arrow
|\b(?: # OR one of these words:
else # else
|try # OR try
|(?:swi|ca)tch # OR catch, optionally followed by:
(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)? # a variable
|finally # OR finally
))\s*$ # all as the last thing on a line (allowing trailing space)
| # ---- OR ---- :
^\s* # a line starting with optional space
(else\b\s*)? # followed by an optional "else"
(?: # followed by one of the following:
if # if
|for # OR for
|while # OR while
|loop # OR loop
)\b # (as a word)
(?!.*\bthen\b) # ... but NOT followed by "then" on the line
*/
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/;
var commentLine = /^(\s*)#/; var commentLine = /^(\s*)#/;
var hereComment = /^\s*###(?!#)/; var hereComment = /^\s*###(?!#)/;
var indentation = /^\s*/; var indentation = /^\s*/;

View file

@ -34,7 +34,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang"); var lang = require("../lib/lang");
var HtmlMode = require("./html").Mode; var HtmlMode = require("./html").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules; var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
var voidElements = "cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)".split("|"); var voidElements = "cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)".split("|");

View file

@ -3,7 +3,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules; var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;

View file

@ -26,9 +26,6 @@ var CSharpHighlightRules = function() {
token : "comment", // multi line comment token : "comment", // multi line comment
regex : "\\/\\*", regex : "\\/\\*",
next : "comment" next : "comment"
}, {
token : "string.regexp",
regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
}, { }, {
token : "string", // character token : "string", // character
regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/ regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/

View file

@ -33,7 +33,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var WorkerClient = require("../worker/worker_client").WorkerClient; var WorkerClient = require("../worker/worker_client").WorkerClient;

View file

@ -1,7 +1,7 @@
define(function(require, exports, module) { define(function(require, exports, module) {
/*! /*!
CSSLint CSSLint
Copyright (c) 2013 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. Copyright (c) 2014 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* Build: v0.10.0 15-August-2013 01:07:22 */ /* Build: v0.10.0 31-March-2014 08:16:48 */
/*! /*!
Parser-Lib Parser-Lib
Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
@ -46,7 +46,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* Version v0.2.3, Build time: 19-June-2013 11:16:15 */ /* Version v0.2.4, Build time: 7-January-2014 07:32:49 */
var parserlib = {}; var parserlib = {};
(function(){ (function(){
@ -956,7 +956,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
/* Version v0.2.3, Build time: 19-June-2013 11:16:15 */ /* Version v0.2.4, Build time: 7-January-2014 07:32:49 */
(function(){ (function(){
var EventTarget = parserlib.util.EventTarget, var EventTarget = parserlib.util.EventTarget,
TokenStreamBase = parserlib.util.TokenStreamBase, TokenStreamBase = parserlib.util.TokenStreamBase,
@ -991,6 +991,7 @@ var Colors = {
darkcyan :"#008b8b", darkcyan :"#008b8b",
darkgoldenrod :"#b8860b", darkgoldenrod :"#b8860b",
darkgray :"#a9a9a9", darkgray :"#a9a9a9",
darkgrey :"#a9a9a9",
darkgreen :"#006400", darkgreen :"#006400",
darkkhaki :"#bdb76b", darkkhaki :"#bdb76b",
darkmagenta :"#8b008b", darkmagenta :"#8b008b",
@ -1002,11 +1003,13 @@ var Colors = {
darkseagreen :"#8fbc8f", darkseagreen :"#8fbc8f",
darkslateblue :"#483d8b", darkslateblue :"#483d8b",
darkslategray :"#2f4f4f", darkslategray :"#2f4f4f",
darkslategrey :"#2f4f4f",
darkturquoise :"#00ced1", darkturquoise :"#00ced1",
darkviolet :"#9400d3", darkviolet :"#9400d3",
deeppink :"#ff1493", deeppink :"#ff1493",
deepskyblue :"#00bfff", deepskyblue :"#00bfff",
dimgray :"#696969", dimgray :"#696969",
dimgrey :"#696969",
dodgerblue :"#1e90ff", dodgerblue :"#1e90ff",
firebrick :"#b22222", firebrick :"#b22222",
floralwhite :"#fffaf0", floralwhite :"#fffaf0",
@ -1017,6 +1020,7 @@ var Colors = {
gold :"#ffd700", gold :"#ffd700",
goldenrod :"#daa520", goldenrod :"#daa520",
gray :"#808080", gray :"#808080",
grey :"#808080",
green :"#008000", green :"#008000",
greenyellow :"#adff2f", greenyellow :"#adff2f",
honeydew :"#f0fff0", honeydew :"#f0fff0",
@ -1034,12 +1038,14 @@ var Colors = {
lightcyan :"#e0ffff", lightcyan :"#e0ffff",
lightgoldenrodyellow :"#fafad2", lightgoldenrodyellow :"#fafad2",
lightgray :"#d3d3d3", lightgray :"#d3d3d3",
lightgrey :"#d3d3d3",
lightgreen :"#90ee90", lightgreen :"#90ee90",
lightpink :"#ffb6c1", lightpink :"#ffb6c1",
lightsalmon :"#ffa07a", lightsalmon :"#ffa07a",
lightseagreen :"#20b2aa", lightseagreen :"#20b2aa",
lightskyblue :"#87cefa", lightskyblue :"#87cefa",
lightslategray :"#778899", lightslategray :"#778899",
lightslategrey :"#778899",
lightsteelblue :"#b0c4de", lightsteelblue :"#b0c4de",
lightyellow :"#ffffe0", lightyellow :"#ffffe0",
lime :"#00ff00", lime :"#00ff00",
@ -1092,6 +1098,7 @@ var Colors = {
skyblue :"#87ceeb", skyblue :"#87ceeb",
slateblue :"#6a5acd", slateblue :"#6a5acd",
slategray :"#708090", slategray :"#708090",
slategrey :"#708090",
snow :"#fffafa", snow :"#fffafa",
springgreen :"#00ff7f", springgreen :"#00ff7f",
steelblue :"#4682b4", steelblue :"#4682b4",
@ -1117,6 +1124,7 @@ var Colors = {
buttontext :"Text on push buttons.", buttontext :"Text on push buttons.",
captiontext :"Text in caption, size box, and scrollbar arrow box.", captiontext :"Text in caption, size box, and scrollbar arrow box.",
graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.",
highlight :"Item(s) selected in a control.", highlight :"Item(s) selected in a control.",
highlighttext :"Text of item(s) selected in a control.", highlighttext :"Text of item(s) selected in a control.",
inactiveborder :"Inactive window border.", inactiveborder :"Inactive window border.",
@ -3533,6 +3541,12 @@ nth
var Properties = { var Properties = {
//A //A
"align-items" : "flex-start | flex-end | center | baseline | stretch",
"align-content" : "flex-start | flex-end | center | space-between | space-around | stretch",
"align-self" : "auto | flex-start | flex-end | center | baseline | stretch",
"-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch",
"-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch",
"-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch",
"alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>", "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>",
"alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
"animation" : 1, "animation" : 1,
@ -3728,15 +3742,24 @@ var Properties = {
"border-top-width" : "<border-width>", "border-top-width" : "<border-width>",
"border-width" : { multi: "<border-width>", max: 4 }, "border-width" : { multi: "<border-width>", max: 4 },
"bottom" : "<margin-width> | inherit", "bottom" : "<margin-width> | inherit",
"box-align" : "start | end | center | baseline | stretch", //http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/ "-moz-box-align" : "start | end | center | baseline | stretch",
"box-decoration-break" : "slice |clone", "-moz-box-decoration-break" : "slice |clone",
"box-direction" : "normal | reverse | inherit", "-moz-box-direction" : "normal | reverse | inherit",
"box-flex" : "<number>", "-moz-box-flex" : "<number>",
"box-flex-group" : "<integer>", "-moz-box-flex-group" : "<integer>",
"box-lines" : "single | multiple", "-moz-box-lines" : "single | multiple",
"box-ordinal-group" : "<integer>", "-moz-box-ordinal-group" : "<integer>",
"box-orient" : "horizontal | vertical | inline-axis | block-axis | inherit", "-moz-box-orient" : "horizontal | vertical | inline-axis | block-axis | inherit",
"box-pack" : "start | end | center | justify", "-moz-box-pack" : "start | end | center | justify",
"-webkit-box-align" : "start | end | center | baseline | stretch",
"-webkit-box-decoration-break" : "slice |clone",
"-webkit-box-direction" : "normal | reverse | inherit",
"-webkit-box-flex" : "<number>",
"-webkit-box-flex-group" : "<integer>",
"-webkit-box-lines" : "single | multiple",
"-webkit-box-ordinal-group" : "<integer>",
"-webkit-box-orient" : "horizontal | vertical | inline-axis | block-axis | inherit",
"-webkit-box-pack" : "start | end | center | justify",
"box-shadow" : function (expression) { "box-shadow" : function (expression) {
var result = false, var result = false,
part; part;
@ -3782,7 +3805,7 @@ var Properties = {
//D //D
"direction" : "ltr | rtl | inherit", "direction" : "ltr | rtl | inherit",
"display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | box | inline-box | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box", "display" : "inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex",
"dominant-baseline" : 1, "dominant-baseline" : 1,
"drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>", "drop-initial-after-adjust" : "central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>",
"drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "drop-initial-after-align" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",
@ -3799,6 +3822,26 @@ var Properties = {
"filter" : 1, "filter" : 1,
"fit" : "fill | hidden | meet | slice", "fit" : "fill | hidden | meet | slice",
"fit-position" : 1, "fit-position" : 1,
"flex" : "none | [ <flex-grow> <flex-shrink>? || <flex-basis>",
"flex-basis" : "<width>",
"flex-direction" : "row | row-reverse | column | column-reverse",
"flex-flow" : "<flex-direction> || <flex-wrap>",
"flex-grow" : "<number>",
"flex-shrink" : "<number>",
"flex-wrap" : "nowrap | wrap | wrap-reverse",
"-webkit-flex" : "none | [ <flex-grow> <flex-shrink>? || <flex-basis>",
"-webkit-flex-basis" : "<width>",
"-webkit-flex-direction" : "row | row-reverse | column | column-reverse",
"-webkit-flex-flow" : "<flex-direction> || <flex-wrap>",
"-webkit-flex-grow" : "<number>",
"-webkit-flex-shrink" : "<number>",
"-webkit-flex-wrap" : "nowrap | wrap | wrap-reverse",
"-ms-flex" : "[[ <number> <number>? ] || [ <length> || <percentage> || auto ] ] | none",
"-ms-flex-align" : "start | end | center | stretch | baseline",
"-ms-flex-direction" : "row | column | row-reverse | column-reverse | inherit",
"-ms-flex-order" : "<number>",
"-ms-flex-pack" : "start | end | center | justify",
"-ms-flex-wrap" : "nowrap | wrap | wrap-reverse",
"float" : "left | right | none | inherit", "float" : "left | right | none | inherit",
"float-offset" : 1, "float-offset" : 1,
"font" : 1, "font" : 1,
@ -3842,6 +3885,10 @@ var Properties = {
"image-resolution" : 1, "image-resolution" : 1,
"inline-box-align" : "initial | last | <integer>", "inline-box-align" : "initial | last | <integer>",
//J
"justify-content" : "flex-start | flex-end | center | space-between | space-around",
"-webkit-justify-content" : "flex-start | flex-end | center | space-between | space-around",
//L //L
"left" : "<margin-width> | inherit", "left" : "<margin-width> | inherit",
"letter-spacing" : "<length> | normal | inherit", "letter-spacing" : "<length> | normal | inherit",
@ -3885,6 +3932,8 @@ var Properties = {
//O //O
"opacity" : "<number> | inherit", "opacity" : "<number> | inherit",
"order" : "<integer>",
"-webkit-order" : "<integer>",
"orphans" : "<integer> | inherit", "orphans" : "<integer> | inherit",
"outline" : 1, "outline" : 1,
"outline-color" : "<color> | invert | inherit", "outline-color" : "<color> | invert | inherit",
@ -3893,6 +3942,7 @@ var Properties = {
"outline-width" : "<border-width> | inherit", "outline-width" : "<border-width> | inherit",
"overflow" : "visible | hidden | scroll | auto | inherit", "overflow" : "visible | hidden | scroll | auto | inherit",
"overflow-style" : 1, "overflow-style" : 1,
"overflow-wrap" : "normal | break-word",
"overflow-x" : 1, "overflow-x" : 1,
"overflow-y" : 1, "overflow-y" : 1,
@ -3970,6 +4020,8 @@ var Properties = {
"text-transform" : "capitalize | uppercase | lowercase | none | inherit", "text-transform" : "capitalize | uppercase | lowercase | none | inherit",
"text-wrap" : "normal | none | avoid", "text-wrap" : "normal | none | avoid",
"top" : "<margin-width> | inherit", "top" : "<margin-width> | inherit",
"-ms-touch-action" : "auto | none | pan-x | pan-y",
"touch-action" : "auto | none | pan-x | pan-y",
"transform" : 1, "transform" : 1,
"transform-origin" : 1, "transform-origin" : 1,
"transform-style" : 1, "transform-style" : 1,
@ -3980,7 +4032,7 @@ var Properties = {
"transition-timing-function" : 1, "transition-timing-function" : 1,
//U //U
"unicode-bidi" : "normal | embed | bidi-override | inherit", "unicode-bidi" : "normal | embed | isolate | bidi-override | isolate-override | plaintext | inherit",
"user-modify" : "read-only | read-write | write-only | inherit", "user-modify" : "read-only | read-write | write-only | inherit",
"user-select" : "none | text | toggle | element | elements | all | inherit", "user-select" : "none | text | toggle | element | elements | all | inherit",
@ -4004,7 +4056,8 @@ var Properties = {
"width" : "<length> | <percentage> | auto | inherit" , "width" : "<length> | <percentage> | auto | inherit" ,
"word-break" : "normal | keep-all | break-all", "word-break" : "normal | keep-all | break-all",
"word-spacing" : "<length> | normal | inherit", "word-spacing" : "<length> | normal | inherit",
"word-wrap" : 1, "word-wrap" : "normal | break-word",
"writing-mode" : "horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb | inherit",
//Z //Z
"z-index" : "<integer> | auto | inherit", "z-index" : "<integer> | auto | inherit",
@ -4275,9 +4328,6 @@ function PropertyValuePart(text, line, col){
} }
} else if (/^([+\-]?[\d\.]+)%$/i.test(text)){ //percentage
this.type = "percentage";
this.value = +RegExp.$1;
} else if (/^([+\-]?[\d\.]+)%$/i.test(text)){ //percentage } else if (/^([+\-]?[\d\.]+)%$/i.test(text)){ //percentage
this.type = "percentage"; this.type = "percentage";
this.value = +RegExp.$1; this.value = +RegExp.$1;
@ -4374,6 +4424,7 @@ PropertyValuePart.prototype.constructor = PropertyValuePart;
PropertyValuePart.fromToken = function(token){ PropertyValuePart.fromToken = function(token){
return new PropertyValuePart(token.value, token.startLine, token.startCol); return new PropertyValuePart(token.value, token.startLine, token.startCol);
}; };
var Pseudos = { var Pseudos = {
":first-letter": 1, ":first-letter": 1,
":first-line": 1, ":first-line": 1,
@ -5661,7 +5712,7 @@ var Tokens = [
{ name: "FONT_FACE_SYM", text: "@font-face"}, { name: "FONT_FACE_SYM", text: "@font-face"},
{ name: "CHARSET_SYM", text: "@charset"}, { name: "CHARSET_SYM", text: "@charset"},
{ name: "NAMESPACE_SYM", text: "@namespace"}, { name: "NAMESPACE_SYM", text: "@namespace"},
{ name: "VIEWPORT_SYM", text: "@viewport"}, { name: "VIEWPORT_SYM", text: ["@viewport", "@-ms-viewport"]},
{ name: "UNKNOWN_SYM" }, { name: "UNKNOWN_SYM" },
//{ name: "ATKEYWORD"}, //{ name: "ATKEYWORD"},
@ -6443,7 +6494,7 @@ var CSSLint = (function(){
embeddedRuleset = /\/\*csslint([^\*]*)\*\//, embeddedRuleset = /\/\*csslint([^\*]*)\*\//,
api = new parserlib.util.EventTarget(); api = new parserlib.util.EventTarget();
api.version = "0.10.0"; api.version = "@VERSION@";
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Rule Management // Rule Management
@ -8941,13 +8992,14 @@ CSSLint.addFormatter({
output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n"; output += filename + ": " + capitalize(message.type) + " - " + message.message + "\n";
} else { } else {
output += filename + ": " + "line " + message.line + output += filename + ": " + "line " + message.line +
", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + "\n"; ", col " + message.col + ", " + capitalize(message.type) + " - " + message.message + " (" + message.rule.id + ")\n";
} }
}); });
return output; return output;
} }
}); });
/*global CSSLint*/ /*global CSSLint*/
CSSLint.addFormatter({ CSSLint.addFormatter({
//format information //format information

View file

@ -76,6 +76,8 @@ oop.inherits(Worker, Mirror);
this.onUpdate = function() { this.onUpdate = function() {
var value = this.doc.getValue(); var value = this.doc.getValue();
if (!value)
return this.sender.emit("csslint", []);
var infoRules = this.infoRules; var infoRules = this.infoRules;
var result = CSSLint.verify(value, this.ruleset); var result = CSSLint.verify(value, this.ruleset);

View file

@ -40,7 +40,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
// defines the parent mode // defines the parent mode
var HtmlMode = require("./html").Mode; var HtmlMode = require("./html").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
var HtmlFoldMode = require("./folding/html").FoldMode; var HtmlFoldMode = require("./folding/html").FoldMode;

View file

@ -37,7 +37,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var TextMode = require("./text").Mode; var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var DHighlightRules = require("./d_highlight_rules").DHighlightRules; var DHighlightRules = require("./d_highlight_rules").DHighlightRules;
var FoldMode = require("./folding/cstyle").FoldMode; var FoldMode = require("./folding/cstyle").FoldMode;

View file

@ -66,7 +66,7 @@ var DHighlightRules = function() {
var stringEscapesSeq = { var stringEscapesSeq = {
token: "constant.language.escape", token: "constant.language.escape",
regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv])|" + regex: "\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\"\\?0abfnrtv\\\\])|" +
"(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))" "(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))"
}; };

View file

@ -42,7 +42,6 @@ define(function(require, exports, module) {
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var CMode = require("./c_cpp").Mode; var CMode = require("./c_cpp").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules; var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules;
var CStyleFoldMode = require("./folding/cstyle").FoldMode; var CStyleFoldMode = require("./folding/cstyle").FoldMode;

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