Skip to content

Commit

Permalink
Fix single-line-style paragraph fills with code immediately before or…
Browse files Browse the repository at this point in the history
… after
  • Loading branch information
MicahChalmer committed Sep 28, 2013
1 parent c635fba commit 5d24a1a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/etc/emacs/rust-mode-tests.el
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/etc/emacs/rust-mode.el
Expand Up @@ -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))))))

Expand Down

5 comments on commit 5d24a1a

@bors
Copy link
Contributor

@bors bors commented on 5d24a1a Oct 2, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from catamorphism
at MicahChalmer@5d24a1a

@bors
Copy link
Contributor

@bors bors commented on 5d24a1a Oct 2, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging MicahChalmer/rust/fill-with-code-around = 5d24a1a into auto

@bors
Copy link
Contributor

@bors bors commented on 5d24a1a Oct 2, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MicahChalmer/rust/fill-with-code-around = 5d24a1a merged ok, testing candidate = 1d6c011

@bors
Copy link
Contributor

@bors bors commented on 5d24a1a Oct 2, 2013

@bors
Copy link
Contributor

@bors bors commented on 5d24a1a Oct 2, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 1d6c011

Please sign in to comment.