[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/markdown-mode 57f6800 3/4: Improve issue 613
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/markdown-mode 57f6800 3/4: Improve issue 613 |
Date: |
Mon, 3 May 2021 22:57:13 -0400 (EDT) |
branch: elpa/markdown-mode
commit 57f680098991c2056647f68a924e32a24c2f940c
Author: Shohei YOSHIDA <syohex@gmail.com>
Commit: Shohei YOSHIDA <syohex@gmail.com>
Improve issue 613
---
markdown-mode.el | 5 +++++
tests/markdown-test.el | 23 ++++++++++++++---------
2 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/markdown-mode.el b/markdown-mode.el
index cf6a76e..999df6f 100644
--- a/markdown-mode.el
+++ b/markdown-mode.el
@@ -3599,6 +3599,11 @@ prefixed with an integer from 1 to the length of
(goto-char beg)
(skip-chars-forward "[ \t]")
(setq beg (point))))
+ (when (and end skip-space)
+ (save-excursion
+ (goto-char end)
+ (skip-chars-backward "[ \t]")
+ (setq end (point))))
(markdown-wrap-or-insert start-delim end-delim nil beg end))
(if (markdown--face-p (point) (list face))
(save-excursion
diff --git a/tests/markdown-test.el b/tests/markdown-test.el
index 2f039f8..f25c398 100644
--- a/tests/markdown-test.el
+++ b/tests/markdown-test.el
@@ -532,12 +532,17 @@ Test point position upon removal and insertion."
(ert-deftest test-markdown-insertion/bold-region-begin-with-space ()
"Test region functionality of `markdown-insert-bold'.
-When region starts with spaces"
+When region starts/ends with spaces"
(markdown-test-string " one two three"
(push-mark (point) t t)
(forward-word 2)
(markdown-insert-bold)
- (should (string-equal (buffer-string) " **one two** three"))))
+ (should (string-equal (buffer-string) " **one two** three")))
+ (markdown-test-string " one two three"
+ (push-mark (point) t t)
+ (goto-char 11)
+ (markdown-insert-bold)
+ (should (string-equal (buffer-string) " **one two** three"))))
(ert-deftest test-markdown-insertion/italic-region ()
"Test region functionality of `markdown-insert-italic'."
@@ -551,13 +556,13 @@ When region starts with spaces"
(ert-deftest test-markdown-insertion/italic-region-begin-with-space ()
"Test region functionality of `markdown-insert-italic'.
-When region starts with spaces"
- (markdown-test-string " one two three"
+When region starts/ends with spaces"
+ (markdown-test-string " one two three"
(transient-mark-mode)
(push-mark (point) t t)
- (forward-word 2)
+ (goto-char 11)
(markdown-insert-italic)
- (should (string-equal (buffer-string) " *one two* three"))))
+ (should (string-equal (buffer-string) " *one two* three"))))
(ert-deftest test-markdown-insertion/code-region ()
"Test region functionality of `markdown-insert-code'."
@@ -6182,11 +6187,11 @@ Details:
https://github.com/jrblevin/markdown-mode/issues/534"
(forward-word 2)
(markdown-insert-strike-through)
(should (string-equal (buffer-string) "~~one two~~ three")))
- (markdown-test-string-gfm " one two three"
+ (markdown-test-string-gfm " one two three"
(push-mark (point) t t)
- (forward-word 2)
+ (goto-char 11)
(markdown-insert-strike-through)
- (should (string-equal (buffer-string) " ~~one two~~ three"))))
+ (should (string-equal (buffer-string) " ~~one two~~ three"))))
(ert-deftest test-markdown-gfm/toggle-strike-through ()
"Test toggling functionality of `markdown-insert-strike-through'."