diff --git a/plantuml-mode.el b/plantuml-mode.el index 6072e3e..b3041ba 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -343,7 +343,7 @@ Uses prefix (as PREFIX) to choose where to display it: (defvar plantuml-keywords-regexp (concat "^\\s *" (regexp-opt plantuml-keywords 'words) "\\|\\(<\\|<|\\|\\*\\|o\\)\\(\\.+\\|-+\\)\\|\\(\\.+\\|-+\\)\\(>\\||>\\|\\*\\|o\\)\\|\\.\\{2,\\}\\|-\\{2,\\}")) (defvar plantuml-builtins-regexp (regexp-opt plantuml-builtins 'words)) (defvar plantuml-preprocessors-regexp (concat "^\\s *" (regexp-opt plantuml-preprocessors 'words))) - (defvar plantuml-indent-regexp-start "^[ \t]*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\\|loop\s+.*\\|group\s+.*\\|par\s+\\|opt\s+.*\\|alt\s+.*\\|else\s+.*\\|note\s+over\\|note\sas\s.*\\|note\s+\\(\\(?:\\(?:buttom\\|left\\|right\\|top\\)\\)\\)\\(?:\s+of\\)?\\|\\(?:class\\|enum\\|package\\)\s+.*{\\|activate\s+.*\\)") + (defvar plantuml-indent-regexp-start "^[ \t]*\\(\\(?:.*\\)?\s*\\(?:[<>.*a-z-|]+\\)?\s*\\(?:\\[[a-zA-Z]+\\]\\)?\s+if\s+.*\\|loop\s+.*\\|group\s+.*\\|par\s+\\|opt\s+.*\\|alt\s+.*\\|else\\|note\s+over\\|note\sas\s.*\\|note\s+\\(\\(?:\\(?:buttom\\|left\\|right\\|top\\)\\)\\)\\(?:\s+of\\)?\\|\\(?:class\\|enum\\|package\\)\s+.*{\\|activate\s+.*\\)") (defvar plantuml-indent-regexp-end "^[ \t]*\\(endif\\|else\\|end\\|end\s+note\\|.*}\\|deactivate\s+.*\\)") (setq plantuml-font-lock-keywords diff --git a/test/plantuml-indentation-test.el b/test/plantuml-indentation-test.el index c8bc723..110922e 100644 --- a/test/plantuml-indentation-test.el +++ b/test/plantuml-indentation-test.el @@ -194,17 +194,22 @@ else |end ") -(check-indentation alt-else-body - "alt choice 1 -else -|A -> B -end -" - "alt choice 1 -else - |A -> B -end -") +(check-indentation opt + "opt have fun +|some text +end" + "opt have fun + |some text +end") + +(check-indentation activate-deactivate + "activate participant_1 +|participant_1 -> participant_2 : f() +deactivate participant_1" + "activate participant_1 + |participant_1 -> participant_2 : f() +deactivate participant_1") + (provide 'plantuml-indentation-test)