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

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

[elpa] externals/phps-mode e249124 152/405: Prevent negative indent


From: Stefan Monnier
Subject: [elpa] externals/phps-mode e249124 152/405: Prevent negative indent
Date: Sat, 13 Jul 2019 10:00:03 -0400 (EDT)

branch: externals/phps-mode
commit e249124491c3c910c30a9ce61fcb369762cb5e80
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Prevent negative indent
---
 phps-mode-functions.el      | 3 ++-
 phps-mode-test-functions.el | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 290d643..fb3f594 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -87,7 +87,8 @@
                     (setq nesting-end (+ round-bracket-level 
square-bracket-level curly-bracket-level alternative-control-structure-level 
inline-control-structure-level))
 
                     ;; Is line ending indentation lesser than line beginning 
indentation?
-                    (when (< nesting-end nesting-start)
+                    (when (and (< nesting-end nesting-start)
+                               (> column-level 0))
 
                       ;; Decrease indentation by one
                       (setq column-level (1- column-level)))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index ab63e80..f41a0e6 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -69,9 +69,9 @@
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)) (4 (0 1))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
-   "<?php\nmyFunction(\n    array(\n        23,\n        [\n            25\n   
     ]\n    )\n);"
+   "<?php\nmyFunction(array(\n    23,\n    [\n        25\n    ]\n)\n);"
    "Round and square bracket expressions"
-   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (2 0)) (6 (3 
0)) (7 (2 0)) (8 (1 0)) (9 (0 0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
+   (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (2 0)) (6 (1 
0)) (7 (0 0)) (8 (0 0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   ;; TODO CASE, DEFAULT
 



reply via email to

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