diff options
| author | Micah Chalmer <micah@micahchalmer.net> | 2013-09-28 17:15:37 -0400 |
|---|---|---|
| committer | Micah Chalmer <micah@micahchalmer.net> | 2013-09-28 17:40:24 -0400 |
| commit | 891716aecc720667ee720b3f2b9e482e1ae7e3a0 (patch) | |
| tree | 5b0b0cd52f078112c8dd191a0b8f79de528bc2b4 | |
| parent | 7625c5c307b8436f54a63eaac2eb96e1a13aae29 (diff) | |
| download | rust-mode-891716aecc720667ee720b3f2b9e482e1ae7e3a0.tar.gz | |
Fix single-line-style paragraph fills with code immediately before or after
| -rw-r--r-- | rust-mode-tests.el | 29 | ||||
| -rw-r--r-- | rust-mode.el | 3 |
2 files changed, 31 insertions, 1 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 4bfdee5..67e779e 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -196,6 +196,35 @@ This is some more text. Fee fie fo fum. Humpty dumpty sat on a wall. *very very very long string */")) +(ert-deftest fill-paragraph-single-line-style-with-code-before () + (test-fill-paragraph + "fn foo() { } +/// This is my comment. This is more of my comment. This is even more." + "fn foo() { } +/// This is my comment. This is +/// more of my comment. This is +/// even more." 14)) + +(ert-deftest fill-paragraph-single-line-style-with-code-after () + (test-fill-paragraph + "/// This is my comment. This is more of my comment. This is even more. +fn foo() { }" + "/// This is my comment. This is +/// more of my comment. This is +/// even more. +fn foo() { }" 1 73)) + +(ert-deftest fill-paragraph-single-line-style-code-before-and-after () + (test-fill-paragraph + "fn foo() { } +/// This is my comment. This is more of my comment. This is even more. +fn bar() { }" + "fn foo() { } +/// This is my comment. This is +/// more of my comment. This is +/// even more. +fn bar() { }" 14 67)) + (defun test-auto-fill (initial position inserted expected) (rust-test-manip-code initial diff --git a/rust-mode.el b/rust-mode.el index bad1ea5..a3b7581 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -300,7 +300,8 @@ (let ((fill-paragraph-function (if (not (eq fill-paragraph-function 'rust-fill-paragraph)) - fill-paragraph-function))) + fill-paragraph-function)) + (fill-paragraph-handle-comment t)) (apply 'fill-paragraph args) t)))))) |
