emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master cef7731 016/110: Handle open-curlies after newline


From: Dmitry Gutov
Subject: [elpa] master cef7731 016/110: Handle open-curlies after newline
Date: Thu, 23 Jun 2016 01:12:53 +0000 (UTC)

branch: master
commit cef77312532002b676269a64a6b6a5a02c98c0f3
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Handle open-curlies after newline
    
    Fixes #277
---
 js2-old-indent.el |    2 +-
 tests/indent.el   |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/js2-old-indent.el b/js2-old-indent.el
index bb605bc..64a874e 100644
--- a/js2-old-indent.el
+++ b/js2-old-indent.el
@@ -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)
diff --git a/tests/indent.el b/tests/indent.el
index d0f149d..a0afeed 100644
--- a/tests/indent.el
+++ b/tests/indent.el
@@ -148,3 +148,24 @@
   |      * 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]