neomutt / neomutt

✉️ Teaching an Old Dog New Tricks -- IRC: #neomutt on irc.libera.chat
https://neomutt.org/
GNU General Public License v2.0
3.23k stars 309 forks source link

Compose menu: "Encrypt with:" overrides `(OppEnc mode)` text #3695

Open whitney-cumber opened 1 year ago

whitney-cumber commented 1 year ago

Expected Behaviour

No trunction in the Security: header line of the compose menu

Actual Behaviour

The (top part of the) compose menu looks like

        From: me@example.org
          To: foo@example.org
          Cc:
         Bcc:
     Subject: Whatever
    Reply-To:
         Fcc: =sent
    Security: Encrypt (S/MIME) (OppEnc mEncrypt with: aes256

Note the trunctation of (OppEnc mode) to (OppEnc m.

Steps to Reproduce

Use opportunistic encryption together with S/MIME, e.g. this neomuttrc-oppenc-smime

set crypt_opportunistic_encrypt = yes
set smime_is_default = yes

# Set up your S/MIME backend for your system properly (we use GPGME)
set crypt_use_gpgme = yes

# only for convenience, to have one prompt less to describe
set auto_edit = yes
set edit_headers = yes
  1. neomutt -F neomuttrc-oppenc-smime -- foo@example.org Important: you need the certificate for foo@example.org in order for opportunistic encryption to kick in and encrypt the message.
  2. Save and quit editor (possibly answering some prompts beforehand)
  3. Back in the compose menu, see the line for Security
    Security: Encrypt (S/MIME) (OppEnc mEncrypt with: aes256

    The "(OppEnc mode)" is truncated

Suggestion

Place Encrypt with: header in a separate line like Sign as: (I never understood why this wasn't the case.)

NeoMutt Version

20220429-371-e26e9d
gahr commented 1 year ago

I like the idea of putting Encrypt with: in a separate line

flatcap commented 1 year ago

Place Encrypt with: header in a separate line like Sign as: (I never understood why this wasn't the case.)

Mutt's Compose drawing code is a desperate mess of hard-coded positions. They have a fixed size of window for the envelope.

A few years ago, I rewrote the Compose dialog to have a fluid layout. This means making the change you've suggested should be fairly straightforward.

Demo of Compose fluid layout: https://vimeo.com/407231157

flatcap commented 1 year ago

Most dialogs, including Compose, have two phases of drawing: recalc() and repaint() https://neomutt.org/code/group__window__api.html

recalc() does the "slow" work of generating any data needed for display. repaint() just paints the screen (and should be "fast").

Here's the code layout for the Compose Envelope Window

graph LR
calc_envelope --> calc_address
calc_envelope --> calc_security
calc_envelope --> calc_user_hdrs
draw_crypt_lines --> draw_floating
draw_crypt_lines --> draw_header
draw_envelope --> draw_crypt_lines
draw_envelope --> draw_envelope_addr
draw_envelope --> draw_envelope_user_hdrs
draw_envelope --> draw_header
draw_envelope --> draw_mix_line
draw_envelope_addr --> draw_header
draw_envelope_user_hdrs --> draw_header
draw_envelope_user_hdrs --> draw_header_content
draw_mix_line --> draw_header
env_recalc --> calc_envelope
env_repaint --> draw_envelope

Determine how many lines we'll need: https://github.com/neomutt/neomutt/blob/64701f92be2921611c9907472ecf6005e17d20f1/envelope/window.c#L263

Actually draw them: https://github.com/neomutt/neomutt/blob/64701f92be2921611c9907472ecf6005e17d20f1/envelope/window.c#L389

Would anyone like to have a go at this?