diff --git a/lib/ace/mode/matching_brace_outdent.js b/lib/ace/mode/matching_brace_outdent.js index abdd7ed4..07f4829e 100644 --- a/lib/ace/mode/matching_brace_outdent.js +++ b/lib/ace/mode/matching_brace_outdent.js @@ -60,12 +60,7 @@ var MatchingBraceOutdent = function() {}; }; this.$getIndent = function(line) { - var match = line.match(/^(\s+)/); - if (match) { - return match[1]; - } - - return ""; + return line.match(/^\s*/)[0]; }; }).call(MatchingBraceOutdent.prototype); diff --git a/lib/ace/mode/text.js b/lib/ace/mode/text.js index edef0204..02cb466e 100644 --- a/lib/ace/mode/text.js +++ b/lib/ace/mode/text.js @@ -116,12 +116,7 @@ var Mode = function() { }; this.$getIndent = function(line) { - var match = line.match(/^(\s+)/); - if (match) { - return match[1]; - } - - return ""; + return line.match(/^\s*/)[0]; }; this.createWorker = function(session) { diff --git a/lib/ace/mode/xquery.js b/lib/ace/mode/xquery.js index 7dfdd5cf..e06478a4 100644 --- a/lib/ace/mode/xquery.js +++ b/lib/ace/mode/xquery.js @@ -50,22 +50,22 @@ oop.inherits(Mode, TextMode); (function() { this.getNextLineIndent = function(state, line, tab) { - var indent = this.$getIndent(line); - var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/); - if (match) - indent += tab; + var indent = this.$getIndent(line); + var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/); + if (match) + indent += tab; return indent; }; this.checkOutdent = function(state, line, input) { - if (! /^\s+$/.test(line)) + if (! /^\s+$/.test(line)) return false; return /^\s*[\}\)]/.test(input); }; this.autoOutdent = function(state, doc, row) { - var line = doc.getLine(row); + var line = doc.getLine(row); var match = line.match(/^(\s*[\}\)])/); if (!match) return 0; @@ -79,15 +79,6 @@ oop.inherits(Mode, TextMode); 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) { var i, line; var outdent = true;