This commit is contained in:
Fabian Jakobs 2011-07-22 13:19:21 +02:00
commit eae645cb00
2 changed files with 11 additions and 7 deletions

View file

@ -96,7 +96,7 @@ oop.inherits(Mode, TextMode);
}
if (state == "start") {
var match = line.match(/^.*[\{\(\[]\s*$/);
var match = line.match(/^.*[\{\(\[\:]\s*$/);
if (match) {
indent += tab;
}

View file

@ -75,12 +75,12 @@ module.exports = {
},
"test: toggle comment lines twice should return the original text" : function() {
var session = new EditSession([" abc", "cde", "fg"]);
this.mode.toggleCommentLines("start", session, 0, 2);
this.mode.toggleCommentLines("start", session, 0, 2);
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
},
var session = new EditSession([" abc", "cde", "fg"]);
this.mode.toggleCommentLines("start", session, 0, 2);
this.mode.toggleCommentLines("start", session, 0, 2);
assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
},
"test: toggle comment on multiple lines with one commented line prepend '//' to each line" : function() {
var session = new EditSession(["// abc", "//cde", "fg"]);
@ -99,6 +99,10 @@ module.exports = {
"test: auto indent after opening brace" : function() {
assert.equal(" ", this.mode.getNextLineIndent("start", "if () {", " "));
},
"test: auto indent after case" : function() {
assert.equal(" ", this.mode.getNextLineIndent("start", "case 'juhu':", " "));
},
"test: no auto indent after opening brace in multi line comment" : function() {
assert.equal("", this.mode.getNextLineIndent("start", "/*if () {", " "));