1
0
Fork 0
mirror of https://github.com/lise-henry/crowbook synced 2024-05-04 15:06:05 +02:00

Update textwrap dependency

This commit is contained in:
Elisabeth Henry 2022-07-26 14:02:19 +02:00
parent dea04a210c
commit 73045bf124
3 changed files with 25 additions and 15 deletions

31
Cargo.lock generated
View File

@ -383,7 +383,7 @@ dependencies = [
"simplelog",
"syntect 5.0.0",
"tempdir",
"textwrap 0.12.1",
"textwrap 0.15.0",
"url",
"uuid 1.1.2",
"walkdir 2.3.2",
@ -1853,6 +1853,12 @@ dependencies = [
"autocfg 1.1.0",
]
[[package]]
name = "smawk"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043"
[[package]]
name = "socket2"
version = "0.4.4"
@ -2011,20 +2017,16 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
dependencies = [
"unicode-width",
]
[[package]]
name = "textwrap"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
dependencies = [
"smawk",
"unicode-linebreak",
"unicode-width",
]
[[package]]
name = "thiserror"
@ -2218,6 +2220,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7"
[[package]]
name = "unicode-linebreak"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a52dcaab0c48d931f7cc8ef826fa51690a08e1ea55117ef26f89864f532383f"
dependencies = [
"regex 1.6.0",
]
[[package]]
name = "unicode-normalization"
version = "0.1.21"

View File

@ -63,7 +63,7 @@ epub-builder = "0.5"
log = "0.4"
punkt = { version = "1.0", optional = true }
hyphenation = { version = "0.8", optional = true, features = ["embed_all"] }
textwrap = { version = "0.12", optional = true }
textwrap = { version = "0.15", optional = true }
serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true }
serde_derive = { version = "1", optional = true }

View File

@ -1,4 +1,4 @@
// Copyright (C) 2017 Élisabeth HENRY.
// Copyright (C) 2017-2022 Élisabeth HENRY.
//
// This file is part of Crowbook.
//
@ -18,7 +18,6 @@
//! Functions for setting styles on text, using console to make it look prettier.
use console::{style, StyledObject, Term};
use textwrap::Wrapper;
/// Displays a string as some header
pub fn header(msg: &str) -> StyledObject<&str> {
@ -44,8 +43,8 @@ pub fn value(msg: &str) -> StyledObject<&str> {
pub fn fill(msg: &str, indent: &str) -> String {
let (_, width) = Term::stdout().size();
let wrapper = Wrapper::new(width as usize)
let options = textwrap::Options::new(width.into())
.initial_indent(indent)
.subsequent_indent(indent);
wrapper.fill(msg)
textwrap::fill(msg, &options)
}