Skip to content

Commit

Permalink
Fix bounds during comment syntax propertization
Browse files Browse the repository at this point in the history
Closes GH-327
  • Loading branch information
jrblevin committed Aug 31, 2018
1 parent b7eade5 commit b6de08a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
- Do not fail displaying inline images on empty links. ([GH-320][])
- Fix off-by-one error in `markdown-inline-code-at-pos`.
([GH-313][])
- Fix bounds during inline comment syntax propertization. ([GH-327][])

[gh-349]: https://github.com/jrblevin/markdown-mode/issues/349]
[gh-171]: https://github.com/jrblevin/markdown-mode/issues/171
[gh-216]: https://github.com/jrblevin/markdown-mode/issues/216
Expand Down Expand Up @@ -163,6 +165,7 @@
[gh-317]: https://github.com/jrblevin/markdown-mode/pull/317
[gh-320]: https://github.com/jrblevin/markdown-mode/pull/320
[gh-322]: https://github.com/jrblevin/markdown-mode/pull/322
[gh-327]: https://github.com/jrblevin/markdown-mode/issues/327
[gh-331]: https://github.com/jrblevin/markdown-mode/issues/331
[gh-335]: https://github.com/jrblevin/markdown-mode/pull/335
[gh-340]: https://github.com/jrblevin/markdown-mode/issues/340
Expand Down
8 changes: 4 additions & 4 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,8 @@ region of a YAML metadata block as propertized by

(defun markdown-syntax-propertize-comments (start end)
"Match HTML comments from the START to END."
(let* ((in-comment (nth 4 (syntax-ppss))))
(let* ((in-comment (nth 4 (syntax-ppss)))
(comment-begin (nth 8 (syntax-ppss))))
(goto-char start)
(cond
;; Comment start
Expand All @@ -1617,10 +1618,9 @@ region of a YAML metadata block as propertized by
(markdown-syntax-propertize-comments
(min (1+ (match-end 0)) end (point-max)) end)))
;; Comment end
((and in-comment
((and in-comment comment-begin
(re-search-forward markdown-regex-comment-end end t))
(let ((comment-end (match-end 0))
(comment-begin (nth 8 (syntax-ppss))))
(let ((comment-end (match-end 0)))
(put-text-property (1- comment-end) comment-end
'syntax-table (string-to-syntax ">"))
;; Remove any other text properties inside the comment
Expand Down

0 comments on commit b6de08a

Please sign in to comment.