Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 5deae0ca3fdb3085841fca61eb9b5d283d6fda88 1 parent efe9509
@mtaran-google mtaran-google authored marijnh committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 mode/r/r.js
View
6 mode/r/r.js
@@ -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.
Something went wrong with that request. Please try again.