Merge pull request +7139 from c9/fix/various

Fix several small issues
pull/85/head
Ruben Daniels 2015-05-03 09:53:57 -07:00
commit 0f2745a33c
5 zmienionych plików z 27 dodań i 17 usunięć

Wyświetl plik

@ -423,6 +423,12 @@ exports.commands = [{
exec: function() {}, exec: function() {},
passEvent: true, passEvent: true,
readOnly: true readOnly: true
}, {
name: "copy",
exec: function(editor) {
// placeholder for replay macro
},
readOnly: true
}, },
// commands disabled in readOnly mode // commands disabled in readOnly mode
@ -439,6 +445,12 @@ exports.commands = [{
}, },
scrollIntoView: "cursor", scrollIntoView: "cursor",
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, {
name: "paste",
exec: function(editor, text) {
editor.$handlePaste(text);
},
scrollIntoView: "cursor"
}, { }, {
name: "removeline", name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"), bindKey: bindKey("Ctrl-D", "Command-D"),

7
node_modules/ace/lib/ace/editor.js wygenerowano vendored
Wyświetl plik

@ -903,10 +903,10 @@ var Editor = function(renderer, session) {
* *
**/ **/
this.onPaste = function(text) { this.onPaste = function(text) {
// todo this should change when paste becomes a command this.commands.exec("paste", this, text);
if (this.$readOnly) };
return;
this.$handlePaste = function(text) {
var e = {text: text}; var e = {text: text};
this._signal("paste", e); this._signal("paste", e);
text = e.text; text = e.text;
@ -927,7 +927,6 @@ var Editor = function(renderer, session) {
this.session.insert(range.start, lines[i]); this.session.insert(range.start, lines[i]);
} }
} }
this.renderer.scrollCursorIntoView();
}; };
this.execCommand = function(command, args) { this.execCommand = function(command, args) {

Wyświetl plik

@ -60,7 +60,7 @@
"c9.ide.language.javascript.tern": "#7aab8b0b6a", "c9.ide.language.javascript.tern": "#7aab8b0b6a",
"c9.ide.language.javascript.infer": "#cfec494a3c", "c9.ide.language.javascript.infer": "#cfec494a3c",
"c9.ide.language.jsonalyzer": "#21b64e5820", "c9.ide.language.jsonalyzer": "#21b64e5820",
"c9.ide.collab": "#edef363853", "c9.ide.collab": "#0b8d47b8b7",
"c9.ide.local": "#2bfd7ff051", "c9.ide.local": "#2bfd7ff051",
"c9.ide.find": "#6cc6d3379d", "c9.ide.find": "#6cc6d3379d",
"c9.ide.find.infiles": "#72582de3cd", "c9.ide.find.infiles": "#72582de3cd",
@ -81,9 +81,9 @@
"c9.ide.fontawesome": "#781602c5d8", "c9.ide.fontawesome": "#781602c5d8",
"c9.ide.format": "#f51451ac57", "c9.ide.format": "#f51451ac57",
"c9.ide.help.support": "#60e88f5680", "c9.ide.help.support": "#60e88f5680",
"c9.ide.imgeditor": "#08bbc53578", "c9.ide.imgeditor": "#ed89162aa7",
"c9.ide.immediate": "#6845a93705", "c9.ide.immediate": "#6845a93705",
"c9.ide.installer": "#6f8f44c9e1", "c9.ide.installer": "#91b3cc12f8",
"c9.ide.mount": "#32e79866ee", "c9.ide.mount": "#32e79866ee",
"c9.ide.navigate": "#64156c7f4a", "c9.ide.navigate": "#64156c7f4a",
"c9.ide.newresource": "#f1f0624768", "c9.ide.newresource": "#f1f0624768",

Wyświetl plik

@ -10,7 +10,7 @@ define(function(require, module, exports) {
var plugin = new Plugin("Ajax.org", main.consumes); var plugin = new Plugin("Ajax.org", main.consumes);
var emit = plugin.getEmitter(); var emit = plugin.getEmitter();
var position = -1, mark = null, stack = []; var position = -1, mark = -2, stack = [];
if (options) if (options)
setState(options); setState(options);
@ -55,7 +55,7 @@ define(function(require, module, exports) {
position = 0; position = 0;
if (mark < position) if (mark < position)
mark = -1; mark = -2;
emit("change"); emit("change");
} }
@ -64,7 +64,7 @@ define(function(require, module, exports) {
stack = stack.slice(0, position + 1); stack = stack.slice(0, position + 1);
if (mark > position) if (mark > position)
mark = -1; mark = -2;
if (!noEvent) if (!noEvent)
emit("change"); emit("change");
@ -91,7 +91,7 @@ define(function(require, module, exports) {
position--; position--;
if (mark == idx) if (mark == idx)
mark = -1; mark = -2;
else if (mark > idx) else if (mark > idx)
mark--; mark--;
@ -105,8 +105,7 @@ define(function(require, module, exports) {
} }
function isAtBookmark(){ function isAtBookmark(){
return mark !== null && mark == position return mark == position;
|| mark === null && position == -1;
} }
function item(idx) { function item(idx) {
@ -133,7 +132,7 @@ define(function(require, module, exports) {
return; // guard against broken stack return; // guard against broken stack
stack = state.stack; stack = state.stack;
emit("change"); //If you remove this again, change the test emit("change"); // If you remove this again, change the test
} }
function findItem(compressedItem) { function findItem(compressedItem) {
@ -146,7 +145,7 @@ define(function(require, module, exports) {
position = -1; position = -1;
stack = []; stack = [];
mark = null; mark = -1;
emit("change"); emit("change");
} }

Wyświetl plik

@ -133,7 +133,7 @@ require(["lib/architect/architect", "lib/chai/chai"], function (architect, chai)
expect(undo.position).to.equal(4); expect(undo.position).to.equal(4);
undo.undo(); check++; undo.undo(); check++;
undo.setState({ position : -1, stack : stack, mark : null }); check++; undo.setState({ position : -1, stack : stack, mark : -1 }); check++;
expect(undo.isAtBookmark()).to.equal(true); expect(undo.isAtBookmark()).to.equal(true);
expect(data).to.deep.equal(["a", "q"]); expect(data).to.deep.equal(["a", "q"]);
checkCount(); checkCount();