Don't remove whitespaces from plaintext messages

Description

When one receives a plaintext message in Mailspring, the program trims all lines (i.e. removes whitespaces from both sides of the line), and removes duplicated whitespaces from the middle of every line too.

Why I think this is a bug

In many cases, plaintext messages have whitespaces that serves to format the way the text is shown. For example: I manage a Linux server which sends me messages about various status changes, and many shell commands use whitespaces in their outputs to align items in rows and columns. Mailspring messes up everything. As an example, this:

               total       used       free     shared    buffers     cached
  Mem:          7964       5581       2382          0         80       2309
  -/+ buffers/cache:       3192       4772
  Swap:        32767          0      32767

becomes:

total used free shared buffers cached
Mem: 7964 5344 2619 0 43 2214
-/+ buffers/cache: 3086 4878
Swap: 32767 0 32767

which is not suitable.

To Reproduce…

  1. Send a plaintext message to yourself with whitespaces at the beginning and at the end of lines, and double whitespaces at the middle of lines (you can simply copy my example above.)
  2. Receive the message in Mailspring.

Expected Behavior

Mailspring shouldn’t remove whitespaces, or should at least offer an option to set the desired behaviour.

(If there is already an option to change this, please tell me because I didn’t find it.)

Setup

  • OS and Version: Windows 10 Pro 20H2
  • Mailspring Version: 1.7.8

Thanks in advance.


(Originally posted by josiasmat on GitHub.)