Update toss
The latest toss commit includes a width function that runs directly on a &Styled. This avoids using &styled.text(), which unnecessarily allocates a new string. Probably premature optimization, but nicer to use nontheless.
This commit is contained in:
parent
d3229370f3
commit
0a91f2077d
3 changed files with 3 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -1246,7 +1246,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toss"
|
name = "toss"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Garmelon/toss.git?rev=d693712dab61d806c3ac36083d27016e67794154#d693712dab61d806c3ac36083d27016e67794154"
|
source = "git+https://github.com/Garmelon/toss.git?rev=e4e1454e8064269350ff7f10b2dcbb388d26c57d#e4e1454e8064269350ff7f10b2dcbb388d26c57d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossterm",
|
"crossterm",
|
||||||
"unicode-linebreak",
|
"unicode-linebreak",
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,4 @@ features = ["rustls-tls-native-roots"]
|
||||||
|
|
||||||
[dependencies.toss]
|
[dependencies.toss]
|
||||||
git = "https://github.com/Garmelon/toss.git"
|
git = "https://github.com/Garmelon/toss.git"
|
||||||
rev = "d693712dab61d806c3ac36083d27016e67794154"
|
rev = "e4e1454e8064269350ff7f10b2dcbb388d26c57d"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ impl Widget for Text {
|
||||||
let lines = self.wrapped(frame, max_width);
|
let lines = self.wrapped(frame, max_width);
|
||||||
let min_width = lines
|
let min_width = lines
|
||||||
.iter()
|
.iter()
|
||||||
.map(|l| frame.width(&l.text()))
|
.map(|l| frame.width_styled(l))
|
||||||
.max()
|
.max()
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
let min_height = lines.len();
|
let min_height = lines.len();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue