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