~sircmpwn/aerc

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] lib/templates: don't wrap lines that may be code

Details
Message ID
<20201013181939.1077-1-evan.gates@gmail.com>
DKIM signature
pass
Download raw message
Patch: +2 -2
The wrapText function used in the quoted_reply template squeezes
whitespace due to the use of strings.Fields.  As a result any code in
the body would lose leading whitespace for indentation.  There was
already a check to not wrap quoted lines (lines begining with '>').
Add more characters and don't wrap if a line starts with '+', '-',
' ', '\t'.  These characters provide an heuristic that the text is
code or part of a patch.
---
 lib/templates/template.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/templates/template.go b/lib/templates/template.go
index 4346111..31bf46f 100644
--- a/lib/templates/template.go
+++ b/lib/templates/template.go
@@ -118,8 +118,8 @@ func wrapText(text string, lineWidth int) string {
		switch {
		case line == "":
			// deliberately left blank
		case line[0] == '>':
			// leave quoted text alone
		case strings.IndexByte(">+- \t", line[0]) != -1:
			// do not wrap lines that are quoted or probably code
			wrapped.WriteString(line)
		default:
			wrapped.WriteString(wrapLine(line, lineWidth))
-- 
2.28.0
Details
Message ID
<9D1FEE53-981D-4D89-957E-3343D9D23D43@labrat.space>
In-Reply-To
<20201013181939.1077-1-evan.gates@gmail.com> (view parent)
DKIM signature
pass
Download raw message
thanks for the patch.
However I won't merge this, if you don't want wrapping use a different template.

We shouldn't special case characters other than the quoting char.
Details
Message ID
<C6BZ3LDRU4XO.21IC4BYTVZONH@emg-xps>
In-Reply-To
<9D1FEE53-981D-4D89-957E-3343D9D23D43@labrat.space> (view parent)
DKIM signature
pass
Download raw message
On Tue Oct 13, 2020 at 11:23 AM PDT, Reto wrote:
> thanks for the patch.
> However I won't merge this, if you don't want wrapping use a different
> template.
>
> We shouldn't special case characters other than the quoting char.

Understood.

Since aerc claims "First-class support for working with git & email"[0]
I find it odd that it mangles inline patches by default when replying.
It also doesn't include a template that doesn't mangle the patches.
Would you accept a quoted_reply_nowrap template?  How do people using
aerc normally handle this?

[0] https://aerc-mail.org/
Details
Message ID
<6E3B843B-266A-4C57-9CBC-49EBD610DF3D@labrat.space>
In-Reply-To
<C6BZ3LDRU4XO.21IC4BYTVZONH@emg-xps> (view parent)
DKIM signature
pass
Download raw message
On 13 October 2020 20:26:16 CEST, Evan Gates <evan.gates@gmail.com> wrote:
>Would you accept a quoted_reply_nowrap template?  How do people using
>aerc normally handle this?

I write my own?
hard wrapping is shitty behavior anyhow... people have different screen sizes than you and these days often look at it on a screen which is much much narrower than 80 chars (phones).

it's literally as much work as deleting a single function call. It's easy to change the behaviour. About as easy as changing to a different template would be so I don't quite see the usefulness of shipping a different template to be honest.
Reply to thread Export thread (mbox)