tab indicator: Add position setting

This commit is contained in:
Ivan Molodetskikh
2025-02-05 10:36:46 +03:00
parent d7d5a7f8f6
commit 64544a5726
3 changed files with 62 additions and 6 deletions
+13
View File
@@ -691,6 +691,8 @@ pub struct TabIndicator {
pub width: FloatOrInt<0, 65535>,
#[knuffel(child, default = Self::default().length)]
pub length: TabIndicatorLength,
#[knuffel(child, unwrap(argument), default = Self::default().position)]
pub position: TabIndicatorPosition,
#[knuffel(child)]
pub active_color: Option<Color>,
#[knuffel(child)]
@@ -711,6 +713,7 @@ impl Default for TabIndicator {
length: TabIndicatorLength {
total_proportion: Some(0.5),
},
position: TabIndicatorPosition::Left,
active_color: None,
inactive_color: None,
active_gradient: None,
@@ -725,6 +728,14 @@ pub struct TabIndicatorLength {
pub total_proportion: Option<f64>,
}
#[derive(knuffel::DecodeScalar, Debug, Clone, Copy, PartialEq)]
pub enum TabIndicatorPosition {
Left,
Right,
Top,
Bottom,
}
#[derive(knuffel::Decode, Debug, Clone, Copy, PartialEq)]
pub struct InsertHint {
#[knuffel(child)]
@@ -3555,6 +3566,7 @@ mod tests {
tab-indicator {
width 10
position "top"
}
preset-column-widths {
@@ -3819,6 +3831,7 @@ mod tests {
},
tab_indicator: TabIndicator {
width: FloatOrInt(10.),
position: TabIndicatorPosition::Top,
..Default::default()
},
insert_hint: InsertHint {