~rjarry/aerc-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH aerc] compose: prevent trailing spaces on empty headers

Jonathan Dowland <jon+aerc-devel@dow.land>
Details
Message ID
<20241126113923.1569496-1-jon+aerc-devel@dow.land>
DKIM signature
pass
Download raw message
Patch: +8 -1
When using format-flowed=true, you need to configure your editor to
format the text accordingly. With (neo)vim, this is achieved by setting
formatoptions+=w (trailing whitespace indicates paragraph continuation).
This may also be combined with +=a (automatically reflow paragraphs as
you edit).

When also using edit-headers=true, empty header lines are considered
part of the same paragraph (by vim) if they have a trailing space. This
can make editing the headers difficult (the editor may mistakenly join
them together).

To prevent this, vary the separator between header field name and body
depending on whether the body is empty. If so, only use the ":".  This
is valid syntax for the populated case too, but including a space is
aesthetically pleasing, so for that case use ": " as the separator.

Signed-off-by: Jonathan Dowland <jon@dow.land>
---
 app/compose.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/app/compose.go b/app/compose.go
index 451981cd..ff2737d7 100644
--- a/app/compose.go
+++ b/app/compose.go
@@ -537,7 +537,14 @@ func (c *Composer) setContents(reader io.Reader) error {
				}
			}
			key := textproto.CanonicalMIMEHeaderKey(h)
			_, err = fmt.Fprintf(c.email, "%s: %s"+lineEnding, key, value)

			var sep string
			if value == "" {
				sep = ":"
			} else {
				sep = ": "
			}
			_, err = fmt.Fprintf(c.email, "%s%s%s%s", key, sep, value, lineEnding)
			if err != nil {
				return err
			}
-- 
2.39.2

[aerc/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D5W2ZYTSJCFL.3IENJVRIGKGJ3@fra02>
In-Reply-To
<20241126113923.1569496-1-jon+aerc-devel@dow.land> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: FAILED in 1m44s

[compose: prevent trailing spaces on empty headers][0] from [Jonathan Dowland][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/56120
[1]: jon+aerc-devel@dow.land

✓ #1375562 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1375562
✗ #1375561 FAILED  aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1375561

[aerc/patches] build failed

builds.sr.ht <builds@sr.ht>
Details
Message ID
<D5W2ZYTEG4YR.23YMKI2UQCUN4@fra02>
In-Reply-To
<20241126113923.1569496-1-jon+aerc-devel@dow.land> (view parent)
DKIM signature
missing
Download raw message
aerc/patches: FAILED in 1m44s

[compose: prevent trailing spaces on empty headers][0] from [Jonathan Dowland][1]

[0]: https://lists.sr.ht/~rjarry/aerc-devel/patches/56120
[1]: jon+aerc-devel@dow.land

✓ #1375562 SUCCESS aerc/patches/openbsd.yml     https://builds.sr.ht/~rjarry/job/1375562
✗ #1375561 FAILED  aerc/patches/alpine-edge.yml https://builds.sr.ht/~rjarry/job/1375561
Jonathan Dowland <jon+aerc-devel@dow.land>
Details
Message ID
<D5W3A22X01W2.33HKFLI7EIX0B@dow.land>
In-Reply-To
<20241126113923.1569496-1-jon+aerc-devel@dow.land> (view parent)
DKIM signature
pass
Download raw message
It looks like the discrepancy between the email address I used in 
'Signed-off-by' and the mail's From: broke the tests. I've just
attempted resending the same patch with matching values. Sorry for the 
beginner-noise.

-- 
👱🏻	Jonathan Dowland
✎	    jon@dow.land
🔗	https://jmtd.net
Reply to thread Export thread (mbox)