pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
681 stars 162 forks source link

Support wrapping column text over multiple lines #1634

Open brandonpayton opened 7 months ago

brandonpayton commented 7 months ago

This PR adds text wrapping for regular text fields to help address issue #1418.

It adds text wrapping support for thread parts like authors, subject, and content but not for tags.

To make a thread part wrappable, use the following config:

# width = 'wrap', min-width, max-width, min-lines, max-lines
width = 'wrap', 40, 40, 2, 2

This results in thread lines like: alot-wrapping-example

A few notes:

  1. The new tuple validation in configobj takes the same form as proposed in #1633.
  2. For readability, it seems like it would be good to support textwrap.wrap()'s initial_indent and subsequent_indent arguments to better delineate the start of wrapped parts and their subsequent lines, but for the sake of simplicity, that is left for a follow-up PR.
  3. These changes do not yet include documentation updates, but I am happy to add those here or in a later PR if this feature addition looks good to you.
brandonpayton commented 7 months ago

I added some missing docs, rebased to incorporate width_tuple validation updates, and added more configobj tests. I think this is ready for review.