word-wrap

A library for word-wrapping

https://github.com/jtdaugherty/word-wrap/

Version on this page:0.4.1@rev:1
LTS Haskell 22.43:0.5
Stackage Nightly 2024-12-07:0.5
Latest on Hackage:0.5

See all snapshots word-wrap appears in

BSD-3-Clause licensed by Jonathan Daugherty
Maintained by [email protected]
This version can be pinned in stack with:word-wrap-0.4.1@sha256:f72233b383ef569c557bfd9812cbb8e306c415ce509082c0bd15ee51c0239ccc,1606

Module documentation for 0.4.1

Depends on 2 packages(full list with versions):
Used by 1 package in lts-16.11(full list with versions):

word-wrap

This library provides text-wrapping functionality.

Changes

0.4.1

Bug fixes:

  • Fixed a bug that caused breakTokens to diverge for lines with indentation longer than the indentation width when preserveIndentation was enabled. (Thanks Callum Oakley.) The resulting fix does the following:
    • When breakLongWords is enabled, this change reduces the indentation of the indented lines to result in lines that are no longer than the wrap limit, so they will have reduced indentation and word fragments. This is a trade-off with other options that are open to evaluation.
    • When breakLongWords is disabled, this change reduces the indentation of the indented lines and leaves whole words, unbroken, on them, resulting in lines that are longer than the indentation limit. This behavior is similar to non-indented lines with over-long tokens. This is also a trade-off with other options that are open to evaluation.

0.4

Bug fixes:

  • Fixed a bug where each line was being wrapped after every word because only one case in breakTokens was reached (thanks Callum Oakley)

Package changes:

  • Added a simple benchmark suite

0.3.3

Bug fixes:

  • Fixed accidental breaking of long tokens when they could be wrapped instead.

0.3.2

Bug fixes:

  • Fixed a bug that prevented wrapping sometimes.

0.3.1

Bug fixes:

  • Fix inconsistent long token breaking (long tokens anywhere but the beginning of a line)

0.3

API changes:

  • Added the breakLongWords setting to WrapSettings. This setting makes it possible to cause words to get broken up over multiple lines if their lengths exceed the wrapping width.

0.2

API changes:

  • Added a WrapSettings data type for controlling wrapping behavior.
  • All functions now require a WrapSettings.
  • Added defaultWrapSettings for prior behavior.
  • Wrap settings now include a setting to control how indentation is preserved in broken lines.

Bug fixes:

  • Lines with only whitespace are preserved as empty lines.

0.1.2

Bug fixes:

  • Fixed a bug where multiple consecutive newlines were not properly preserved as advertised (#2)

0.1.1

Package changes:

  • Removed a duplicate mention of the changelog file in the cabal package description that used the wrong filename case (#1)

0.1

  • First version.