| 1 |
# Changelog |
| 2 |
|
| 3 |
This file lists the most important changes made in each release of `textwrap`. |
| 4 |
|
| 5 |
## Version 0.16.4 (2026-09-13) |
| 6 |
|
| 7 |
- [#628](https://github.com/mgeisler/textwrap/pull/628): Reduce MSRV to 1.88. |
| 8 |
|
| 9 |
## Version 0.16.3 (2026-09-10) |
| 10 |
|
| 11 |
This release adds `no_std` support as well as optional support for wrapping |
| 12 |
complex Unicode scripts such as Khmer, Lao, Myanmar, and Thai. The minimum |
| 13 |
supported Rust version is now 1.90. |
| 14 |
|
| 15 |
- [#586](https://github.com/mgeisler/textwrap/pull/586): Make `Word::width` |
| 16 |
public so it can be used without `Word::from`. |
| 17 |
- [#587](https://github.com/mgeisler/textwrap/pull/587): Add |
| 18 |
`Options::preserve_trailing_space` to keep trailing whitespace when wrapping |
| 19 |
text. |
| 20 |
- [#594](https://github.com/mgeisler/textwrap/pull/594): Add example showing how |
| 21 |
one can use owned `Options`. |
| 22 |
- [#597](https://github.com/mgeisler/textwrap/pull/597): Add GitHub Sponsors |
| 23 |
configuration. |
| 24 |
- [#608](https://github.com/mgeisler/textwrap/pull/608): Switch from |
| 25 |
`unicode-linebreak` to `icu_segmenter`. |
| 26 |
- [#623](https://github.com/mgeisler/textwrap/pull/623): Avoid arithmetic |
| 27 |
overflow in `wrap_columns`. |
| 28 |
- [#626](https://github.com/mgeisler/textwrap/pull/626): Add `no_std` support. |
| 29 |
|
| 30 |
## Version 0.16.2 (2025-03-03) |
| 31 |
|
| 32 |
This release fixes an unnecessary `f64` cast, updates all dependencies, bumps |
| 33 |
the minimum supported Rust version to 1.70. |
| 34 |
|
| 35 |
- [#540](https://github.com/mgeisler/textwrap/pull/540): Avoid spurious `f64` |
| 36 |
cast and comparison. |
| 37 |
- [#565](https://github.com/mgeisler/textwrap/pull/565): Configure automatic |
| 38 |
Dependabot updates. |
| 39 |
- [#579](https://github.com/mgeisler/textwrap/pull/579): Bump `rust-version` to |
| 40 |
1.70. |
| 41 |
|
| 42 |
## Version 0.16.1 (2024-02-17) |
| 43 |
|
| 44 |
This release fixes `display_width` to ignore inline-hyperlinks. The minimum |
| 45 |
supported version of Rust is now documented to be 1.56. |
| 46 |
|
| 47 |
- [#526](https://github.com/mgeisler/textwrap/pull/526): Ignore ANSI hyperlinks |
| 48 |
in `display_width`: calculations. |
| 49 |
- [#521](https://github.com/mgeisler/textwrap/pull/521): Add `Options::width` |
| 50 |
setter method. |
| 51 |
- [#520](https://github.com/mgeisler/textwrap/pull/520): Clarify that |
| 52 |
`WordSeparator` is an enum rather than a trait. |
| 53 |
- [#518](https://github.com/mgeisler/textwrap/pull/518): Test with latest stable |
| 54 |
and nightly Rust, but check that we can build with Rust 1.56. |
| 55 |
|
| 56 |
## Version 0.16.0 (2022-10-23) |
| 57 |
|
| 58 |
This release marks `Options` as `non_exhaustive` and extends it to make line |
| 59 |
endings configurable, it adds new fast paths to `fill` and `wrap`, and it fixes |
| 60 |
crashes in `unfill` and `refill`. |
| 61 |
|
| 62 |
- [#480](https://github.com/mgeisler/textwrap/pull/480): Mark `Options` as |
| 63 |
`non_exhaustive`. This will allow us to extend the struct in the future |
| 64 |
without breaking backwards compatibility. |
| 65 |
- [#478](https://github.com/mgeisler/textwrap/pull/478): Add fast paths to |
| 66 |
`fill` and `wrap`. This makes the functions 10-25 times faster when the no |
| 67 |
wrapping is needed. |
| 68 |
- [#468](https://github.com/mgeisler/textwrap/pull/468): Fix `refill` to add |
| 69 |
back correct line ending. |
| 70 |
- [#467](https://github.com/mgeisler/textwrap/pull/467): Fix crashes in `unfill` |
| 71 |
and `refill`. |
| 72 |
- [#458](https://github.com/mgeisler/textwrap/pull/458): Test with Rust 1.56 |
| 73 |
(first compiler release with support for Rust 2021). |
| 74 |
- [#454](https://github.com/mgeisler/textwrap/pull/454): Make line endings |
| 75 |
configurable. |
| 76 |
- [#448](https://github.com/mgeisler/textwrap/pull/448): Migrate to the Rust |
| 77 |
2021 edition. |
| 78 |
|
| 79 |
## Version 0.15.2 (2022-10-24) |
| 80 |
|
| 81 |
This release is identical to 0.15.0 and is only there to give people a way to |
| 82 |
install crates which depend on the yanked 0.15.1 release. See |
| 83 |
[#484](https://github.com/mgeisler/textwrap/issues/484) for details. |
| 84 |
|
| 85 |
## Version 0.15.1 (2022-09-15) |
| 86 |
|
| 87 |
This release was yanked since it accidentally broke backwards compatibility with |
| 88 |
0.15.0. |
| 89 |
|
| 90 |
## Version 0.15.0 (2022-02-27) |
| 91 |
|
| 92 |
This is a major feature release with two main changes: |
| 93 |
|
| 94 |
- [#421](https://github.com/mgeisler/textwrap/pull/421): Use `f64` instead of |
| 95 |
`usize` for fragment widths. |
| 96 |
|
| 97 |
This fixes problems with overflows in the internal computations of |
| 98 |
`wrap_optimal_fit` when fragments (words) or line lengths had extreme values, |
| 99 |
such as `usize::MAX`. |
| 100 |
|
| 101 |
- [#438](https://github.com/mgeisler/textwrap/pull/438): Simplify `Options` by |
| 102 |
removing generic type parameters. |
| 103 |
|
| 104 |
This change removes the new generic parameters introduced in version 0.14, as |
| 105 |
well as the original `WrapSplitter` parameter which has been present since |
| 106 |
very early versions. |
| 107 |
|
| 108 |
The result is a simplification of function and struct signatures across the |
| 109 |
board. So what used to be |
| 110 |
|
| 111 |
```rust |
| 112 |
let options: Options< |
| 113 |
wrap_algorithms::FirstFit, |
| 114 |
word_separators::AsciiSpace, |
| 115 |
word_splitters::HyphenSplitter, |
| 116 |
> = Options::new(80); |
| 117 |
``` |
| 118 |
|
| 119 |
if types are fully written out, is now simply |
| 120 |
|
| 121 |
```rust |
| 122 |
let options: Options<'_> = Options::new(80); |
| 123 |
``` |
| 124 |
|
| 125 |
The anonymous lifetime represent the lifetime of the `initial_indent` and |
| 126 |
`subsequent_indent` strings. The change is nearly performance neutral (a 1-2% |
| 127 |
regression). |
| 128 |
|
| 129 |
Smaller improvements and changes: |
| 130 |
|
| 131 |
- [#404](https://github.com/mgeisler/textwrap/pull/404): Make documentation for |
| 132 |
short last-line penalty more precise. |
| 133 |
- [#405](https://github.com/mgeisler/textwrap/pull/405): Cleanup and simplify |
| 134 |
`Options` docstring. |
| 135 |
- [#411](https://github.com/mgeisler/textwrap/pull/411): Default to `OptimalFit` |
| 136 |
in interactive example. |
| 137 |
- [#415](https://github.com/mgeisler/textwrap/pull/415): Add demo program to |
| 138 |
help compute binary sizes. |
| 139 |
- [#423](https://github.com/mgeisler/textwrap/pull/423): Add fuzz tests with |
| 140 |
fully arbitrary fragments. |
| 141 |
- [#424](https://github.com/mgeisler/textwrap/pull/424): Change |
| 142 |
`wrap_optimal_fit` penalties to non-negative numbers. |
| 143 |
- [#430](https://github.com/mgeisler/textwrap/pull/430): Add `debug-words` |
| 144 |
example. |
| 145 |
- [#432](https://github.com/mgeisler/textwrap/pull/432): Use precise dependency |
| 146 |
versions in Cargo.toml. |
| 147 |
|
| 148 |
## Version 0.14.2 (2021-06-27) |
| 149 |
|
| 150 |
The 0.14.1 release included more changes than intended and has been yanked. The |
| 151 |
change intended for 0.14.1 is now included in 0.14.2. |
| 152 |
|
| 153 |
## Version 0.14.1 (2021-06-26) |
| 154 |
|
| 155 |
This release fixes a panic reported by @Makoto, thanks! |
| 156 |
|
| 157 |
- [#391](https://github.com/mgeisler/textwrap/pull/391): Fix panic in |
| 158 |
`find_words` due to string access outside of a character boundary. |
| 159 |
|
| 160 |
## Version 0.14.0 (2021-06-05) |
| 161 |
|
| 162 |
This is a major feature release which makes Textwrap more configurable and |
| 163 |
flexible. The high-level API of `textwrap::wrap` and `textwrap::fill` remains |
| 164 |
unchanged, but low-level structs have moved around. |
| 165 |
|
| 166 |
The biggest change is the introduction of new generic type parameters to the |
| 167 |
`Options` struct. These parameters lets you statically configure the wrapping |
| 168 |
algorithm, the word separator, and the word splitter. If you previously spelled |
| 169 |
out the full type for `Options`, you now need to take the extra type parameters |
| 170 |
into account. This means that |
| 171 |
|
| 172 |
```rust |
| 173 |
let options: Options<HyphenSplitter> = Options::new(80); |
| 174 |
``` |
| 175 |
|
| 176 |
changes to |
| 177 |
|
| 178 |
```rust |
| 179 |
let options: Options< |
| 180 |
wrap_algorithms::FirstFit, |
| 181 |
word_separators::AsciiSpace, |
| 182 |
word_splitters::HyphenSplitter, |
| 183 |
> = Options::new(80); |
| 184 |
``` |
| 185 |
|
| 186 |
This is quite a mouthful, so we suggest using type inference where possible. You |
| 187 |
won’t see any chance if you call `wrap` directly with a width or with an |
| 188 |
`Options` value constructed on the fly. Please open an issue if this causes |
| 189 |
problems for you! |
| 190 |
|
| 191 |
### New `WordSeparator` Trait |
| 192 |
|
| 193 |
- [#332](https://github.com/mgeisler/textwrap/pull/332): Add `WordSeparator` |
| 194 |
trait to allow customizing how words are found in a line of text. Until now, |
| 195 |
Textwrap would always assume that words are separated by ASCII space |
| 196 |
characters. You can now customize this as needed. |
| 197 |
|
| 198 |
- [#313](https://github.com/mgeisler/textwrap/pull/313): Add support for using |
| 199 |
the Unicode line breaking algorithm to find words. This is done by adding a |
| 200 |
second implementation of the new `WordSeparator` trait. The implementation |
| 201 |
uses the unicode-linebreak crate, which is a new optional dependency. |
| 202 |
|
| 203 |
With this, Textwrap can be used with East-Asian languages such as Chinese or |
| 204 |
Japanese where there are no spaces between words. Breaking a long sequence of |
| 205 |
emojis is another example where line breaks might be wanted even if there are |
| 206 |
no whitespace to be found. Feedback would be appreciated for this feature. |
| 207 |
|
| 208 |
### Indent |
| 209 |
|
| 210 |
- [#353](https://github.com/mgeisler/textwrap/pull/353): Trim trailing |
| 211 |
whitespace from `prefix` in `indent`. |
| 212 |
|
| 213 |
Before, empty lines would get no prefix added. Now, empty lines have a trimmed |
| 214 |
prefix added. This little trick makes `indent` much more useful since you can |
| 215 |
now safely indent with `"# "` without creating trailing whitespace in the |
| 216 |
output due to the trailing whitespace in your prefix. |
| 217 |
|
| 218 |
- [#354](https://github.com/mgeisler/textwrap/pull/354): Make `indent` about 20% |
| 219 |
faster by preallocating the output string. |
| 220 |
|
| 221 |
### Documentation |
| 222 |
|
| 223 |
- [#308](https://github.com/mgeisler/textwrap/pull/308): Document handling of |
| 224 |
leading and trailing whitespace when wrapping text. |
| 225 |
|
| 226 |
### WebAssembly Demo |
| 227 |
|
| 228 |
- [#310](https://github.com/mgeisler/textwrap/pull/310): Thanks to WebAssembly, |
| 229 |
you can now try out Textwrap directly in your browser. Please try it out: |
| 230 |
https://mgeisler.github.io/textwrap/. |
| 231 |
|
| 232 |
### New Generic Parameters |
| 233 |
|
| 234 |
- [#331](https://github.com/mgeisler/textwrap/pull/331): Remove outer boxing |
| 235 |
from `Options`. |
| 236 |
|
| 237 |
- [#357](https://github.com/mgeisler/textwrap/pull/357): Replace |
| 238 |
`core::WrapAlgorithm` enum with a `wrap_algorithms::WrapAlgorithm` trait. This |
| 239 |
allows for arbitrary wrapping algorithms to be plugged into the library. |
| 240 |
|
| 241 |
- [#358](https://github.com/mgeisler/textwrap/pull/358): Switch wrapping |
| 242 |
functions to use a slice for `line_widths`. |
| 243 |
|
| 244 |
- [#368](https://github.com/mgeisler/textwrap/pull/368): Move `WordSeparator` |
| 245 |
and `WordSplitter` traits to separate modules. Before, Textwrap had several |
| 246 |
top-level structs such as `NoHyphenation` and `HyphenSplitter`. These |
| 247 |
implementations of `WordSplitter` now lives in a dedicated `word_splitters` |
| 248 |
module. Similarly, we have a new `word_separators` module for implementations |
| 249 |
of `WordSeparator`. |
| 250 |
|
| 251 |
- [#369](https://github.com/mgeisler/textwrap/pull/369): Rename |
| 252 |
`Options::splitter` to `Options::word_splitter` for consistency with the other |
| 253 |
fields backed by traits. |
| 254 |
|
| 255 |
## Version 0.13.4 (2021-02-23) |
| 256 |
|
| 257 |
This release removes `println!` statements which was left behind in `unfill` by |
| 258 |
mistake. |
| 259 |
|
| 260 |
- [#296](https://github.com/mgeisler/textwrap/pull/296): Improve house building |
| 261 |
example with more comments. |
| 262 |
- [#297](https://github.com/mgeisler/textwrap/pull/297): Remove debug prints in |
| 263 |
the new `unfill` function. |
| 264 |
|
| 265 |
## Version 0.13.3 (2021-02-20) |
| 266 |
|
| 267 |
This release contains a bugfix for `indent` and improved handling of emojis. |
| 268 |
We’ve also added a new function for formatting text in columns and functions for |
| 269 |
reformatting already wrapped text. |
| 270 |
|
| 271 |
- [#276](https://github.com/mgeisler/textwrap/pull/276): Extend |
| 272 |
`core::display_width` to handle emojis when the unicode-width Cargo feature is |
| 273 |
disabled. |
| 274 |
- [#279](https://github.com/mgeisler/textwrap/pull/279): Make `indent` preserve |
| 275 |
existing newlines in the input string. Before, `indent("foo", "")` would |
| 276 |
return `"foo\n"` by mistake. It now returns `"foo"` instead. |
| 277 |
- [#281](https://github.com/mgeisler/textwrap/pull/281): Ensure all `Options` |
| 278 |
fields have examples. |
| 279 |
- [#282](https://github.com/mgeisler/textwrap/pull/282): Add a `wrap_columns` |
| 280 |
function. |
| 281 |
- [#294](https://github.com/mgeisler/textwrap/pull/294): Add new `unfill` and |
| 282 |
`refill` functions. |
| 283 |
|
| 284 |
## Version 0.13.2 (2020-12-30) |
| 285 |
|
| 286 |
This release primarily makes all dependencies optional. This makes it possible |
| 287 |
to slim down textwrap as needed. |
| 288 |
|
| 289 |
- [#254](https://github.com/mgeisler/textwrap/pull/254): `impl WordSplitter` for |
| 290 |
`Box<T> where T: WordSplitter`. |
| 291 |
- [#255](https://github.com/mgeisler/textwrap/pull/255): Use command line |
| 292 |
arguments as initial text in interactive example. |
| 293 |
- [#256](https://github.com/mgeisler/textwrap/pull/256): Introduce fuzz tests |
| 294 |
for `wrap_optimal_fit` and `wrap_first_fit`. |
| 295 |
- [#260](https://github.com/mgeisler/textwrap/pull/260): Make the unicode-width |
| 296 |
dependency optional. |
| 297 |
- [#261](https://github.com/mgeisler/textwrap/pull/261): Make the smawk |
| 298 |
dependency optional. |
| 299 |
|
| 300 |
## Version 0.13.1 (2020-12-10) |
| 301 |
|
| 302 |
This is a bugfix release which fixes a regression in 0.13.0. The bug meant that |
| 303 |
colored text was wrapped incorrectly. |
| 304 |
|
| 305 |
- [#245](https://github.com/mgeisler/textwrap/pull/245): Support deleting a word |
| 306 |
with Ctrl-Backspace in the interactive demo. |
| 307 |
- [#246](https://github.com/mgeisler/textwrap/pull/246): Show build type |
| 308 |
(debug/release) in interactive demo. |
| 309 |
- [#249](https://github.com/mgeisler/textwrap/pull/249): Correctly compute width |
| 310 |
while skipping over ANSI escape sequences. |
| 311 |
|
| 312 |
## Version 0.13.0 (2020-12-05) |
| 313 |
|
| 314 |
This is a major release which rewrites the core logic, adds many new features, |
| 315 |
and fixes a couple of bugs. Most programs which use `textwrap` stays the same, |
| 316 |
incompatibilities and upgrade notes are given below. |
| 317 |
|
| 318 |
Clone the repository and run the following to explore the new features in an |
| 319 |
interactive demo (Linux only): |
| 320 |
|
| 321 |
```sh |
| 322 |
$ cargo run --example interactive --all-features |
| 323 |
``` |
| 324 |
|
| 325 |
### Bug Fixes |
| 326 |
|
| 327 |
#### Rewritten core wrapping algorithm |
| 328 |
|
| 329 |
- [#221](https://github.com/mgeisler/textwrap/pull/221): Reformulate wrapping in |
| 330 |
terms of words with whitespace and penalties. |
| 331 |
|
| 332 |
The core wrapping algorithm has been completely rewritten. This fixed bugs and |
| 333 |
simplified the code, while also making it possible to use `textwrap` outside the |
| 334 |
context of the terminal. |
| 335 |
|
| 336 |
As part of this, trailing whitespace is now discarded consistently from wrapped |
| 337 |
lines. Before we would inconsistently remove whitespace at the end of wrapped |
| 338 |
lines, except for the last. Leading whitespace is still preserved. |
| 339 |
|
| 340 |
### New Features |
| 341 |
|
| 342 |
#### Optimal-fit wrapping |
| 343 |
|
| 344 |
- [#234](https://github.com/mgeisler/textwrap/pull/234): Introduce wrapping |
| 345 |
using an optimal-fit algorithm. |
| 346 |
|
| 347 |
This release adds support for new wrapping algorithm which finds a globally |
| 348 |
optimal set of line breaks, taking certain penalties into account. As an |
| 349 |
example, the old algorithm would produce |
| 350 |
|
| 351 |
"To be, or" |
| 352 |
"not to be:" |
| 353 |
"that is" |
| 354 |
"the" |
| 355 |
"question" |
| 356 |
|
| 357 |
Notice how the fourth line with “the” is very short. The new algorithm shortens |
| 358 |
the previous lines slightly to produce fewer short lines: |
| 359 |
|
| 360 |
"To be," |
| 361 |
"or not to" |
| 362 |
"be: that" |
| 363 |
"is the" |
| 364 |
"question" |
| 365 |
|
| 366 |
Use the new `textwrap::core::WrapAlgorithm` enum to select between the new and |
| 367 |
old algorithm. By default, the new algorithm is used. |
| 368 |
|
| 369 |
The optimal-fit algorithm is inspired by the line breaking algorithm used in |
| 370 |
TeX, described in the 1981 article |
| 371 |
[_Breaking Paragraphs into Lines_](http://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf) |
| 372 |
by Knuth and Plass. |
| 373 |
|
| 374 |
#### In-place wrapping |
| 375 |
|
| 376 |
- [#226](https://github.com/mgeisler/textwrap/pull/226): Add a `fill_inplace` |
| 377 |
function. |
| 378 |
|
| 379 |
When the text you want to fill is already a temporary `String`, you can now |
| 380 |
mutate it in-place with `fill_inplace`: |
| 381 |
|
| 382 |
```rust |
| 383 |
let mut greeting = format!("Greetings {}, welcome to the game! You have {} lives left.", |
| 384 |
player.name, player.lives); |
| 385 |
fill_inplace(&mut greeting, line_width); |
| 386 |
``` |
| 387 |
|
| 388 |
This is faster than calling `fill` and it will reuse the memory already |
| 389 |
allocated for the string. |
| 390 |
|
| 391 |
### Changed Features |
| 392 |
|
| 393 |
#### `Wrapper` is replaced with `Options` |
| 394 |
|
| 395 |
- [#213](https://github.com/mgeisler/textwrap/pull/213): Simplify API with only |
| 396 |
top-level functions. |
| 397 |
- [#215](https://github.com/mgeisler/textwrap/pull/215): Reintroducing the type |
| 398 |
parameter on `Options` (previously known as `Wrapper`). |
| 399 |
- [#219](https://github.com/mgeisler/textwrap/pull/219): Allow using trait |
| 400 |
objects with `fill` & `wrap`. |
| 401 |
- [#227](https://github.com/mgeisler/textwrap/pull/227): Replace `WrapOptions` |
| 402 |
with `Into<Options>`. |
| 403 |
|
| 404 |
The `Wrapper` struct held the options (line width, indentation, etc) for |
| 405 |
wrapping text. It was also the entry point for actually wrapping the text via |
| 406 |
its methods such as `wrap`, `wrap_iter`, `into_wrap_iter`, and `fill` methods. |
| 407 |
|
| 408 |
The struct has been replaced by a simpler `Options` struct which only holds |
| 409 |
options. The `Wrapper` methods are gone, their job has been taken over by the |
| 410 |
top-level `wrap` and `fill` functions. The signature of these functions have |
| 411 |
changed from |
| 412 |
|
| 413 |
```rust |
| 414 |
fn fill(s: &str, width: usize) -> String; |
| 415 |
|
| 416 |
fn wrap(s: &str, width: usize) -> Vec<Cow<'_, str>>; |
| 417 |
``` |
| 418 |
|
| 419 |
to the more general |
| 420 |
|
| 421 |
```rust |
| 422 |
fn fill<'a, S, Opt>(text: &str, options: Opt) -> String |
| 423 |
where |
| 424 |
S: WordSplitter, |
| 425 |
Opt: Into<Options<'a, S>>; |
| 426 |
|
| 427 |
fn wrap<'a, S, Opt>(text: &str, options: Opt) -> Vec<Cow<'_, str>> |
| 428 |
where |
| 429 |
S: WordSplitter, |
| 430 |
Opt: Into<Options<'a, S>>; |
| 431 |
``` |
| 432 |
|
| 433 |
The `Into<Options<'a, S>` bound allows you to pass an `usize` (which is |
| 434 |
interpreted as the line width) _and_ a full `Options` object. This allows the |
| 435 |
new functions to work like the old, plus you can now fully customize the |
| 436 |
behavior of the wrapping via `Options` when needed. |
| 437 |
|
| 438 |
Code that call `textwrap::wrap` or `textwrap::fill` can remain unchanged. Code |
| 439 |
that calls into `Wrapper::wrap` or `Wrapper::fill` will need to be update. This |
| 440 |
is a mechanical change, please see |
| 441 |
[#213](https://github.com/mgeisler/textwrap/pull/213) for examples. |
| 442 |
|
| 443 |
Thanks to @CryptJar and @Koxiat for their support in the PRs above! |
| 444 |
|
| 445 |
### Removed Features |
| 446 |
|
| 447 |
- The `wrap_iter` and `into_wrap_iter` methods are gone. This means that lazy |
| 448 |
iteration is no longer supported: you always get all wrapped lines back as a |
| 449 |
`Vec`. This was done to simplify the code and to support the optimal-fit |
| 450 |
algorithm. |
| 451 |
|
| 452 |
The first-fit algorithm could still be implemented in an incremental fashion. |
| 453 |
Please let us know if this is important to you. |
| 454 |
|
| 455 |
### Other Changes |
| 456 |
|
| 457 |
- [#206](https://github.com/mgeisler/textwrap/pull/206): Change |
| 458 |
`Wrapper.splitter` from `T: WordSplitter` to `Box<dyn WordSplitter>`. |
| 459 |
- [#216](https://github.com/mgeisler/textwrap/pull/216): Forbid the use of |
| 460 |
unsafe code. |
| 461 |
|
| 462 |
## Version 0.12.1 (2020-07-03) |
| 463 |
|
| 464 |
This is a bugfix release. |
| 465 |
|
| 466 |
- Fixed [#176][issue-176]: Mention compile-time wrapping by linking to the |
| 467 |
[`textwrap-macros` crate]. |
| 468 |
- Fixed [#193][issue-193]: Wrapping with `break_words(false)` was broken and |
| 469 |
would cause extra whitespace to be inserted when words were longer than the |
| 470 |
line width. |
| 471 |
|
| 472 |
## Version 0.12.0 (2020-06-26) |
| 473 |
|
| 474 |
The code has been updated to the [Rust 2018 edition][rust-2018] and each new |
| 475 |
release of `textwrap` will only support the latest stable version of Rust. |
| 476 |
Trying to support older Rust versions is a fool's errand: our dependencies keep |
| 477 |
releasing new patch versions that require newer and newer versions of Rust. |
| 478 |
|
| 479 |
The `term_size` feature has been replaced by `terminal_size`. The API is |
| 480 |
unchanged, it is just the name of the Cargo feature that changed. |
| 481 |
|
| 482 |
The `hyphenation` feature now only embeds the hyphenation patterns for |
| 483 |
US-English. This slims down the dependency. |
| 484 |
|
| 485 |
- Fixed [#140][issue-140]: Ignore ANSI escape sequences. |
| 486 |
- Fixed [#158][issue-158]: Unintended wrapping when using external splitter. |
| 487 |
- Fixed [#177][issue-177]: Update examples to the 2018 edition. |
| 488 |
|
| 489 |
## Version 0.11.0 (2018-12-09) |
| 490 |
|
| 491 |
Due to our dependencies bumping their minimum supported version of Rust, the |
| 492 |
minimum version of Rust we test against is now 1.22.0. |
| 493 |
|
| 494 |
- Merged [#141][issue-141]: Fix `dedent` handling of empty lines and trailing |
| 495 |
newlines. Thanks @bbqsrc! |
| 496 |
- Fixed [#151][issue-151]: Release of version with hyphenation 0.7. |
| 497 |
|
| 498 |
## Version 0.10.0 (2018-04-28) |
| 499 |
|
| 500 |
Due to our dependencies bumping their minimum supported version of Rust, the |
| 501 |
minimum version of Rust we test against is now 1.17.0. |
| 502 |
|
| 503 |
- Fixed [#99][issue-99]: Word broken even though it would fit on line. |
| 504 |
- Fixed [#107][issue-107]: Automatic hyphenation is off by one. |
| 505 |
- Fixed [#122][issue-122]: Take newlines into account when wrapping. |
| 506 |
- Fixed [#129][issue-129]: Panic on string with em-dash. |
| 507 |
|
| 508 |
## Version 0.9.0 (2017-10-05) |
| 509 |
|
| 510 |
The dependency on `term_size` is now optional, and by default this feature is |
| 511 |
not enabled. This is a _breaking change_ for users of `Wrapper::with_termwidth`. |
| 512 |
Enable the `term_size` feature to restore the old functionality. |
| 513 |
|
| 514 |
Added a regression test for the case where `width` is set to `usize::MAX`, |
| 515 |
thanks @Fraser999! All public structs now implement `Debug`, thanks @hcpl! |
| 516 |
|
| 517 |
- Fixed [#101][issue-101]: Make `term_size` an optional dependency. |
| 518 |
|
| 519 |
## Version 0.8.0 (2017-09-04) |
| 520 |
|
| 521 |
The `Wrapper` struct is now generic over the type of word splitter being used. |
| 522 |
This means less boxing and a nicer API. The `Wrapper::word_splitter` method has |
| 523 |
been removed. This is a _breaking API change_ if you used the method to change |
| 524 |
the word splitter. |
| 525 |
|
| 526 |
The `Wrapper` struct has two new methods that will wrap the input text lazily: |
| 527 |
`Wrapper::wrap_iter` and `Wrapper::into_wrap_iter`. Use those if you will be |
| 528 |
iterating over the wrapped lines one by one. |
| 529 |
|
| 530 |
- Fixed [#59][issue-59]: `wrap` could return an iterator. Thanks @hcpl! |
| 531 |
- Fixed [#81][issue-81]: Set `html_root_url`. |
| 532 |
|
| 533 |
## Version 0.7.0 (2017-07-20) |
| 534 |
|
| 535 |
Version 0.7.0 changes the return type of `Wrapper::wrap` from `Vec<String>` to |
| 536 |
`Vec<Cow<'a, str>>`. This means that the output lines borrow data from the input |
| 537 |
string. This is a _breaking API change_ if you relied on the exact return type |
| 538 |
of `Wrapper::wrap`. Callers of the `textwrap::fill` convenience function will |
| 539 |
see no breakage. |
| 540 |
|
| 541 |
The above change and other optimizations makes version 0.7.0 roughly 15-30% |
| 542 |
faster than version 0.6.0. |
| 543 |
|
| 544 |
The `squeeze_whitespace` option has been removed since it was complicating the |
| 545 |
above optimization. Let us know if this option is important for you so we can |
| 546 |
provide a work around. |
| 547 |
|
| 548 |
- Fixed [#58][issue-58]: Add a "fast_wrap" function. |
| 549 |
- Fixed [#61][issue-61]: Documentation errors. |
| 550 |
|
| 551 |
## Version 0.6.0 (2017-05-22) |
| 552 |
|
| 553 |
Version 0.6.0 adds builder methods to `Wrapper` for easy one-line initialization |
| 554 |
and configuration: |
| 555 |
|
| 556 |
```rust |
| 557 |
let wrapper = Wrapper::new(60).break_words(false); |
| 558 |
``` |
| 559 |
|
| 560 |
It also add a new `NoHyphenation` word splitter that will never split words, not |
| 561 |
even at existing hyphens. |
| 562 |
|
| 563 |
- Fixed [#28][issue-28]: Support not squeezing whitespace. |
| 564 |
|
| 565 |
## Version 0.5.0 (2017-05-15) |
| 566 |
|
| 567 |
Version 0.5.0 has _breaking API changes_. However, this only affects code using |
| 568 |
the hyphenation feature. The feature is now optional, so you will first need to |
| 569 |
enable the `hyphenation` feature as described above. Afterwards, please change |
| 570 |
your code from |
| 571 |
|
| 572 |
```rust |
| 573 |
wrapper.corpus = Some(&corpus); |
| 574 |
``` |
| 575 |
|
| 576 |
to |
| 577 |
|
| 578 |
```rust |
| 579 |
wrapper.splitter = Box::new(corpus); |
| 580 |
``` |
| 581 |
|
| 582 |
Other changes include optimizations, so version 0.5.0 is roughly 10-15% faster |
| 583 |
than version 0.4.0. |
| 584 |
|
| 585 |
- Fixed [#19][issue-19]: Add support for finding terminal size. |
| 586 |
- Fixed [#25][issue-25]: Handle words longer than `self.width`. |
| 587 |
- Fixed [#26][issue-26]: Support custom indentation. |
| 588 |
- Fixed [#36][issue-36]: Support building without `hyphenation`. |
| 589 |
- Fixed [#39][issue-39]: Respect non-breaking spaces. |
| 590 |
|
| 591 |
## Version 0.4.0 (2017-01-24) |
| 592 |
|
| 593 |
Documented complexities and tested these via `cargo bench`. |
| 594 |
|
| 595 |
- Fixed [#13][issue-13]: Immediately add word if it fits. |
| 596 |
- Fixed [#14][issue-14]: Avoid splitting on initial hyphens. |
| 597 |
|
| 598 |
## Version 0.3.0 (2017-01-07) |
| 599 |
|
| 600 |
Added support for automatic hyphenation. |
| 601 |
|
| 602 |
## Version 0.2.0 (2016-12-28) |
| 603 |
|
| 604 |
Introduced `Wrapper` struct. Added support for wrapping on hyphens. |
| 605 |
|
| 606 |
## Version 0.1.0 (2016-12-17) |
| 607 |
|
| 608 |
First public release with support for wrapping strings on whitespace. |
| 609 |
|
| 610 |
[rust-2018]: https://doc.rust-lang.org/edition-guide/rust-2018/ |
| 611 |
[`textwrap-macros` crate]: https://crates.io/crates/textwrap-macros |
| 612 |
[issue-13]: https://github.com/mgeisler/textwrap/issues/13 |
| 613 |
[issue-14]: https://github.com/mgeisler/textwrap/issues/14 |
| 614 |
[issue-19]: https://github.com/mgeisler/textwrap/issues/19 |
| 615 |
[issue-25]: https://github.com/mgeisler/textwrap/issues/25 |
| 616 |
[issue-26]: https://github.com/mgeisler/textwrap/issues/26 |
| 617 |
[issue-28]: https://github.com/mgeisler/textwrap/issues/28 |
| 618 |
[issue-36]: https://github.com/mgeisler/textwrap/issues/36 |
| 619 |
[issue-39]: https://github.com/mgeisler/textwrap/issues/39 |
| 620 |
[issue-58]: https://github.com/mgeisler/textwrap/issues/58 |
| 621 |
[issue-59]: https://github.com/mgeisler/textwrap/issues/59 |
| 622 |
[issue-61]: https://github.com/mgeisler/textwrap/issues/61 |
| 623 |
[issue-81]: https://github.com/mgeisler/textwrap/issues/81 |
| 624 |
[issue-99]: https://github.com/mgeisler/textwrap/issues/99 |
| 625 |
[issue-101]: https://github.com/mgeisler/textwrap/issues/101 |
| 626 |
[issue-107]: https://github.com/mgeisler/textwrap/issues/107 |
| 627 |
[issue-122]: https://github.com/mgeisler/textwrap/issues/122 |
| 628 |
[issue-129]: https://github.com/mgeisler/textwrap/issues/129 |
| 629 |
[issue-140]: https://github.com/mgeisler/textwrap/issues/140 |
| 630 |
[issue-141]: https://github.com/mgeisler/textwrap/issues/141 |
| 631 |
[issue-151]: https://github.com/mgeisler/textwrap/issues/151 |
| 632 |
[issue-158]: https://github.com/mgeisler/textwrap/issues/158 |
| 633 |
[issue-176]: https://github.com/mgeisler/textwrap/issues/176 |
| 634 |
[issue-177]: https://github.com/mgeisler/textwrap/issues/177 |
| 635 |
[issue-193]: https://github.com/mgeisler/textwrap/issues/193 |