summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bar_state.rs8
-rw-r--r--src/i3bar_protocol.rs4
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),