Skip to content

Commit

Permalink
[r mode] Fix bad post-'else if' indentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtaran-google authored and marijnh committed Dec 11, 2013
1 parent efe9509 commit 5deae0c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mode/r/r.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ CodeMirror.defineMode("r", function(config) {
var word = stream.current();
if (atoms.propertyIsEnumerable(word)) return "atom";
if (keywords.propertyIsEnumerable(word)) {
if (blockkeywords.propertyIsEnumerable(word)) curPunc = "block";
// Block keywords start new blocks, except 'else if', which only starts
// one new block for the 'if', no block for the 'else'.
if (blockkeywords.propertyIsEnumerable(word) &&
!stream.match(/\s*if(\s+|$)/, false))
curPunc = "block";
return "keyword";
}
if (builtins.propertyIsEnumerable(word)) return "builtin";
Expand Down

0 comments on commit 5deae0c

Please sign in to comment.