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 f5c2e015..0914a3ea 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", diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index 2c083321..ceff85f9 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: "Ctrl-Q", mac: "Ctrl-W"}, + 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.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) ) }; }; diff --git a/plugins/c9.ide.tree/tree.js b/plugins/c9.ide.tree/tree.js index 08481212..1f7ae34f 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: "Shift-Esc", win: "Shift-Esc"}, + exec: function() { + panels.activate("tree"); + plugin.focus(); + } + }, plugin); // On Ready Resize initially c9.once("ready", function(){ tree && tree.resize(); });