Skip to content

Commit

Permalink
fix wrongly initialized clike-mode top-level context
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Mar 15, 2011
1 parent 06540e3 commit 6dc5d31
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,8 @@ var CodeMirror = (function() {
}
else if (how == "smart") indentation = mode.indent(state, line.text.slice(curSpaceString.length));
else if (how == "add") indentation = curSpace + options.indentUnit;
else if (how == "subtract") indentation = Math.max(0, curSpace - options.indentUnit);
else if (how == "subtract") indentation = curSpace - options.indentUnit;
indentation = Math.max(0, indentation);
var diff = indentation - curSpace;

if (!diff) {
Expand Down
2 changes: 1 addition & 1 deletion mode/clike/clike.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
startState: function(basecolumn) {
return {
tokenize: tokenBase,
context: new Context((basecolumn || 0) - indentUnit, "top", false),
context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
indented: 0,
startOfLine: true
};
Expand Down

0 comments on commit 6dc5d31

Please sign in to comment.