Comments (5)
Thanks for investigating (and having this mini conversation with yourself :-)
The route to displaying a message is pretty complicated.
The caller dumps all the text in a file and gives a FILE
handle to the Pager.
The Pager has a lot of ugly hard-coded rules for formatting.
It gets uglier still when the user hits h (<display-toggle-weed>
).
This changes:
- Which headers are visible
- The order of the headers
- The wrapping of the headers
This is implemented by exiting the Pager, getting the caller to regenerate the file and then restarting the Pager.
Perhaps this'll get fixed in Pager 2.0 :-)
from neomutt.
Here's a source with which to reproduce it:
Date: Sun, 14 Apr 2024 23:38:42 +0200
From: Alejandro Colomar <[email protected]>
To: [email protected]
Subject: Re: test irt
Message-ID: <wklpoywc2k62n37vjggngomasvio3hsywk3zwwh7y77vncfi5k@e4crtntqov6h>
Reply-To: [email protected], [email protected], [email protected], [email protected], [email protected],
[email protected], [email protected]
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="bamagesq55ywa4ny"
Content-Disposition: inline
In-Reply-To: <6335w35dd7ql7r4bg6api7xwne7hu77bhmo4qnd4v7zu2pz7gu@ml67trxvnje6>
<d4synv3jjajnqzk4skitb5yyjucuxkm3bixhmtcf5gfjnmnecu@x2prgsx5ig3m>
<ef3ses2mgtqy3er4zmnnm4ibdlvlgs5ecsgf3ez32sfdfxz5pd@7ghv72454mok>
--bamagesq55ywa4ny
Content-Type: text/plain; protected-headers=v1; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
From: Alejandro Colomar <[email protected]>
To: [email protected]
Subject: Re: test irt
Reply-To: [email protected], [email protected], [email protected], [email protected], [email protected],
[email protected], [email protected]
MIME-Version: 1.0
In-Reply-To: <6335w35dd7ql7r4bg6api7xwne7hu77bhmo4qnd4v7zu2pz7gu@ml67trxvnje6>
<d4synv3jjajnqzk4skitb5yyjucuxkm3bixhmtcf5gfjnmnecu@x2prgsx5ig3m>
<ef3ses2mgtqy3er4zmnnm4ibdlvlgs5ecsgf3ez32sfdfxz5pd@7ghv72454mok>
On Sun, Apr 14, 2024 at 11:37:38PM GMT, Alejandro Colomar wrote:
> On Sun, Apr 14, 2024 at 11:36:31PM GMT, Alejandro Colomar wrote:
--=20
<https://www.alejandro-colomar.es/>
--bamagesq55ywa4ny
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmYcTN8ACgkQnowa+77/
2zLRrg//eVpyFJ7BAijvei5TGeTMpGKNkWZp4fLPCONvql/sOkXp8VmecIw+O2/r
qUZ7flss9KsXaMfqFFvxvWrnXFjpFF9YiWm57TWR2gF9dv2ERNr2d2q6njFe2eP3
jLZNPRBta+oItVlNfKiS4NRMUkDyQBIEjjQnxjKhcJD2xCF/QRI26gLgMyIjzE9G
2goRo/hFpDDoNZjhqCNx4er6wcBCpIlZ9KJ2vuaDsdceSmF5+Pc1DxQsC/6iXbpf
fWefAtINnKIO5p3EUx/whwwPgu9fZBqI+C8h4FGVR8IBwKDaojMNsK8OMIhofdoN
qW8H03R6Nq7WTjWxw9+uKvOpm87c6GRBtpmTVMXBwEa8vk0zIrLhVYa8tlojQUU3
kAvtovL/aM/JhEKaKZwh7AznOJJa0Ek6suKiIh94WjewD1c7WzUVSTPY78cZFwzM
6mG+sXwKaQQquo08HYiFJSO9oiPdGSFuZxTjRuJSX7wr3zitS1lfUfNdgCNfay2d
fqsEsTa9np3A1ytwbIKsm2IHX0hsjcJkQ2v6L45jM7GqCcpl72qb1zvAoYlFIM3Z
upQGvg1BwQdGGzPPCbiTJ2fahPGMxTsEFn2TlVgyRXMegsS2OBSwklSNEE+YTHFo
SiE6UWG9A5GpEYgCVlhtWXkSm+RZoCA3sjQBbYdMKItPnjdVqd0=
=Lrrt
-----END PGP SIGNATURE-----
--bamagesq55ywa4ny--
which prints as the following in the pager:
Date: Sun, 14 Apr 2024 23:38:42 +0200
From: Alejandro Colomar <[email protected]>
To: [email protected]
Subject: Re: test irt
Message-ID: <wklpoywc2k62n37vjggngomasvio3hsywk3zwwh7y77vncfi5k@e4crtntqov6h>
Reply-To: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
In-Reply-To: <6335w35dd7ql7r4bg6api7xwne7hu77bhmo4qnd4v7zu2pz7gu@ml67trxvnje6>
<d4synv3jjajnqzk4skitb5yyjucuxkm3bixhmtcf5gfjnmnecu@x2prgsx5ig3m>
<ef3ses2mgtqy3er4zmnnm4ibdlvlgs5ecsgf3ez32sfdfxz5pd@7ghv72454mok>
[-- Begin signature information --]
Good signature from: Alejandro Colomar <[email protected]>
aka: Alejandro Colomar <[email protected]>
aka: Alejandro Colomar Andres <[email protected]>
created: Sun Apr 14 23:38:39 2024
[-- End signature information --]
[-- The following data is signed --]
Subject: Re: test irt
On Sun, Apr 14, 2024 at 11:37:38PM GMT, Alejandro Colomar wrote:
> On Sun, Apr 14, 2024 at 11:36:31PM GMT, Alejandro Colomar wrote:
--
<https://www.alejandro-colomar.es/>
[-- End of signed data --]
I'm not sure where the main (non-protected) headers are being printed in the source code. I tried finding it, but failed.
from neomutt.
I suspect it's this call:
$ grep -rn mutt_addrlist_write_wrap ./copy.c
1165: mutt_addrlist_write_wrap(&al, &buf, *h);
(For some reason, if I simply turn that into a mutt_addrlist_write(), it doesn't work anymore.)
That's storing the message with a trailing space after the comma and before the newline, and when neomutt(1) parses it again, it parses the trailing space, and then converts the tab after the newline into a second space.
While we could fix it by not writing that trailing space, it would be better to first fix the parsing to not parse \n\t
as
but as a single space
. Then we can fix the writing side.
I didn't find where it's re-parsed.
from neomutt.
I've found the reason, and I'm not sure this is easy to fix. I think we'll have to live with the space for some time.
In essence, it's the following code not being able to anticipate if the next element will be in the current line or not:
$ grepc addrlist_write .
./address/address.c:static size_t addrlist_write(const struct AddressList *al, struct Buffer *buf,
bool display, const char *header, int cols)
{
if (!buf || !al || TAILQ_EMPTY(al))
return 0;
if (header)
{
buf_printf(buf, "%s: ", header);
}
size_t cur_col = buf_len(buf);
bool in_group = false;
struct Address *a = NULL;
TAILQ_FOREACH(a, al, entries)
{
struct Address *next = TAILQ_NEXT(a, entries);
if (a->group)
{
in_group = true;
}
// wrap if needed
const size_t cur_len = buf_len(buf);
cur_col += mutt_addr_write(buf, a, display);
if ((cols > 0) && (cur_col > cols) && (a != TAILQ_FIRST(al)))
{
buf_insert(buf, cur_len, "\n\t");
cur_col = 8;
}
if (!a->group)
{
// group terminator
if (in_group && !a->mailbox && !a->personal)
{
buf_addch(buf, ';');
cur_col++;
in_group = false;
}
if (next && (next->mailbox || next->personal))
{
buf_addstr(buf, ", ");
cur_col += 2;
}
if (!next)
{
break;
}
}
}
return buf_len(buf);
}
I tried to fix it in various places, but I didn't like any solution too much.
I'm closing as WONTFIX for now.
from neomutt.
Yup, it looks really ugly. I'll be waiting for your Pager 2.0. :-)
from neomutt.
Related Issues (20)
- Do we need to handle <stddef.h> specially? HOT 1
- conditional format strings broken in 2024-04-25 HOT 8
- Duplicate gpg keys in key selection menu for message encryption HOT 18
- segfault while opening a mailbox in from the sidebar HOT 2
- Doubts about paranoic defensive programming style HOT 3
- C dialect HOT 2
- tag-prefix doesn't show-up in attach HOT 5
- Doubts about some `*const` pointers HOT 5
- How to use the notmuch command <modify-labels> to tag emails with tags containing spaces?
- Is it possible to edit the automatic title when forwarding or replying a message? HOT 1
- Progress for postponing a message with remote (IMAP)
- autocrypt breaks command line argument `-e "push foo"` HOT 3
- How to forward an email thread to someone else together with attachments ? HOT 3
- `delete-thread` does not support `tag-prefix` operator
- split outgoing email into batches to work around max number of recipients limit in some SMTP providers (infomaniak) HOT 3
- save-message from GMail over IMAP to local box doesn't delete original HOT 3
- Cannot open an .mbox file with neomutt (although it works with mutt) HOT 4
- neomutt truecolor and kitty
- neomutt does not replace `...` by encrypted subject
- Inline-PGP with junk before recognized incorrectly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neomutt.