cleanup $getIndent

This commit is contained in:
nightwing 2013-03-12 16:46:30 +04:00
commit 03b9591313
3 changed files with 8 additions and 27 deletions

View file

@ -60,12 +60,7 @@ var MatchingBraceOutdent = function() {};
}; };
this.$getIndent = function(line) { this.$getIndent = function(line) {
var match = line.match(/^(\s+)/); return line.match(/^\s*/)[0];
if (match) {
return match[1];
}
return "";
}; };
}).call(MatchingBraceOutdent.prototype); }).call(MatchingBraceOutdent.prototype);

View file

@ -116,12 +116,7 @@ var Mode = function() {
}; };
this.$getIndent = function(line) { this.$getIndent = function(line) {
var match = line.match(/^(\s+)/); return line.match(/^\s*/)[0];
if (match) {
return match[1];
}
return "";
}; };
this.createWorker = function(session) { this.createWorker = function(session) {

View file

@ -50,22 +50,22 @@ oop.inherits(Mode, TextMode);
(function() { (function() {
this.getNextLineIndent = function(state, line, tab) { this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line); var indent = this.$getIndent(line);
var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/); var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
if (match) if (match)
indent += tab; indent += tab;
return indent; return indent;
}; };
this.checkOutdent = function(state, line, input) { this.checkOutdent = function(state, line, input) {
if (! /^\s+$/.test(line)) if (! /^\s+$/.test(line))
return false; return false;
return /^\s*[\}\)]/.test(input); return /^\s*[\}\)]/.test(input);
}; };
this.autoOutdent = function(state, doc, row) { this.autoOutdent = function(state, doc, row) {
var line = doc.getLine(row); var line = doc.getLine(row);
var match = line.match(/^(\s*[\}\)])/); var match = line.match(/^(\s*[\}\)])/);
if (!match) return 0; if (!match) return 0;
@ -79,15 +79,6 @@ oop.inherits(Mode, TextMode);
doc.replace(new Range(row, 0, row, column-1), indent); doc.replace(new Range(row, 0, row, column-1), indent);
}; };
this.$getIndent = function(line) {
var match = line.match(/^(\s+)/);
if (match) {
return match[1];
}
return "";
};
this.toggleCommentLines = function(state, doc, startRow, endRow) { this.toggleCommentLines = function(state, doc, startRow, endRow) {
var i, line; var i, line;
var outdent = true; var outdent = true;