diff --git a/.gitignore b/.gitignore index e8323948..65700fe6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,10 @@ .*.gz # A handy place to put stuff that git should ignore: -/ignore/ \ No newline at end of file +/ignore/ +support/async/ +support/dryice/ +support/jsdom/ +support/node-htmlparser/ +support/node-o3-xml/ +support/requirejs/ \ No newline at end of file diff --git a/build_support/boot.js b/build_support/boot.js index 8aafd2d9..0488fcae 100644 --- a/build_support/boot.js +++ b/build_support/boot.js @@ -50,38 +50,41 @@ var deps = [ require(deps, function() { var catalog = require("pilot/plugin_manager").catalog; catalog.registerPlugins([ "pilot/index" ]); - + var Dom = require("pilot/dom"); var Event = require("pilot/event"); - + var Editor = require("ace/editor").Editor; var EditSession = require("ace/edit_session").EditSession; var UndoManager = require("ace/undomanager").UndoManager; var Renderer = require("ace/virtual_renderer").VirtualRenderer; - + window.ace = { edit: function(el) { if (typeof(el) == "string") { el = document.getElementById(el); } - + var doc = new EditSession(Dom.getInnerText(el)); doc.setUndoManager(new UndoManager()); el.innerHTML = ''; var editor = new Editor(new Renderer(el, "ace/theme/textmate")); editor.setSession(doc); - + var env = require("pilot/environment").create(); catalog.startupPlugins({ env: env }).then(function() { env.document = doc; - env.editor = env; + env.editor = editor; editor.resize(); Event.addListener(window, "resize", function() { editor.resize(); }); el.env = env; }); + // Store env on editor such that it can be accessed later on from + // the returned object. + editor.env = env; return editor; } }; diff --git a/lib/ace/commands/default_commands.js b/lib/ace/commands/default_commands.js index e729457e..9a748a39 100644 --- a/lib/ace/commands/default_commands.js +++ b/lib/ace/commands/default_commands.js @@ -1,4 +1,5 @@ -/* ***** BEGIN LICENSE BLOCK ***** +/* vim:ts=4:sts=4:sw=4: + * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -21,6 +22,7 @@ * Contributor(s): * Fabian Jakobs * Julian Viereck + * Mihai Sucan * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -82,6 +84,30 @@ canon.addCommand({ env.editor.find(needle); } }); +canon.addCommand({ + name: "replace", + exec: function(env, args, request) { + var needle = prompt("Find:"); + if (!needle) + return; + var replacement = prompt("Replacement:"); + if (!replacement) + return; + env.editor.replace(replacement, {needle: needle}); + } +}); +canon.addCommand({ + name: "replaceall", + exec: function(env, args, request) { + var needle = prompt("Find:"); + if (!needle) + return; + var replacement = prompt("Replacement:"); + if (!replacement) + return; + env.editor.replaceAll(replacement, {needle: needle}); + } +}); canon.addCommand({ name: "undo", exec: function(env, args, request) { env.editor.undo(); } diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index b4cb1c7b..628e15c8 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -283,7 +283,7 @@ var EditSession = function(text, mode) { }; this.tokenRe = /^[\w\d]+/g; - this.nonTokenRe = /^(?:[^\w\d|[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF])+/g; + this.nonTokenRe = /^(?:[^\w\d]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF])+/g; this.getWordRange = function(row, column) { var line = this.getLine(row); diff --git a/lib/ace/keyboard/keybinding/default_mac.js b/lib/ace/keyboard/keybinding/default_mac.js index 005a6c84..e0d7330b 100644 --- a/lib/ace/keyboard/keybinding/default_mac.js +++ b/lib/ace/keyboard/keybinding/default_mac.js @@ -42,8 +42,8 @@ exports.bindings = { "removeline": "Command-D", "gotoline": "Command-L", "togglecomment": "Command-7", - "findnext": "Command-K", - "findprevious": "Command-Shift-K", + "findnext": "Command-G", + "findprevious": "Command-Shift-G", "find": "Command-F", "replace": "Command-R", "undo": "Command-Z", diff --git a/lib/ace/test/document_test.js b/lib/ace/test/document_test.js index b9249e8f..ab4447a6 100644 --- a/lib/ace/test/document_test.js +++ b/lib/ace/test/document_test.js @@ -254,13 +254,13 @@ var Test = { assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); }, - "test: set new line mode to 'windows' should use '\r\n' as new lines": function() { + "test: set new line mode to 'windows' should use '\\r\\n' as new lines": function() { var doc = new Document(["1", "2", "3"].join("\n")); doc.setNewLineMode("windows"); assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n")); }, - "test: set new line mode to 'unix' should use '\n' as new lines": function() { + "test: set new line mode to 'unix' should use '\\n' as new lines": function() { var doc = new Document(["1", "2", "3"].join("\r\n")); doc.setNewLineMode("unix"); diff --git a/lib/ace/test/selection_test.js b/lib/ace/test/selection_test.js index 445a0e72..b94a17db 100644 --- a/lib/ace/test/selection_test.js +++ b/lib/ace/test/selection_test.js @@ -287,6 +287,42 @@ var Test = { selection.moveCursorTo(0, 5); assert.notOk(called); + }, + + "test: moveWordLeft should move past || and [": function() { + var session = new EditSession("||foo["); + var selection = session.getSelection(); + + // Move behind || + selection.moveCursorWordRight(); + assert.position(selection.getCursor(), 0, 2); + + // Move beind foo + selection.moveCursorWordRight(); + assert.position(selection.getCursor(), 0, 5); + + // Move behind [ + selection.moveCursorWordRight(); + assert.position(selection.getCursor(), 0, 6); + }, + + "test: moveWordRight should move past || and [": function() { + var session = new EditSession("||foo["); + var selection = session.getSelection(); + + selection.moveCursorTo(0, 6); + + // Move behind [ + selection.moveCursorWordLeft(); + assert.position(selection.getCursor(), 0, 5); + + // Move beind foo + selection.moveCursorWordLeft(); + assert.position(selection.getCursor(), 0, 2); + + // Move behind || + selection.moveCursorWordLeft(); + assert.position(selection.getCursor(), 0, 0); } }; diff --git a/lib/ace/theme/clouds.js b/lib/ace/theme/clouds.js index 95b1d94a..6046ebd4 100644 --- a/lib/ace/theme/clouds.js +++ b/lib/ace/theme/clouds.js @@ -192,4 +192,4 @@ define(function(require, exports, module) { dom.importCssString(cssText); exports.cssClass = "ace-clouds"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/clouds_midnight.js b/lib/ace/theme/clouds_midnight.js index 21939ae5..51fbbe41 100644 --- a/lib/ace/theme/clouds_midnight.js +++ b/lib/ace/theme/clouds_midnight.js @@ -193,4 +193,4 @@ background-color:#E92E2E;\ dom.importCssString(cssText); exports.cssClass = "ace-clouds-midnight"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/cobalt.js b/lib/ace/theme/cobalt.js index 52b8af53..e2762c2e 100644 --- a/lib/ace/theme/cobalt.js +++ b/lib/ace/theme/cobalt.js @@ -194,4 +194,4 @@ color:#0088FF;\ dom.importCssString(cssText); exports.cssClass = "ace-cobalt"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/dawn.js b/lib/ace/theme/dawn.js index 36b468de..afab897a 100644 --- a/lib/ace/theme/dawn.js +++ b/lib/ace/theme/dawn.js @@ -198,4 +198,4 @@ color:#5A525F;\ dom.importCssString(cssText); exports.cssClass = "ace-dawn"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/idle_fingers.js b/lib/ace/theme/idle_fingers.js index 41fc98fd..6273139e 100644 --- a/lib/ace/theme/idle_fingers.js +++ b/lib/ace/theme/idle_fingers.js @@ -146,7 +146,7 @@ background-color:#FF0000;\ }\ \ .ace-idle-fingers .ace_support {\ - color:#bc9458;\ + \ }\ \ .ace-idle-fingers .ace_support.ace_function {\ @@ -167,7 +167,7 @@ background-color:#FF0000;\ \ .ace-idle-fingers .ace_comment {\ font-style:italic;\ - color:#BC9458;\ +color:#BC9458;\ }\ \ .ace-idle-fingers .ace_comment.ace_doc {\ @@ -179,19 +179,24 @@ background-color:#FF0000;\ }\ \ .ace-idle-fingers .ace_variable {\ - color:#b7dff8;\ + \ }\ \ .ace-idle-fingers .ace_variable.ace_language {\ - color:#b7dff8;\ + \ }\ \ .ace-idle-fingers .ace_xml_pe {\ \ +}\ +\ +.ace-idle-fingers .ace_collab.ace_user1 {\ + color:#323232;\ +background-color:#FFF980; \ }"; // import CSS once dom.importCssString(cssText); exports.cssClass = "ace-idle-fingers"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/kr_theme.js b/lib/ace/theme/kr_theme.js index a21e9a2a..28a48f62 100644 --- a/lib/ace/theme/kr_theme.js +++ b/lib/ace/theme/kr_theme.js @@ -194,4 +194,4 @@ color:#706D5B;\ dom.importCssString(cssText); exports.cssClass = "ace-kr-theme"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/mono_industrial.js b/lib/ace/theme/mono_industrial.js index 128d7c33..04e1843d 100644 --- a/lib/ace/theme/mono_industrial.js +++ b/lib/ace/theme/mono_industrial.js @@ -194,4 +194,4 @@ background-color:#151C19;\ dom.importCssString(cssText); exports.cssClass = "ace-mono-industrial"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/monokai.js b/lib/ace/theme/monokai.js index fe3e9fcb..17d1d395 100644 --- a/lib/ace/theme/monokai.js +++ b/lib/ace/theme/monokai.js @@ -194,4 +194,4 @@ background-color:#AE81FF;\ dom.importCssString(cssText); exports.cssClass = "ace-monokai"; -}); +}); \ No newline at end of file diff --git a/lib/ace/theme/twilight.js b/lib/ace/theme/twilight.js index 2fe50e40..7c5b5629 100644 --- a/lib/ace/theme/twilight.js +++ b/lib/ace/theme/twilight.js @@ -64,9 +64,8 @@ define(function(require, exports, module) { }\ \ .ace-twilight .ace_print_margin {\ - border-left: 1px solid #3C3C3C;\ - width: 100%;\ - background: #242424;\ + width: 1px;\ + background: #e8e8e8;\ }\ \ .ace-twilight .ace_scroller {\ @@ -85,13 +84,6 @@ define(function(require, exports, module) { .ace-twilight .ace_cursor.ace_overwrite {\ border-left: 0px;\ border-bottom: 1px solid #A7A7A7;\ -}\ -.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\ - border: 1px solid #FFE300;\ - background: #766B13;\ -}\ -.ace-twilight.normal-mode .ace_cursor-layer {\ - z-index: 0;\ }\ \ .ace-twilight .ace_marker-layer .ace_selection {\ @@ -204,4 +196,4 @@ color:#5F5A60;\ dom.importCssString(cssText); exports.cssClass = "ace-twilight"; -}); +}); \ No newline at end of file diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 2f1ab138..f2b30885 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -634,17 +634,17 @@ var VirtualRenderer = function(container, theme) { }; this.scrollToLine = function(line, center) { - var lineHeight = { lineHeight: this.lineHeight }; - var offset = 0; - for (var l = 1; l < line; l++) { - offset += this.session.getRowHeight(lineHeight, l-1); - } - - if (center) { - offset -= this.$size.scrollerHeight / 2; - } - this.scrollToY(offset); - }; + var lineHeight = { lineHeight: this.lineHeight }; + var offset = 0; + for (var l = 1; l < line; l++) { + offset += this.session.getRowHeight(lineHeight, l-1); + } + + if (center) { + offset -= this.$size.scrollerHeight / 2; + } + this.scrollToY(offset); + }; this.scrollToY = function(scrollTop) { var maxHeight = this.session.getScreenLength() * this.lineHeight - this.$size.scrollerHeight; @@ -777,4 +777,4 @@ var VirtualRenderer = function(container, theme) { }).call(VirtualRenderer.prototype); exports.VirtualRenderer = VirtualRenderer; -}); +}); \ No newline at end of file diff --git a/support/pilot b/support/pilot index cbfac498..6e1fbe1d 160000 --- a/support/pilot +++ b/support/pilot @@ -1 +1 @@ -Subproject commit cbfac498d30d43fdb7687d198c5b752736222c2f +Subproject commit 6e1fbe1dfdff64020f15cd9e23ea72b7803cf406 diff --git a/tool/Theme.tmpl.css b/tool/Theme.tmpl.css index ab240e67..64270089 100644 --- a/tool/Theme.tmpl.css +++ b/tool/Theme.tmpl.css @@ -145,4 +145,8 @@ .%cssClass% .ace_xml_pe { %xml_pe% +} + +.%cssClass% .ace_collab.ace_user1 { + %collab.user1% } \ No newline at end of file diff --git a/tool/tmtheme.js b/tool/tmtheme.js index 018594eb..806d4b98 100644 --- a/tool/tmtheme.js +++ b/tool/tmtheme.js @@ -83,7 +83,9 @@ var supportedScopes = { "variable": "variable", "variable.language": "variable.language", - "meta.tag.sgml.doctype": "xml_pe" + "meta.tag.sgml.doctype": "xml_pe", + + "collab.user1": "collab.user1" }; function extractStyles(theme) { @@ -116,7 +118,7 @@ function extractStyles(theme) { } } } - + return colors; }; diff --git a/tool/tmthemes/idleFingers.tmTheme b/tool/tmthemes/idleFingers.tmTheme index 51666df3..d86a0edd 100644 --- a/tool/tmthemes/idleFingers.tmTheme +++ b/tool/tmthemes/idleFingers.tmTheme @@ -373,6 +373,19 @@ #FFFFFF + + name + User1 + scope + collab.user1 + settings + + background + #FFF980 + foreground + #323232 + + uuid 95BEF169-A2E5-4041-A84A-AAFC1DD61558