Allow for aligned text using unindent
This commit is contained in:
parent
398717b782
commit
f0b27d2ec1
3 changed files with 9 additions and 0 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -472,6 +472,7 @@ dependencies = [
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"unescape",
|
"unescape",
|
||||||
|
"unindent",
|
||||||
"wait-timeout",
|
"wait-timeout",
|
||||||
"x11rb",
|
"x11rb",
|
||||||
"yuck",
|
"yuck",
|
||||||
|
@ -2254,6 +2255,12 @@ version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unindent"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf8-ranges"
|
name = "utf8-ranges"
|
||||||
version = "1.0.4"
|
version = "1.0.4"
|
||||||
|
|
|
@ -50,6 +50,7 @@ nix = "0.20"
|
||||||
smart-default = "0.6"
|
smart-default = "0.6"
|
||||||
simple-signal = "1.1"
|
simple-signal = "1.1"
|
||||||
unescape = "0.1"
|
unescape = "0.1"
|
||||||
|
unindent = "0.1"
|
||||||
|
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
tokio-stream = "0.1"
|
tokio-stream = "0.1"
|
||||||
|
|
|
@ -543,6 +543,7 @@ fn build_gtk_label(bargs: &mut BuilderArgs) -> Result<gtk::Label> {
|
||||||
prop(text: as_string, limit_width: as_i32 = i32::MAX) {
|
prop(text: as_string, limit_width: as_i32 = i32::MAX) {
|
||||||
let text = text.chars().take(limit_width as usize).collect::<String>();
|
let text = text.chars().take(limit_width as usize).collect::<String>();
|
||||||
let text = unescape::unescape(&text).context(format!("Failed to unescape label text {}", &text))?;
|
let text = unescape::unescape(&text).context(format!("Failed to unescape label text {}", &text))?;
|
||||||
|
let text = unindent::unindent(&text);
|
||||||
gtk_widget.set_text(&text);
|
gtk_widget.set_text(&text);
|
||||||
},
|
},
|
||||||
// @prop markup - Pango markup to display
|
// @prop markup - Pango markup to display
|
||||||
|
|
Loading…
Add table
Reference in a new issue