Skip to content

Commit

Permalink
Fix actor fontification error
Browse files Browse the repository at this point in the history
Lines would get incorrectly fontified when line contained more than one
colon.

This closes #37
  • Loading branch information
josteink committed Mar 16, 2016
1 parent 6909b4e commit 22cfd2f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
7 changes: 7 additions & 0 deletions test-files/fontification-double-colon.wsd
@@ -0,0 +1,7 @@

title Double colon fontification error (as outligned in github issue 37)

pc->pc: This line highlight's actor just fine
pc->pc: This line doesn't, because of a double : sign.
pc->pc: But next line is just fine again.

4 changes: 2 additions & 2 deletions wsd-mode.el
Expand Up @@ -260,10 +260,10 @@
(wsd-rx-word "as")
"\\(.+\\)$")))

;; actors in activity staements
;; actors in activity statements
(rx-actors (wsd-rx-lstart (concat "\\([^\n-]+\\)"
(regexp-opt wsd-operators3 t)
"\\(.+\\)"
"\\([^:]+\\)"
":.*$")))

;; actors in activate/deactivate/destroy statements
Expand Down
13 changes: 13 additions & 0 deletions wsd-tests.el
Expand Up @@ -160,6 +160,19 @@
'font-lock-variable-name-face
(face-at-point)))))))

(ert-deftest statement-actors-are-fontified-as-variables ()
(let* ((buffer (find-file-read-only "test-files/fontification-double-colon.wsd")))
;; double-ensure mode is active
(wsd-mode)
;; required when running in unit-test runner.
(font-lock-fontify-buffer)

(while (search-forward "pc" nil t)
(backward-char 1)
(should (eql
'font-lock-variable-name-face
(face-at-point))))))

(ert-deftest indentation-reference-document-is-reflowed-correctly ()
(let* ((buffer (find-file "test-files/indentation-tests.wsd")))
;; double ensure mode is active
Expand Down

0 comments on commit 22cfd2f

Please sign in to comment.