]> code.delx.au - gnu-emacs-elpa/commitdiff
Handle open-curlies after newline
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 27 Oct 2015 11:56:25 +0000 (13:56 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 27 Oct 2015 11:56:25 +0000 (13:56 +0200)
Fixes #277

js2-old-indent.el
tests/indent.el

index bb605bcbc95ab75c864a06acd7f3dd5c427ec919..64a874e38c2875107fb03885b5321d109b9c1264 100644 (file)
@@ -440,7 +440,7 @@ indentation is aligned to that column."
         (goto-char bracket)
         (cond
          ((looking-at "[({[][ \t]*\\(/[/*]\\|$\\)")
-          (when (save-excursion (skip-chars-backward " \t)")
+          (when (save-excursion (skip-chars-backward " \t\n)")
                                 (looking-at ")"))
             (backward-list))
           (back-to-indentation)
index d0f149d9720135deacbceaf0de62da66d3055b48..a0afeed49563b5cdab9b61299621e704c6947898 100644 (file)
   |      * 2;
   |  }
   |}")
+
+(js2-deftest-indent case-inside-switch
+  "switch(true) {
+  |case 'true':
+  |  return 1;
+  |}")
+
+(js2-deftest-indent case-inside-switch-with-extra-indent
+  "switch(true) {
+  |  case 'true':
+  |    return 1;
+  |}"
+  :bind ((js2-indent-switch-body t)))
+
+(js2-deftest-indent case-inside-switch-with-extra-indent-curly-after-newline
+  "switch(true)
+  |{
+  |  case 'true':
+  |    return 1;
+  |}"
+  :bind ((js2-indent-switch-body t)))