Skip to content

Conversation

@brandonpayton
Copy link
Contributor

@brandonpayton brandonpayton commented Nov 25, 2023

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 Fix configobj to relay tuple type errors #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.

return width, part_w


def pad_content(content, alignment, min_width):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed documenting this new function. Will fix.

@brandonpayton brandonpayton force-pushed the support-text-wrapping branch 2 times, most recently from 0b11c06 to 4d84194 Compare November 27, 2023 20:20
@brandonpayton
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant