-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(deps): update rust crate textwrap to 0.16 #233
Conversation
⚠ Artifact update problemRenovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is. ♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below: File name: Cargo.lock
|
6420912
to
54c6395
Compare
6e59929
to
1da3823
Compare
1da3823
to
ef078af
Compare
ef078af
to
32ef857
Compare
32ef857
to
5228b82
Compare
5228b82
to
48984e9
Compare
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. ⚠ Warning: custom changes will be lost. |
This PR contains the following updates:
0.11
->0.16
Release Notes
mgeisler/textwrap (textwrap)
v0.16.0
Compare Source
This release marks
Options
asnon_exhaustive
and extends it tomake line endings configurable, it adds new fast paths to
fill
andwrap
, and it fixes crashes inunfill
andrefill
.Options
asnon_exhaustive
. This will allow us to extend thestruct in the future without breaking backwards compatibility.
paths to
fill
andwrap
. This makes the functions 10-25 timesfaster when the no wrapping is needed.
refill
to add back correct line ending.
in
unfill
andrefill
.Rust 1.56 (first compiler release with support for Rust 2021).
endings configurable.
the Rust 2021 edition.
v0.15.2
Compare Source
This release is identical to 0.15.0 and is only there to give people a
way to install crates which depend on the yanked 0.15.1 release. See
#484 for details.
v0.15.1
Compare Source
This release was yanked since it accidentally broke backwards
compatibility with 0.15.0.
v0.15.0
Compare Source
This is a major feature release with two main changes:
#421: Use
f64
instead of
usize
for fragment widths.This fixes problems with overflows in the internal computations of
wrap_optimal_fit
when fragments (words) or line lengths hadextreme values, such as
usize::MAX
.#438: Simplify
Options
by removing generic type parameters.This change removes the new generic parameters introduced in version
0.14, as well as the original
WrapSplitter
parameter which hasbeen present since very early versions.
The result is a simplification of function and struct signatures
across the board. So what used to be
if types are fully written out, is now simply
The anonymous lifetime represent the lifetime of the
initial_indent
andsubsequent_indent
strings. The change isnearly performance neutral (a 1-2% regression).
Smaller improvements and changes:
documentation for short last-line penalty more precise.
simplify
Options
docstring.OptimalFit
in interactive example.program to help compute binary sizes.
tests with fully arbitrary fragments.
wrap_optimal_fit
penalties to non-negative numbers.debug-words
example.dependency versions in Cargo.toml.
v0.14.2
Compare Source
The 0.14.1 release included more changes than intended and has been
yanked. The change intended for 0.14.1 is now included in 0.14.2.
v0.14.1
Compare Source
This release fixes a panic reported by @Makoto, thanks!
find_words
due to string access outside of a character boundary.v0.14.0
Compare Source
This is a major feature release which makes Textwrap more configurable
and flexible. The high-level API of
textwrap::wrap
andtextwrap::fill
remains unchanged, but low-level structs have movedaround.
The biggest change is the introduction of new generic type parameters
to the
Options
struct. These parameters lets you staticallyconfigure the wrapping algorithm, the word separator, and the word
splitter. If you previously spelled out the full type for
Options
,you now need to take the extra type parameters into account. This
means that
changes to
This is quite a mouthful, so we suggest using type inference where
possible. You won’t see any chance if you call
wrap
directly with awidth or with an
Options
value constructed on the fly. Please openan issue if this causes problems for you!
New
WordSeparator
Trait#332: Add
WordSeparator
trait to allow customizing how words are found in aline of text. Until now, Textwrap would always assume that words are
separated by ASCII space characters. You can now customize this as
needed.
#313: Add support
for using the Unicode line breaking algorithm to find words. This is
done by adding a second implementation of the new
WordSeparator
trait. The implementation uses the unicode-linebreak crate, which is
a new optional dependency.
With this, Textwrap can be used with East-Asian languages such as
Chinese or Japanese where there are no spaces between words.
Breaking a long sequence of emojis is another example where line
breaks might be wanted even if there are no whitespace to be found.
Feedback would be appreciated for this feature.
Indent
#353: Trim trailing
whitespace from
prefix
inindent
.Before, empty lines would get no prefix added. Now, empty lines have
a trimmed prefix added. This little trick makes
indent
much moreuseful since you can now safely indent with
"# "
without creatingtrailing whitespace in the output due to the trailing whitespace in
your prefix.
#354: Make
indent
about 20% faster by preallocating the output string.
Documentation
handling of leading and trailing whitespace when wrapping text.
WebAssembly Demo
WebAssembly, you can now try out Textwrap directly in your browser.
Please try it out: https://mgeisler.github.io/textwrap/.
New Generic Parameters
#331: Remove outer
boxing from
Options
.#357: Replace
core::WrapAlgorithm
enum with awrap_algorithms::WrapAlgorithm
trait. This allows for arbitrary wrapping algorithms to be plugged
into the library.
#358: Switch
wrapping functions to use a slice for
line_widths
.#368: Move
WordSeparator
andWordSplitter
traits to separate modules.Before, Textwrap had several top-level structs such as
NoHyphenation
andHyphenSplitter
. These implementations ofWordSplitter
now lives in a dedicatedword_splitters
module.Similarly, we have a new
word_separators
module forimplementations of
WordSeparator
.#369: Rename
Options::splitter
toOptions::word_splitter
for consistency withthe other fields backed by traits.
v0.13.4
Compare Source
This release removes
println!
statements which was left behind inunfill
by mistake.building example with more comments.
prints in the new
unfill
function.v0.13.3
Compare Source
This release contains a bugfix for
indent
and improved handling ofemojis. We’ve also added a new function for formatting text in columns
and functions for reformatting already wrapped text.
core::display_width
to handle emojis when the unicode-width Cargofeature is disabled.
indent
preserve existing newlines in the input string. Before,
indent("foo", "")
would return"foo\n"
by mistake. It nowreturns
"foo"
instead.Options
fields have examples.wrap_columns
function.unfill
andrefill
functions.v0.13.2
Compare Source
This release primarily makes all dependencies optional. This makes it
possible to slim down textwrap as needed.
impl WordSplitter
forBox<T> where T: WordSplitter
.line arguments as initial text in interactive example.
fuzz tests for
wrap_optimal_fit
andwrap_first_fit
.unicode-width dependency optional.
smawk dependency optional.
v0.13.1
Compare Source
This is a bugfix release which fixes a regression in 0.13.0. The bug
meant that colored text was wrapped incorrectly.
deleting a word with Ctrl-Backspace in the interactive demo.
type (debug/release) in interactive demo.
compute width while skipping over ANSI escape sequences.
v0.13.0
Compare Source
This is a major release which rewrites the core logic, adds many new
features, and fixes a couple of bugs. Most programs which use
textwrap
stays the same, incompatibilities and upgrade notes aregiven below.
Clone the repository and run the following to explore the new features
in an interactive demo (Linux only):
Bug Fixes
Rewritten core wrapping algorithm
wrapping in terms of words with whitespace and penalties.
The core wrapping algorithm has been completely rewritten. This fixed
bugs and simplified the code, while also making it possible to use
textwrap
outside the context of the terminal.As part of this, trailing whitespace is now discarded consistently
from wrapped lines. Before we would inconsistently remove whitespace
at the end of wrapped lines, except for the last. Leading whitespace
is still preserved.
New Features
Optimal-fit wrapping
wrapping using an optimal-fit algorithm.
This release adds support for new wrapping algorithm which finds a
globally optimal set of line breaks, taking certain penalties into
account. As an example, the old algorithm would produce
Notice how the fourth line with “the” is very short. The new algorithm
shortens the previous lines slightly to produce fewer short lines:
Use the new
textwrap::core::WrapAlgorithm
enum to select between thenew and old algorithm. By default, the new algorithm is used.
The optimal-fit algorithm is inspired by the line breaking algorithm
used in TeX, described in the 1981 article Breaking Paragraphs into
Lines by
Knuth and Plass.
In-place wrapping
fill_inplace
function.When the text you want to fill is already a temporary
String
, youcan now mutate it in-place with
fill_inplace
:This is faster than calling
fill
and it will reuse the memoryalready allocated for the string.
Changed Features
Wrapper
is replaced withOptions
with only top-level functions.
the type parameter on
Options
(previously known asWrapper
).trait objects with
fill
&wrap
.WrapOptions
withInto<Options>
.The
Wrapper
struct held the options (line width, indentation, etc)for wrapping text. It was also the entry point for actually wrapping
the text via its methods such as
wrap
,wrap_iter
,into_wrap_iter
, andfill
methods.The struct has been replaced by a simpler
Options
struct which onlyholds options. The
Wrapper
methods are gone, their job has beentaken over by the top-level
wrap
andfill
functions. The signatureof these functions have changed from
to the more general
The
Into<Options<'a, S>
bound allows you to pass anusize
(whichis interpreted as the line width) and a full
Options
object. Thisallows the new functions to work like the old, plus you can now fully
customize the behavior of the wrapping via
Options
when needed.Code that call
textwrap::wrap
ortextwrap::fill
can remainunchanged. Code that calls into
Wrapper::wrap
orWrapper::fill
will need to be update. This is a mechanical change, please see
#213 for examples.
Thanks to @CryptJar and @Koxiat for their support in the PRs above!
Removed Features
The
wrap_iter
andinto_wrap_iter
methods are gone. This meansthat lazy iteration is no longer supported: you always get all
wrapped lines back as a
Vec
. This was done to simplify the codeand to support the optimal-fit algorithm.
The first-fit algorithm could still be implemented in an incremental
fashion. Please let us know if this is important to you.
Other Changes
Wrapper.splitter
fromT: WordSplitter
toBox<dyn WordSplitter>
.use of unsafe code.
v0.12.1
Compare Source
This is a bugfix release.
the [
textwrap-macros
crate].break_words(false)
wasbroken and would cause extra whitespace to be inserted when words
were longer than the line width.
v0.12.0
Compare Source
The code has been updated to the [Rust 2018 edition][rust-2018] and
each new release of
textwrap
will only support the latest stableversion of Rust. Trying to support older Rust versions is a fool's
errand: our dependencies keep releasing new patch versions that
require newer and newer versions of Rust.
The
term_size
feature has been replaced byterminal_size
. The APIis unchanged, it is just the name of the Cargo feature that changed.
The
hyphenation
feature now only embeds the hyphenation patterns forUS-English. This slims down the dependency.
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.