Skip to content

Commit

Permalink
Don't change faces for link part with URL hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
jrblevin committed Jun 9, 2017
1 parent 85e0cf6 commit 40e4901
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
12 changes: 3 additions & 9 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -6922,15 +6922,11 @@ Otherwise, open with `find-file' after stripping anchor and/or query string."
'help-echo (if title (concat title "\n" url) url)))
;; URL part
(up (list 'keymap markdown-mode-mouse-map
'face (if markdown-hidden-urls
'markdown-markup-face
'markdown-url-face)
'face 'markdown-url-face
'mouse-face 'markdown-highlight-face
'font-lock-multiline t))
;; Title part
(tp (list 'face (if markdown-hidden-urls
'markdown-markup-face
'markdown-link-title-face)
(tp (list 'face 'markdown-link-title-face
'font-lock-multiline t)))
(dolist (g '(1 2 4 5 8))
(when (match-end g)
Expand Down Expand Up @@ -6965,9 +6961,7 @@ Otherwise, open with `find-file' after stripping anchor and/or query string."
(or (markdown-link-url)
"Undefined reference"))))))
;; Reference part
(rp (list 'face (if markdown-hidden-urls
'markdown-markup-face
'markdown-reference-face)
(rp (list 'face 'markdown-reference-face
'font-lock-multiline t)))
(dolist (g '(1 2 4 5 8))
(when (match-end g)
Expand Down
12 changes: 8 additions & 4 deletions tests/markdown-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -2663,8 +2663,8 @@ takes precedence)."
(markdown-test-range-has-face 925 925 markdown-markup-face)
(markdown-test-range-has-face 926 929 markdown-link-face)
(markdown-test-range-has-face 930 931 markdown-markup-face)
(markdown-test-range-has-face 932 949 markdown-markup-face)
(markdown-test-range-has-face 951 957 markdown-markup-face)
(markdown-test-range-has-face 932 949 markdown-url-face)
(markdown-test-range-has-face 951 957 markdown-link-title-face)
(markdown-test-range-has-face 958 958 markdown-markup-face)
(should (equal '((26 . 8734)) (get-text-property 932 'composition)))))

Expand All @@ -2675,13 +2675,17 @@ takes precedence)."
;; Two-character reference labels shouldn't get composed.
(markdown-test-range-has-face 1 1 markdown-markup-face)
(markdown-test-range-has-face 2 5 markdown-link-face)
(markdown-test-range-has-face 6 10 markdown-markup-face)
(markdown-test-range-has-face 6 7 markdown-markup-face)
(markdown-test-range-has-face 8 9 markdown-reference-face)
(markdown-test-range-has-face 10 10 markdown-markup-face)
(should-not (get-text-property 8 'composition)))
(markdown-test-string "[link][long-reference-label]"
;; Longer reference labels should be composed
(markdown-test-range-has-face 1 1 markdown-markup-face)
(markdown-test-range-has-face 2 5 markdown-link-face)
(markdown-test-range-has-face 6 28 markdown-markup-face)
(markdown-test-range-has-face 6 7 markdown-markup-face)
(markdown-test-range-has-face 8 27 markdown-reference-face)
(markdown-test-range-has-face 28 28 markdown-markup-face)
(should (equal '((20 . 8734)) (get-text-property 8 'composition))))))

;;; Markdown Parsing Functions:
Expand Down

0 comments on commit 40e4901

Please sign in to comment.