[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 1fbe6a8 490/495: Fix comment filling at start of b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 1fbe6a8 490/495: Fix comment filling at start of buffer. |
Date: |
Sat, 7 Aug 2021 09:06:15 -0400 (EDT) |
branch: elpa/go-mode
commit 1fbe6a8151e770cfc50e7a1bfb956c5312d9141e
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fix comment filling at start of buffer.
In cases like:
// Sweet
// comment.
package foo
We weren't filling the comment properly
because (go--fill-forward-paragraph -1) was ending up on the second
line instead of the first. It goes backwards to the first line with no
comment content and then moves forward one line, but at the beginning
of the buffer there is no line preceeding the comment. Tweak the logic
to not move forward if the current line has comment content.
Fixes #373.
Closes: #374 [via git-merge-pr]
---
go-mode.el | 8 +++++---
test/go-fill-paragraph-test.el | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index 1675280..835dc18 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -845,9 +845,11 @@ thing for comments."
(when mark-active
(setq arg (forward-paragraph arg)))
(setq done t))
- ;; If we are going backwards, back up one more line so
- ;; we are on the line before the comment.
- (when (= single -1)
+ ;; If we are going backwards, move forward one line so we
+ ;; are on the first interesting line of the comment. Note
+ ;; that the current line may already be interesting if we
+ ;; are at the beginning of the buffer.
+ (when (and (= single -1) (not (go--interesting-comment-p)))
(forward-line 1))
(cl-decf arg single))))
arg))
diff --git a/test/go-fill-paragraph-test.el b/test/go-fill-paragraph-test.el
index 0b5412a..9d23aab 100644
--- a/test/go-fill-paragraph-test.el
+++ b/test/go-fill-paragraph-test.el
@@ -218,3 +218,21 @@ func main() {
if something() { somethingElse() }
}"
))
+
+
+(ert-deftest go--fill-paragraph-bob ()
+ (go--should-fill
+ "<>// Lorem
+// ipsum."
+ "// Lorem ipsum."
+ )
+
+ (go--should-fill
+ "<>/*
+ Lorem
+ ipsum.
+*/"
+ "/*
+ Lorem ipsum.
+*/"
+ ))
- [nongnu] elpa/go-mode e8674fe 437/495: Expand electric indent config a bit, (continued)
- [nongnu] elpa/go-mode e8674fe 437/495: Expand electric indent config a bit, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6a64cbf 439/495: Fix indentation for composite literal keys., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fb1272c 441/495: indent: fix performance in giant comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c020e2c 456/495: Fontify type names in more places., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 2a1584f 454/495: Readme: add note recommending goimports, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 57becfb 460/495: Fontify type names in interface declarations, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cf53daa 459/495: Fix indentation in naked blocks., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode f872781 466/495: Fontify variable names., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode acec0aa 471/495: Fix Content-Type for https://play.golang.org/share, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode cad6d0a 472/495: Fix fontification performance issue, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 1fbe6a8 490/495: Fix comment filling at start of buffer.,
ELPA Syncer <=
- [nongnu] elpa/go-mode 5186c83 491/495: Support basic indenting in multiline comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode c576513 494/495: Fix fontification of multiplicand after index expr., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 49a5380 493/495: Trivial fix of docstring and comment spelling typos., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 584628e 148/495: instead of killing lines, delete them, to avoid manipulating the kill ring, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a82c165 221/495: fix the license, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 27068bb 222/495: provide configuration option for how to display coverage buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 86ed568 235/495: add link to `defgroup'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a9b9871 247/495: Use view-mode in godoc-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dce210f 250/495: Bump version to 1.3.1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8baa836 251/495: Don't break fontification when limiting point, ELPA Syncer, 2021/08/07