diff options
| author | Max Verevkin <maxxverrr@gmail.com> | 2022-04-12 20:51:55 +0300 |
|---|---|---|
| committer | Max Verevkin <maxxverrr@gmail.com> | 2022-04-12 20:51:55 +0300 |
| commit | 6501bf235809d83a28d68471b7721ece0fb70bff (patch) | |
| tree | e32573712d24389fe5169b5ae859563f24dfd112 /src | |
| parent | dcc20f7aca51a4ca1f47c15730a1c9e9d8dfdfc7 (diff) | |
| download | i3bar-mango-6501bf235809d83a28d68471b7721ece0fb70bff.tar.gz | |
fix short text
Diffstat (limited to 'src')
| -rw-r--r-- | src/bar_state.rs | 8 | ||||
| -rw-r--r-- | src/i3bar_protocol.rs | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/bar_state.rs b/src/bar_state.rs index 656b88e..ec26efc 100644 --- a/src/bar_state.rs +++ b/src/bar_state.rs @@ -535,6 +535,7 @@ fn render_blocks( } } + #[derive(Debug)] struct BlockSeries<'a> { blocks: Vec<(&'a ComputedBlock, bool)>, delta: f64, @@ -598,7 +599,11 @@ fn render_blocks( // Remove all the empy blocks for s in &mut blocks_computed { s.blocks.retain(|(text, is_short)| { - (*is_short && text.short.as_ref().map_or(false, |s| s.width > 0.0)) + (*is_short + && text + .short + .as_ref() + .map_or(text.full.width > 0.0, |s| s.width > 0.0)) || (!is_short && text.full.width > 0.0) }); } @@ -649,6 +654,7 @@ fn render_blocks( } } +#[derive(Debug)] struct ComputedBlock { block: Block, full: ComputedText, diff --git a/src/i3bar_protocol.rs b/src/i3bar_protocol.rs index 891fba6..04595be 100644 --- a/src/i3bar_protocol.rs +++ b/src/i3bar_protocol.rs @@ -6,7 +6,7 @@ use serde::Deserialize; use serde::Serialize; use std::io::{Error, ErrorKind, Result}; -#[derive(Clone, Deserialize, Default)] +#[derive(Clone, Deserialize, Default, Debug)] pub struct Block { pub full_text: String, #[serde(default)] @@ -39,7 +39,7 @@ fn def_sep_width() -> u8 { 9 } -#[derive(Deserialize, Clone, PartialEq, Eq)] +#[derive(Deserialize, Clone, Debug, PartialEq, Eq)] #[serde(untagged)] pub enum MinWidth { Text(String), |
