From e6fc5d467dc6a4c8f8d962ff0c2930b805d4d2e2 Mon Sep 17 00:00:00 2001 From: Lennart Kats Date: Fri, 27 Feb 2015 14:26:25 +0100 Subject: [PATCH 1/6] Revert "Merge pull request +6023 from c9/profile-integration" This reverts commit 584e691a3f8dc298eff20401cfd9a8ef23164b16, reversing changes made to 7af49ff62b19985c3ee39df1af7a683183a3a25b. Conflicts: configs/monitor.js scripts/makestatic.js scripts/makestatic.sh --- node_modules/c9/git.js | 34 +++++++++++++++++-- node_modules/c9/git_test.js | 2 +- node_modules/c9/git_url_parse.js | 36 -------------------- node_modules/vfs-local/localfs.js | 32 +++++++----------- plugins/c9.ide.watcher/watcher.js | 56 ++++++++++++++----------------- plugins/c9.static/build.js | 7 +++- scripts/makestatic.js | 8 ----- 7 files changed, 75 insertions(+), 100 deletions(-) delete mode 100644 node_modules/c9/git_url_parse.js diff --git a/node_modules/c9/git.js b/node_modules/c9/git.js index 307d5402..dcbf0328 100644 --- a/node_modules/c9/git.js +++ b/node_modules/c9/git.js @@ -1,16 +1,44 @@ "use strict"; -require("amd-loader"); - +var Url = require("url"); var Fs = require("fs"); var Path = require("path"); var exec = require("child_process").exec; -exports.parse = require("./git_url_parse"); exports.isValidUrl = function(url) { return !!exports.parse(url); }; +exports.parse = function(url) { + var m = url.match(/^(git)@([\w\.\d\-\_]+)(?:\/|:)([\w\.\d\-\_\/]+)/); + if (m) { + return { + protocol: "ssh:", + auth: m[1], + hostname: m[2], + pathname: m[3] + }; + } + + var parsed = Url.parse(url); + if ( + parsed && + parsed.protocol && + parsed.protocol.match(/^(git|http|https):$/) && + parsed.hostname && + parsed.slashes && + parsed.pathname + ) + return { + protocol: parsed.protocol, + auth: parsed.auth || "", + hostname: parsed.hostname, + pathname: parsed.pathname.replace(/^\/+/, ""), + full: url + }; + else + return null; +}; exports.getHeadRevision = function(path, callback) { exec("git rev-parse HEAD", { diff --git a/node_modules/c9/git_test.js b/node_modules/c9/git_test.js index 04234bfc..fae73a2b 100644 --- a/node_modules/c9/git_test.js +++ b/node_modules/c9/git_test.js @@ -62,7 +62,7 @@ module.exports = { assert.equal(rev.length, 40); next(); - }, + }, "test get head branch": function(next) { git.getHeadBranch(__dirname, function(err, rev) { diff --git a/node_modules/c9/git_url_parse.js b/node_modules/c9/git_url_parse.js deleted file mode 100644 index e701228a..00000000 --- a/node_modules/c9/git_url_parse.js +++ /dev/null @@ -1,36 +0,0 @@ -define(function(require, exports, module) { - "use strict"; - - var Url = require("url"); - - module.exports = function(url) { - var m = url.match(/^(git)@([\w\.\d\-\_]+)(?:\/|:)([\w\.\d\-\_\/]+)/); - if (m) { - return { - protocol: "ssh:", - auth: m[1], - hostname: m[2], - pathname: m[3] - }; - } - - var parsed = Url.parse(url); - if ( - parsed && - parsed.protocol && - parsed.protocol.match(/^(git|http|https):$/) && - parsed.hostname && - parsed.slashes && - parsed.pathname - ) - return { - protocol: parsed.protocol, - auth: parsed.auth || "", - hostname: parsed.hostname, - pathname: parsed.pathname.replace(/^\/+/, ""), - full: url - }; - else - return null; - }; -}); \ No newline at end of file diff --git a/node_modules/vfs-local/localfs.js b/node_modules/vfs-local/localfs.js index f5262624..36d0f3aa 100644 --- a/node_modules/vfs-local/localfs.js +++ b/node_modules/vfs-local/localfs.js @@ -1157,7 +1157,6 @@ module.exports = function setup(fsOptions) { } try { - removeFromList(); fileWatchers[path] = fileWatchers[path] || []; fileWatchers[path].push(_self); @@ -1235,15 +1234,14 @@ module.exports = function setup(fsOptions) { } } - var handleWatchEvent = this.handleWatchEvent = function(event, filename, isVfsWrite) { + function handleWatchEvent(event, filename) { + console.log("watch event", event, filename, path); // it is a temp file if (filename && filename.substr(-1) == "~" && filename.charAt(0) == ".") return; createStatEntry(pathBasename(path), path, function(entry) { - entry.vfsWrite = isVfsWrite || false; - if (entry.err) { event = "delete"; close(); @@ -1294,7 +1292,7 @@ module.exports = function setup(fsOptions) { } var sendToAllListeners = this.sendToAllListeners = function(event, filename, entry, files) { - listeners.forEach(function(fn) { + listeners.forEach(function(fn){ fn(event, filename, entry, files); }); }; @@ -1370,33 +1368,27 @@ module.exports = function setup(fsOptions) { function writeToWatchedFile(path, callback) { if (!fileWatchers[path]) return callback(function(c) { c(); }); - var watchers = fileWatchers[path].slice(); - var parentDir = dirname(path) + "/"; - var dirWatchers = (fileWatchers[parentDir] || []).slice(); - watchers.forEach(function(w) { w.pause(); }); callback(done); - function loop(watchers, path, event, callback) { + function done(callback) { if (!watchers.length) return callback(); - + + // Notify each watcher of changes and reactivate it var watcher = watchers.pop(); - watcher.handleWatchEvent(event, basename(path), true); - + fs.stat(path, function(err, stat) { + if (err || !stat) return; + stat.vfsWrite = true; + watcher.sendToAllListeners("change", basename(path), stat); + }); watcher.resume(function() { - loop(watchers, path, event, callback); + done(callback); }); } - - function done(callback) { - loop(watchers, path, "change", function() { - loop(dirWatchers, parentDir, "directory", callback); - }); - } } function connect(port, options, callback) { diff --git a/plugins/c9.ide.watcher/watcher.js b/plugins/c9.ide.watcher/watcher.js index 48207171..eb02680e 100644 --- a/plugins/c9.ide.watcher/watcher.js +++ b/plugins/c9.ide.watcher/watcher.js @@ -175,39 +175,33 @@ define(function(require, exports, module) { if (WAIT_FOR_SIGNAL) ignore(path, 200); // console.warn("[watchers] ignored event for", path, stat.vfsWrite ? "(was vfsWrite)" : "(was on ignore list)"); - - fireWatcherEvent(".all"); - } else { - fireWatcherEvent(""); - fireWatcherEvent(".all"); + return; } - function fireWatcherEvent(eventSuffix) { - if (event == "error") { - // console.error("[watchers] received error for", path, err, stat); - } - else if (event == "delete") { - fs.unwatch(path, handler); - delete handlers[path]; - // console.log("[watchers] received", event, "event for", path, stat); - emit("delete" + eventSuffix, { path : path }); - } - else if (event == "directory") { - emit("directory" + eventSuffix, { - path: path, - files: files, - stat: stat - }); - } - else { - // console.log("[watchers] received", event, "event for", path, stat); - emit("change" + eventSuffix, { - type: event, // change || rename - filename: filename, - path: path, - stat: stat - }); - } + if (event == "error") { + // console.error("[watchers] received error for", path, err, stat); + } + else if (event == "delete") { + fs.unwatch(path, handler); + delete handlers[path]; + // console.log("[watchers] received", event, "event for", path, stat); + emit("delete", { path : path }); + } + else if (event == "directory") { + emit("directory", { + path: path, + files: files, + stat: stat + }); + } + else { + // console.log("[watchers] received", event, "event for", path, stat); + emit("change", { + type: event, //change || rename + filename: filename, + path: path, + stat: stat + }); } }); } diff --git a/plugins/c9.static/build.js b/plugins/c9.static/build.js index e93d4662..b33a5db0 100644 --- a/plugins/c9.static/build.js +++ b/plugins/c9.static/build.js @@ -206,7 +206,12 @@ function main(options, imports, register) { function sharedModules() { return [ - "lib/architect/architect" + "lib/architect/architect", + "ace/mode/html", + "ace/mode/javascript", + "ace/mode/css", + "ace/mode/c9search", + "ace/multi_select" ]; } diff --git a/scripts/makestatic.js b/scripts/makestatic.js index d640ac78..5c40cd54 100755 --- a/scripts/makestatic.js +++ b/scripts/makestatic.js @@ -20,8 +20,6 @@ if (!module.parent) { .boolean("symlink") .describe("compress", "Compress output files") .boolean("compress") - .describe("react-style", "compile react less CSS") - .boolean("react-style") .describe("dest", "destination folder for the static files") .boolean("help") .describe("help", "Show command line options."); @@ -108,12 +106,6 @@ function main(config, settings, options, callback) { app.services.makestatic.getMounts(options.dest, callback); else if (options.symlink) app.services.makestatic.symlink(options.dest, callback); - else if (options["react-style"]) - app.services["react.style"].compile(function(err, code) { - if (err) return callback(err); - console.log(code); - callback(); - }); else app.services.makestatic.copy(options.dest, callback); }); From c78783c3640c0f0a5bb6db9be8257badcb255a5e Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 27 Feb 2015 20:16:44 +0400 Subject: [PATCH 2/6] add commands for focusing tree and toggling wordwrap --- plugins/c9.ide.ace/ace.js | 11 +++++++++++ plugins/c9.ide.tree/tree.js | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index 2c083321..369c97ee 100644 --- a/plugins/c9.ide.ace/ace.js +++ b/plugins/c9.ide.ace/ace.js @@ -614,6 +614,17 @@ define(function(require, exports, module) { settings.set("user/ace/@fontSize", --currSize < 1 ? 1 : currSize); } }), handle); + + commands.addCommand({ + name: "toggleWordWrap", + bindKey: {win: "", mac: ""}, + exec: function(editor) { + editor.setOption("wrap", editor.getOption("wrap") == "off"); + }, + isAvailable: function(editor) { + return editor && editor.type == "ace"; + } + }, handle); } /***** Preferences *****/ diff --git a/plugins/c9.ide.tree/tree.js b/plugins/c9.ide.tree/tree.js index 08481212..c52eb41f 100644 --- a/plugins/c9.ide.tree/tree.js +++ b/plugins/c9.ide.tree/tree.js @@ -12,18 +12,19 @@ define(function(require, exports, module) { var c9 = imports.c9; var util = imports.util; var Panel = imports.Panel; - var fs = imports.fs; var panels = imports.panels; var settings = imports.settings; - var layout = imports.layout; + var fs = imports.fs; var ui = imports.ui; - var menus = imports.menus; var tabs = imports.tabManager; + var menus = imports.menus; + var layout = imports.layout; var clipboard = imports.clipboard; + var commands = imports.commands; var watcher = imports.watcher; var prefs = imports.preferences; - var fsCache = imports["fs.cache"]; var alert = imports["dialog.alert"].show; + var fsCache = imports["fs.cache"]; var confirmRemove = imports["dialog.fileremove"].show; var confirmRename = imports["dialog.fileoverwrite"].show; var showError = imports["dialog.error"].show; @@ -99,6 +100,15 @@ define(function(require, exports, module) { if (panels.isActive("tree")) tree && tree.resize(); }); + commands.addCommand({ + name: "focusTree", + // shortcut can be modified here + bindKey: { mac: "", win: ""}, + exec: function() { + panels.activate("tree"); + plugin.focus(); + } + }, plugin); // On Ready Resize initially c9.once("ready", function(){ tree && tree.resize(); }); From 6198bbff00dbebdd2bdeecd416394b58717abf5f Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 28 Feb 2015 00:19:09 +0400 Subject: [PATCH 3/6] add shortcuts --- plugins/c9.ide.ace/ace.js | 2 +- plugins/c9.ide.tree/tree.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index 369c97ee..ceff85f9 100644 --- a/plugins/c9.ide.ace/ace.js +++ b/plugins/c9.ide.ace/ace.js @@ -617,7 +617,7 @@ define(function(require, exports, module) { commands.addCommand({ name: "toggleWordWrap", - bindKey: {win: "", mac: ""}, + bindKey: {win: "Ctrl-Q", mac: "Ctrl-W"}, exec: function(editor) { editor.setOption("wrap", editor.getOption("wrap") == "off"); }, diff --git a/plugins/c9.ide.tree/tree.js b/plugins/c9.ide.tree/tree.js index c52eb41f..1f7ae34f 100644 --- a/plugins/c9.ide.tree/tree.js +++ b/plugins/c9.ide.tree/tree.js @@ -103,7 +103,7 @@ define(function(require, exports, module) { commands.addCommand({ name: "focusTree", // shortcut can be modified here - bindKey: { mac: "", win: ""}, + bindKey: { mac: "Shift-Esc", win: "Shift-Esc"}, exec: function() { panels.activate("tree"); plugin.focus(); From 6e8a74e18f9c4333049f332647e9642e00dac573 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 28 Feb 2015 01:20:42 +0400 Subject: [PATCH 4/6] fixes for emacs mode --- .../commands/incremental_search_commands.js | 77 +++++++------------ .../ace/lib/ace/incremental_search.js | 34 ++++---- node_modules/ace/lib/ace/keyboard/emacs.js | 4 +- .../ace/lib/ace/keyboard/hash_handler.js | 12 ++- package.json | 2 +- 5 files changed, 59 insertions(+), 70 deletions(-) diff --git a/node_modules/ace/lib/ace/commands/incremental_search_commands.js b/node_modules/ace/lib/ace/commands/incremental_search_commands.js index a0a0fe5f..59083a85 100644 --- a/node_modules/ace/lib/ace/commands/incremental_search_commands.js +++ b/node_modules/ace/lib/ace/commands/incremental_search_commands.js @@ -69,18 +69,14 @@ exports.iSearchCommands = [{ bindKey: {win: "Ctrl-F", mac: "Command-F"}, exec: function(iSearch) { iSearch.cancelSearch(true); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: "searchForward", bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"}, exec: function(iSearch, options) { options.useCurrentOrPrevSearch = true; iSearch.next(options); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: "searchBackward", bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"}, @@ -88,42 +84,30 @@ exports.iSearchCommands = [{ options.useCurrentOrPrevSearch = true; options.backwards = true; iSearch.next(options); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: "extendSearchTerm", exec: function(iSearch, string) { iSearch.addString(string); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: "extendSearchTermSpace", bindKey: "space", - exec: function(iSearch) { iSearch.addString(' '); }, - readOnly: true, - isIncrementalSearchCommand: true + exec: function(iSearch) { iSearch.addString(' '); } }, { name: "shrinkSearchTerm", bindKey: "backspace", exec: function(iSearch) { iSearch.removeChar(); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: 'confirmSearch', bindKey: 'return', - exec: function(iSearch) { iSearch.deactivate(); }, - readOnly: true, - isIncrementalSearchCommand: true + exec: function(iSearch) { iSearch.deactivate(); } }, { name: 'cancelSearch', bindKey: 'esc|Ctrl-G', - exec: function(iSearch) { iSearch.deactivate(true); }, - readOnly: true, - isIncrementalSearchCommand: true + exec: function(iSearch) { iSearch.deactivate(true); } }, { name: 'occurisearch', bindKey: 'Ctrl-O', @@ -131,9 +115,7 @@ exports.iSearchCommands = [{ var options = oop.mixin({}, iSearch.$options); iSearch.deactivate(); occurStartCommand.exec(iSearch.$editor, options); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: "yankNextWord", bindKey: "Ctrl-w", @@ -142,9 +124,7 @@ exports.iSearchCommands = [{ range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }), string = ed.session.getTextRange(range); iSearch.addString(string); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: "yankNextChar", bindKey: "Ctrl-Alt-y", @@ -153,15 +133,11 @@ exports.iSearchCommands = [{ range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }), string = ed.session.getTextRange(range); iSearch.addString(string); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: 'recenterTopBottom', bindKey: 'Ctrl-l', - exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); }, - readOnly: true, - isIncrementalSearchCommand: true + exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); } }, { name: 'selectAllMatches', bindKey: 'Ctrl-space', @@ -173,18 +149,19 @@ exports.iSearchCommands = [{ return ranges.concat(ea ? ea : []); }, []) : []; iSearch.deactivate(false); ranges.forEach(ed.selection.addRange.bind(ed.selection)); - }, - readOnly: true, - isIncrementalSearchCommand: true + } }, { name: 'searchAsRegExp', bindKey: 'Alt-r', exec: function(iSearch) { iSearch.convertNeedleToRegExp(); - }, - readOnly: true, - isIncrementalSearchCommand: true -}]; + } +}].map(function(cmd) { + cmd.readOnly = true; + cmd.isIncrementalSearchCommand = true; + cmd.scrollIntoView = "animate-cursor"; + return cmd; +}); function IncrementalSearchKeyboardHandler(iSearch) { this.$iSearch = iSearch; @@ -192,7 +169,7 @@ function IncrementalSearchKeyboardHandler(iSearch) { oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); -;(function() { +(function() { this.attach = function(editor) { var iSearch = this.$iSearch; @@ -201,15 +178,19 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); if (!e.command.isIncrementalSearchCommand) return undefined; e.stopPropagation(); e.preventDefault(); - return e.command.exec(iSearch, e.args || {}); + var scrollTop = editor.session.getScrollTop(); + var result = e.command.exec(iSearch, e.args || {}); + editor.renderer.scrollCursorIntoView(null, 0.5); + editor.renderer.animateScrolling(scrollTop); + return result; }); - } + }; this.detach = function(editor) { if (!this.$commandExecHandler) return; editor.commands.removeEventListener('exec', this.$commandExecHandler); delete this.$commandExecHandler; - } + }; var handleKeyboard$super = this.handleKeyboard; this.handleKeyboard = function(data, hashId, key, keyCode) { @@ -222,7 +203,7 @@ oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); if (extendCmd) { return {command: extendCmd, args: key}; } } return {command: "null", passEvent: hashId == 0 || hashId == 4}; - } + }; }).call(IncrementalSearchKeyboardHandler.prototype); diff --git a/node_modules/ace/lib/ace/incremental_search.js b/node_modules/ace/lib/ace/incremental_search.js index a64e1857..e4c1bdf8 100644 --- a/node_modules/ace/lib/ace/incremental_search.js +++ b/node_modules/ace/lib/ace/incremental_search.js @@ -105,7 +105,7 @@ function objectToRegExp(obj) { this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); this.selectionFix(ed); this.statusMessage(true); - } + }; this.deactivate = function(reset) { this.cancelSearch(reset); @@ -117,7 +117,7 @@ function objectToRegExp(obj) { } ed.onPaste = this.$originalEditorOnPaste; this.message(''); - } + }; this.selectionFix = function(editor) { // Fix selection bug: When clicked inside the editor @@ -128,7 +128,7 @@ function objectToRegExp(obj) { if (editor.selection.isEmpty() && !editor.session.$emacsMark) { editor.clearSelection(); } - } + }; this.highlight = function(regexp) { var sess = this.$editor.session, @@ -136,7 +136,7 @@ function objectToRegExp(obj) { new SearchHighlight(null, "ace_isearch-result", "text")); hl.setRegexp(regexp); sess._emit("changeBackMarker"); // force highlight layer redraw - } + }; this.cancelSearch = function(reset) { var e = this.$editor; @@ -150,7 +150,7 @@ function objectToRegExp(obj) { } this.highlight(null); return Range.fromPoints(this.$currentPos, this.$currentPos); - } + }; this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) { if (!this.$editor) return null; @@ -163,7 +163,7 @@ function objectToRegExp(obj) { if (options.needle.length === 0) { this.statusMessage(true); return this.cancelSearch(true); - }; + } // try to find the next occurence and enable highlighting marker options.start = this.$currentPos; @@ -176,13 +176,13 @@ function objectToRegExp(obj) { this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end)); if (moveToNext) this.$currentPos = found.end; // highlight after cursor move, so selection works properly - this.highlight(options.re) + this.highlight(options.re); } this.statusMessage(found); return found; - } + }; this.addString = function(s) { return this.highlightAndFindWithNeedle(false, function(needle) { @@ -192,7 +192,7 @@ function objectToRegExp(obj) { reObj.expression += s; return objectToRegExp(reObj); }); - } + }; this.removeChar = function(c) { return this.highlightAndFindWithNeedle(false, function(needle) { @@ -202,7 +202,7 @@ function objectToRegExp(obj) { reObj.expression = reObj.expression.substring(0, reObj.expression.length-1); return objectToRegExp(reObj); }); - } + }; this.next = function(options) { // try to find the next occurence of whatever we have searched for @@ -215,29 +215,29 @@ function objectToRegExp(obj) { return options.useCurrentOrPrevSearch && needle.length === 0 ? this.$prevNeedle || '' : needle; }); - } + }; this.onMouseDown = function(evt) { // when mouse interaction happens then we quit incremental search this.deactivate(); return true; - } + }; this.onPaste = function(text) { this.addString(text); - } + }; this.convertNeedleToRegExp = function() { return this.highlightAndFindWithNeedle(false, function(needle) { return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig'); }); - } + }; this.convertNeedleToString = function() { return this.highlightAndFindWithNeedle(false, function(needle) { return isRegExp(needle) ? regExpToObject(needle).expression : needle; }); - } + }; this.statusMessage = function(found) { var options = this.$options, msg = ''; @@ -245,7 +245,7 @@ function objectToRegExp(obj) { msg += 'isearch: ' + options.needle; msg += found ? '' : ' (not found)'; this.message(msg); - } + }; this.message = function(msg) { if (this.$editor.showCommandLine) { @@ -254,7 +254,7 @@ function objectToRegExp(obj) { } else { console.log(msg); } - } + }; }).call(IncrementalSearch.prototype); diff --git a/node_modules/ace/lib/ace/keyboard/emacs.js b/node_modules/ace/lib/ace/keyboard/emacs.js index 945eddf3..8cecad1b 100644 --- a/node_modules/ace/lib/ace/keyboard/emacs.js +++ b/node_modules/ace/lib/ace/keyboard/emacs.js @@ -428,7 +428,7 @@ exports.emacsKeys = { "M-;": "togglecomment", "C-/|C-x u|S-C--|C-z": "undo", - "S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo? + "S-C-/|S-C-x u|C--|S-C-z": "redo", // infinite undo? // vertical editing "C-x r": "selectRectangularRegion", "M-x": {command: "focusCommandLine", args: "M-x "} @@ -483,7 +483,7 @@ exports.handler.addCommands({ // different. Deactivate the mark when setMark is run with active // mark if (transientMarkModeActive && (mark || !hasNoSelection)) { - if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)}) + if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)}); else editor.clearSelection(); if (mark) editor.pushEmacsMark(null); return; diff --git a/node_modules/ace/lib/ace/keyboard/hash_handler.js b/node_modules/ace/lib/ace/keyboard/hash_handler.js index 7a0396fc..a7dc1a93 100644 --- a/node_modules/ace/lib/ace/keyboard/hash_handler.js +++ b/node_modules/ace/lib/ace/keyboard/hash_handler.js @@ -236,10 +236,18 @@ MultiHashHandler.prototype = HashHandler.prototype; } } - if (data.$keyChain && keyCode > 0) - data.$keyChain = ""; + if (data.$keyChain) { + if ((!hashId || hashId == 4) && keyString.length == 1) + data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input + else if (hashId == -1 || keyCode > 0) + data.$keyChain = ""; // reset keyChain + } return {command: command}; }; + + this.getStatusText = function(editor, data) { + return data.$keyChain || ""; + }; }).call(HashHandler.prototype); diff --git a/package.json b/package.json index 1b4bb5c9..7c41cbd1 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "c9.ide.run.debug": "#36245ee2aa", "c9.ide.ace.emmet": "#e5f1a92ac3", "c9.ide.ace.gotoline": "#4d1a93172c", - "c9.ide.ace.keymaps": "#2477fd8ac6", + "c9.ide.ace.keymaps": "#6c4bb65b1f", "c9.ide.ace.repl": "#ada99852fa", "c9.ide.ace.split": "#0ae0151c78", "c9.ide.ace.statusbar": "#d7b45bb7c3", From b58993dca63a0676a0fd974da11a0a04d53c2c53 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 28 Feb 2015 01:49:35 +0400 Subject: [PATCH 5/6] fix issue with windows 8 language switching shortcut --- plugins/c9.ide.keys/commands.js | 1 - plugins/c9.ide.terminal/aceterm/input.js | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/c9.ide.keys/commands.js b/plugins/c9.ide.keys/commands.js index 0815c7df..a8f88a09 100644 --- a/plugins/c9.ide.keys/commands.js +++ b/plugins/c9.ide.keys/commands.js @@ -326,7 +326,6 @@ define(function(require, exports, module) { commands.find, commands.openterminal, commands.navigate, - commands.navigate_altkey, commands.searchinfiles, commands.close_term_pane, commands.closeallbutme, diff --git a/plugins/c9.ide.terminal/aceterm/input.js b/plugins/c9.ide.terminal/aceterm/input.js index aa56ac39..d9bdc17a 100644 --- a/plugins/c9.ide.terminal/aceterm/input.js +++ b/plugins/c9.ide.terminal/aceterm/input.js @@ -1,4 +1,5 @@ define(function(require, exports, module) { + var isWindows = require("ace/lib/useragent").isWindows; module.exports = function initInput(ace) { var HashHandler = require("ace/keyboard/hash_handler").HashHandler; var KEY_MODS = require("ace/lib/keys").KEY_MODS; @@ -156,6 +157,9 @@ define(function(require, exports, module) { passEvent: !hashId || hashId === KEY_MODS.shift || ( // on mac key combos without ctrl or cmd trigger textinput specialKeys.platform === "mac" && !(hashId & (KEY_MODS.ctrl | KEY_MODS.cmd)) + ) || ( + // on windows 8+ calling preventDefault on win+space breaks textinput + specialKeys.platform === "win" && hashId == KEY_MODS.cmd && (keyCode == 32 || keyCode == -1) ) }; }; From 469d58b34ea4dac3b8f3927db64e1403f2bfa4a1 Mon Sep 17 00:00:00 2001 From: nightwing Date: Tue, 3 Mar 2015 21:08:52 +0400 Subject: [PATCH 6/6] display real ip instead of 0.0.0.0 --- configs/standalone.js | 5 +++-- .../connect/connect-plugin.js | 21 ++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/configs/standalone.js b/configs/standalone.js index 0b736075..22a63d77 100644 --- a/configs/standalone.js +++ b/configs/standalone.js @@ -93,7 +93,7 @@ module.exports = function(config, optimist) { if (!/:/.test(argv.auth) && !isLocalhost) { console.log("Authentication is required when not running on localhost.\nPlease use -a user:pass or --listen localhost to listen locally."); console.log("switching to localhost"); - host == "127.0.0.1"; + host = config.host = "127.0.0.1"; } var auth = (argv.auth || ":").split(":"); @@ -102,7 +102,8 @@ module.exports = function(config, optimist) { packagePath: "connect-architect/connect", port: port, host: host, - websocket: true + websocket: true, + showRealIP: !config.mode }, { packagePath: "connect-architect/connect.basicauth", diff --git a/node_modules/connect-architect/connect/connect-plugin.js b/node_modules/connect-architect/connect/connect-plugin.js index 6e646868..133df8d6 100644 --- a/node_modules/connect-architect/connect/connect-plugin.js +++ b/node_modules/connect-architect/connect/connect-plugin.js @@ -127,7 +127,10 @@ module.exports = function startup(options, imports, register) { if (err) return register(err); - console.log("Connect server listening at " + proto + "://" + host + ":" + port); + console.log("Connect server listening at " + proto + "://" + + (host == "0.0.0.0" && options.showRealIP + ? getLocalIPs()[0] + : host) + ":" + port); register(null, { "onDestruct": function(callback) { @@ -210,6 +213,22 @@ module.exports = function startup(options, imports, register) { return handle; } + + function getLocalIPs() { + var os = require("os"); + + var interfaces = os.networkInterfaces ? os.networkInterfaces() : {}; + var addresses = []; + for (var k in interfaces) { + for (var k2 in interfaces[k]) { + var address = interfaces[k][k2]; + if (address.family === "IPv4" && !address.internal) { + addresses.push(address.address); + } + } + } + return addresses; + } }; function merge(objects) {