Merge branch 'master' of https://github.com/ajaxorg/ace
This commit is contained in:
commit
44907e90f4
15 changed files with 204 additions and 257 deletions
|
|
@ -426,7 +426,7 @@ var Editor =function(renderer, doc) {
|
|||
this.bgTokenizer.getState(cursor.row, function (lineState) {
|
||||
var shouldOutdent = _self.mode.checkOutdent(lineState, _self.doc.getLine(cursor.row), text);
|
||||
var line = _self.doc.getLine(cursor.row),
|
||||
lineIndent = _self.mode.getNextLineIndent(lineState, line, _self.doc.getTabString());
|
||||
lineIndent = _self.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), _self.doc.getTabString());
|
||||
var end = _self.doc.insert(cursor, text);
|
||||
|
||||
/* TODO: This shortcut is somehow broken
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var core = require("pilot/core");
|
||||
var useragent = require("pilot/useragent");
|
||||
var event = require("pilot/event");
|
||||
var default_mac = require("ace/conf/keybindings/default_mac").bindings;
|
||||
var default_win = require("ace/conf/keybindings/default_win").bindings;
|
||||
|
|
@ -50,7 +50,7 @@ var KeyBinding = function(element, editor, config) {
|
|||
var _self = this;
|
||||
event.addKeyListener(element, function(e) {
|
||||
// opera on mac swaps ctrl and meta keys
|
||||
if (core.isOpera && core.isMac)
|
||||
if (useragent.isOpera && useragent.isMac)
|
||||
var hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
|
||||
| (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
|
||||
else
|
||||
|
|
@ -145,7 +145,7 @@ var KeyBinding = function(element, editor, config) {
|
|||
}
|
||||
|
||||
this.setConfig = function(config) {
|
||||
this.config = config || (core.isMac
|
||||
this.config = config || (useragent.isMac
|
||||
? default_mac
|
||||
: default_win);
|
||||
if (typeof this.config.reverse == "undefined")
|
||||
|
|
|
|||
|
|
@ -133,6 +133,15 @@ var Test = {
|
|||
editor.indent();
|
||||
assert.equal(["a12345", " b12345", "c12345"].join("\n"), doc.toString());
|
||||
},
|
||||
|
||||
"test: no auto indent if cursor is before the {" : function() {
|
||||
var doc = new Document("{", new JavaScriptMode());
|
||||
var editor = new Editor(new MockRenderer(), doc);
|
||||
|
||||
editor.moveCursorTo(0, 0);
|
||||
editor.onTextInput("\n");
|
||||
assert.equal(["", "{"].join("\n"), doc.toString());
|
||||
},
|
||||
|
||||
"test: outdent block" : function() {
|
||||
var doc = new Document([" a12345", " b12345", " c12345"].join("\n"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue