emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/markdown-mode f7d125f5fe 1/2: Hide trailing whitespace whe


From: ELPA Syncer
Subject: [nongnu] elpa/markdown-mode f7d125f5fe 1/2: Hide trailing whitespace when hiding markup
Date: Mon, 11 Mar 2024 01:00:47 -0400 (EDT)

branch: elpa/markdown-mode
commit f7d125f5fea713f1a3eca6c494c88c50889cc464
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    Hide trailing whitespace when hiding markup
    
    See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69647>.
---
 CHANGES.md             |  2 ++
 markdown-mode.el       |  6 +++++-
 tests/markdown-test.el | 12 ++++++++++++
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 1e4608d0ba..ba9acee2fe 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -11,6 +11,8 @@
     - Add functions to move to the beginning and end of lines
       (`markdown-beginning-of-line` and `markdown-end-of-line`), and the
       variable `markdown-special-ctrl-a/e`, like Org mode.
+    - Trailing whitespace characters for line breaks are hidden when using
+      `markdown-hide-markup`
 
 *   Bug fixes:
     - Don't highlight superscript/subscript in math inline/block [GH-802][]
diff --git a/markdown-mode.el b/markdown-mode.el
index 8094e0258f..1514edb43a 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -1855,6 +1855,10 @@ START and END delimit region to propertize."
   '(face markdown-markup-face invisible markdown-markup)
   "List of properties and values to apply to markup.")
 
+(defconst markdown-line-break-properties
+  '(face markdown-line-break-face invisible markdown-markup)
+  "List of properties and values to apply to line break markup.")
+
 (defconst markdown-language-keyword-properties
   '(face markdown-language-keyword-face invisible markdown-markup)
   "List of properties and values to apply to code block language names.")
@@ -2298,7 +2302,7 @@ Depending on your font, some reasonable choices are:
     (markdown--match-highlighting . ((3 markdown-markup-properties)
                                      (4 'markdown-highlighting-face)
                                      (5 markdown-markup-properties)))
-    (,markdown-regex-line-break . (1 'markdown-line-break-face prepend))
+    (,markdown-regex-line-break . (1 markdown-line-break-properties prepend))
     (markdown-match-escape . ((1 markdown-markup-properties prepend)))
     (markdown-fontify-sub-superscripts)
     (markdown-match-inline-attributes . ((0 markdown-markup-properties 
prepend)))
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index ae8820b01c..21c7a033d6 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -2257,6 +2257,18 @@ See GH-245."
     (should (invisible-p (point)))
     (should-not (invisible-p (1+ (point))))))
 
+(ert-deftest test-markdown-markup-hiding/line-break ()
+  "Test hiding markup for line break markup."
+  (markdown-test-string "hello  \nworld"
+    (markdown-test-range-has-property (+ 5 (point)) (+ 6 (point)) 'invisible 
'markdown-markup)
+    (should-not (invisible-p (point))) ;; part of "hello"
+    (should-not (invisible-p (+ 5 (point)))) ;; part of line break
+    (should-not (invisible-p (+ 7 (point)))) ;; part of "world"
+    (markdown-toggle-markup-hiding t)
+    (should-not (invisible-p (point))) ;; part of "hello"
+    (should (invisible-p (+ 5 (point)))) ;; part of line break
+    (should-not (invisible-p (+ 7 (point)))))) ;; inside "world"
+
 ;;; Markup hiding url tests:
 
 (ert-deftest test-markdown-url-hiding/eldoc ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]