568dad64 — Nate Ijams 2 years ago master
Wrap text to 72 characters instead of 76, update README
Fix installer to work on macOS 10.15 and later

Mail.app moved from /Applications to /System/Applications in macOS 10.15
Catalina. Check both locations when reading Mail.app version and
compatibility UUIDs.

Fix contributed by Ethan Jackwitz <ethanjackwitz@gmail.com>
Update installation instructions for macOS 10.14
Fix a rare bug when sending a message with an empty body text
Preserve names containing commas when fixing attribution line

Trim the attribution line a little less aggressively to avoid removing
parts of the sender's name before the last comma.
e71d6c62 — Ryan Huang 5 years ago
Fix installer to work on patch releases of macOS

The install.py script incorrectly creates a key


instead of


in the plugin bundle's Info.plist on macOS 10.13.1. Ignore the patch
component of the OS version number when generating this key.
Fix rendering of indented lines in text/plain parts again

Whilst it would be shocking to discover that Apple have fixed their
long-standing rendering bug with indented lines in text/plain parts, it
is less surprising to find that random code churn has broken our fix.

Swizzle the _decodeText selector of MCMimePart rather than
_decodeTextPlain as the latter is now missing in action.
Monkey patch shutil.copystat to work around Apple incompetence

Apple carelessly broke their bundled py2app when implementing the System
Integrity Protection feature in OS X 10.11 'El Capitan'. It is still
broken in macOS 10.13 'High Sierra' despite numerous bug reports over
the intervening years.

Previous versions of MailFlow advised users to disable SIP or wait for
the bug to be fixed, but this has been inconveniencing users for far too
long. Apple's attention is clearly focused elsewhere, perhaps on vital
cosmetic trivia.

The installer crashes because Apple's bundled py2app copies a file from
the system Python.framework as it builds the plugin bundle, and attempts
to preserve file flags including the SIP 'restricted' flag. The crash
can be avoided by replacing shutil.copystat with a version that
preserves mode and utime but not file flags.
Update MailFlow for Mail 11.0 and macOS 10.13 'High Sierra'

None of the long-standing problems MailFlow addresses have been fixed
upstream. System Integrity Protection still carelessly breaks py2app two
years after the problem was reported.
Update MailFlow for Mail 10.0 and macOS 10.12 'Sierra'

Clear up the usual breakage from Apple's annual rearranging of
deckchairs. None of the long-standing problems MailFlow addresses have
been fixed upstream. System Integrity Protection still carelessly breaks
py2app a year after the problem was reported.
Avoid using 8-bit encoding for binary attachments

Fix a bug which forced an 8-bit encoding for binary attachments as well
as text/plain parts, corrupting any NUL bytes.
Preserve all trailing newlines in text/plain parts

Fix a bug which removed the last trailing newline from every text/plain
part when reflowing the text. (This was most visible when attachments
were included right after the last line of the message body.)
Factor out class/category lookup and simplify swizzle syntax

Introduce a wrapper to look up classes/categories by name, and modify
the swizzle decorator to take the name of the class to be patched rather
than the class itself.
Correctly fix attribution line for replies triggered by AppleScript

When a reply is triggered by AppleScript, the message type is 8 rather
than 1 (for standard reply) or 2 (for standard reply-to-all). Fix the
attribution line in all three cases.
Prevent Increase/Decrease Indentation from removing attachments

The plain text Increase/Decrease Indentation operations detect blank
lines using selectedDOMRange().stringValue().isspace(). This fails to
spot paragraphs containing only whitespace, images and attachments,
which are then deleted. Detect these cases more carefully to avoid the
inadvertent loss of images and attachments.
Update MailFlow for Mail 9.0 and OS X 10.11 'El Capitan'

The DocumentEditor class has been replaced by ComposeViewController and
the cursor now needs to be positioned in the show selector instead of
finishLoadingEditor. Rework the attribution clean-up code to fit this
brave new world.

The version of py2app shipping with OS X 10.11 is broken by the new
System Integrity Protection feature. Document this with instructions for
disabling 'rootless' mode and removing the offending file flags until
the system py2app is properly fixed.
Fix Increase/Decrease Indentation for plain text messages

Mail has built-in operations to increase and decrease the indentation
level of lines or blocks of text. They use <blockquote> elements when
composing HTML messages but are not available in plain text mode.

Extend these operations to insert or remove two-space indentation at the
start of lines when composing plain text messages. This is particularly
useful when generating flowed text as indented text is not reflowed.
Fix rendering of indented lines in text/plain parts

Mail has a rendering bug which drops one leading space from indented
lines in text/plain messages. As well as interfering with column
alignment, this also corrupts inline patches which could otherwise be
copied and pasted directly into patch or git apply.

When converting the text/plain part to HTML for display in a WebView,
all but the first leading space is rendered as '&nbsp;' so, for example,
a line '  foo' becomes '<BR> &nbsp;foo'. However, WebKit will then
display this as ' foo' not '  foo'.

To work around this, swizzle the decodeTextPlainWithContext: selector of
MCMimePart to translate a space following a '<BR>' (or at the start of
the rendered fragment) into '&nbsp;' just before returning the HTML for
rendering. Mail always translates line-breaks to '<BR>', not '<br>' or
'<BR />'. A case-sensitive literal match is therefore used for speed,
minimising the impact on UI latency.
Use Option key to select inline forwarding format
Disable format=flowed if Option key held whilst sending

It is easy to forget to toggle flowed text back on after disabling it
using the Flow Text option in the Format menu, potentially leading to
unintended and embarrassing unwrapped messages. Even after sending,
these are not obvious within Mail as it will automatically wrap long
lines in the message viewer.

Replace the dangerously persistent disabled/enabled state implemented by
the 'Flow Text' menu item with a momentary Option-key modifier to
disable format=flowed whilst sending.