auto merge of #9600 : MicahChalmer/rust/fill-with-code-around, r=catamorphism
This fixes a problem with paragraph fills: hitting M-q on a single-line-style (`//`) comment with code immediately before or after it would try to fill the code as part of the paragraph too.
This commit is contained in:
commit
1d6c01148c
@ -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
|
||||
|
@ -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))))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user