branch: externals/phps-mode commit 75c4af4e60a5db38f7494f847bf03a726dbe38dd Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Fixed indentation for lines wrapped in scripting open/close --- phps-mode-functions.el | 6 ++++-- phps-mode-test-functions.el | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/phps-mode-functions.el b/phps-mode-functions.el index 4340359..b208b65 100644 --- a/phps-mode-functions.el +++ b/phps-mode-functions.el @@ -510,8 +510,10 @@ (setq in-heredoc-started-this-line nil) (setq special-control-structure-started-this-line nil))) - ;; Current token is not first - (setq first-token-on-line nil) + ;; Current token is not first if it's not <?php or <?= + (when (not (or (equal token 'T_OPEN_TAG) + (equal token 'T_OPEN_TAG_WITH_ECHO))) + (setq first-token-on-line nil)) (when (> token-end-line-number token-start-line-number) ;; (message "Token not first on line %s starts at %s and ends at %s" token token-start-line-number token-end-line-number) diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el index cda2fad..e765760 100644 --- a/phps-mode-test-functions.el +++ b/phps-mode-test-functions.el @@ -117,6 +117,12 @@ ;; (message "Tokens: %s" phps-mode-lexer-tokens) (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (1 0)) (5 (0 0))) (phps-mode-test-functions--hash-to-list (phps-mode-functions-get-lines-indent))))) + (phps-mode-test-with-buffer + "<?php if (true) { ?>\n <?php echo 'here'; ?>\n<?php } ?>" + "Regular if-expression but inside scripting tags" + ;; (message "Tokens: %s" phps-mode-lexer-tokens) + (should (equal '((1 (0 0)) (2 (1 0)) (3 (0 0))) (phps-mode-test-functions--hash-to-list (phps-mode-functions-get-lines-indent))))) + ) (defun phps-mode-test-functions-get-lines-indent-multi-line-assignments ()