Permalink
Browse files

[r mode] Fix bad post-'else if' indentation.

  • Loading branch information...
1 parent efe9509 commit 5deae0ca3fdb3085841fca61eb9b5d283d6fda88 @mtaran-google mtaran-google committed with marijnh Dec 9, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 mode/r/r.js
View
@@ -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";

0 comments on commit 5deae0c

Please sign in to comment.