diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fa4eb4c..de0f8d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,17 +6,23 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this ### Added - * **Net feature**: `php-format` ([#730]) + * **Net feature**: `php-format` ([#731]) * Add `php-format-project` and `php-format-this-buffer-file` commands * Add `php-format-auto-mode` minor mode +### Fixed + + * Fix array indentation broken by commenting out ([#726], [#732]) + ### Removed * No longer highlights `'link` in PHPDoc ([#724]) * Please use `goto-address-prog-mode` minor mode [#724]: https://github.com/emacs-php/php-mode/pull/724 -[#730]: https://github.com/emacs-php/php-mode/pull/730 +[#726]: https://github.com/emacs-php/php-mode/pull/726 +[#731]: https://github.com/emacs-php/php-mode/pull/731 +[#732]: https://github.com/emacs-php/php-mode/pull/732 ## [1.24.2] - 2022-11-13 diff --git a/lisp/php-mode.el b/lisp/php-mode.el index 319e1d2a..012f21ee 100644 --- a/lisp/php-mode.el +++ b/lisp/php-mode.el @@ -663,6 +663,7 @@ but only if the setting is enabled." ((looking-at-p "->") '+) ((looking-at-p "[:?]") '+) ((looking-at-p "[,;]") nil) + ((looking-at-p "//") nil) ;; Is the previous line terminated with `,' ? ((progn (forward-line -1) @@ -672,7 +673,7 @@ but only if the setting is enabled." (while (and (< beginning-of-langelem (point)) (setq start (php-in-string-or-comment-p))) (goto-char start) - (skip-chars-backward " ") + (skip-chars-backward " \r\n") (backward-char 1)) (and (not (eq (point) beginning-of-current-line)) (not (looking-at-p ",")) diff --git a/tests/indent/issue-726.php b/tests/indent/issue-726.php new file mode 100644 index 00000000..b48c6f04 --- /dev/null +++ b/tests/indent/issue-726.php @@ -0,0 +1,13 @@ + [ + 'bee' => 2, + ], + // 'foo' => [ + // 'bar' => 1, + // ], + // ###php-mode-test### ((indent 4)) + 'lee' => 2, + // 'dee' => 3 + 'gee' => 4, // ###php-mode-test### ((indent 4)) +]; // ###php-mode-test### ((indent 0)) diff --git a/tests/php-mode-test.el b/tests/php-mode-test.el index 79db0b8a..0dae822e 100644 --- a/tests/php-mode-test.el +++ b/tests/php-mode-test.el @@ -652,7 +652,8 @@ Meant for `php-mode-test-issue-503'." (ert-deftest php-mode-test-issue-702 () "Proper alignment arglist." - (with-php-mode-test ("indent/issue-702.php" :indent t :magic t))) + (with-php-mode-test ("indent/issue-702.php" :indent t :magic t)) + (with-php-mode-test ("indent/issue-726.php" :indent t :magic t))) (ert-deftest php-mode-test-php74 () "Test highlighting language constructs added in PHP 7.4."