Skip to content

Commit

Permalink
Allow indent methods to return CodeMirror.Pass to indicate no support
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Jun 21, 2012
1 parent ec53be2 commit c497aa6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -1414,11 +1414,14 @@ var CodeMirror = (function() {

var line = getLine(n), curSpace = line.indentation(options.tabSize),
curSpaceString = line.text.match(/^\s*/)[0], indentation;
if (how == "smart") {
indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);
if (indentation == Pass) how = "prev";
}
if (how == "prev") {
if (n) indentation = getLine(n-1).indentation(options.tabSize);
else indentation = 0;
}
else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length), line.text);
else if (how == "add") indentation = curSpace + options.indentUnit;
else if (how == "subtract") indentation = curSpace - options.indentUnit;
indentation = Math.max(0, indentation);
Expand Down

0 comments on commit c497aa6

Please sign in to comment.