diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-01-15 14:10:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-15 14:10:59 +0100 |
| commit | 005769cfa58b65cc6b2d6ce273ad367bf802bfb0 (patch) | |
| tree | 1912882005cc78bd27d53414ab672b6a13ecd4c8 /zellij-utils | |
| parent | fix: properly quit welcome screen when switching sessions (#4605) (diff) | |
| download | sl0ppij-005769cfa58b65cc6b2d6ce273ad367bf802bfb0.tar.gz sl0ppij-005769cfa58b65cc6b2d6ce273ad367bf802bfb0.tar.xz sl0ppij-005769cfa58b65cc6b2d6ce273ad367bf802bfb0.zip | |
Fix: allow 0% coordinate specification for floating panes (#4609)
* fix: allow 0% when specifying x/y coordinates but not when specifying width/height
* rustfmt
* add pr
Diffstat (limited to 'zellij-utils')
| -rw-r--r-- | zellij-utils/src/data.rs | 62 | ||||
| -rw-r--r-- | zellij-utils/src/input/layout.rs | 6 | ||||
| -rw-r--r-- | zellij-utils/src/input/unit/layout_test.rs | 117 | ||||
| -rw-r--r-- | zellij-utils/src/ipc/protobuf_conversion.rs | 37 | ||||
| -rw-r--r-- | zellij-utils/src/kdl/mod.rs | 18 | ||||
| -rw-r--r-- | zellij-utils/src/pane_size.rs | 20 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/action.rs | 26 | ||||
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.rs | 38 |
8 files changed, 270 insertions, 54 deletions
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs index 177d8c7b..b5cbcf8d 100644 --- a/zellij-utils/src/data.rs +++ b/zellij-utils/src/data.rs @@ -3,7 +3,7 @@ use crate::input::actions::{Action, RunCommandAction}; use crate::input::config::{ConversionError, KdlError}; use crate::input::keybinds::Keybinds; use crate::input::layout::{ - Layout, Run, RunPlugin, RunPluginLocation, RunPluginOrAlias, SplitSize, + Layout, PercentOrFixed, Run, RunPlugin, RunPluginLocation, RunPluginOrAlias, }; use crate::pane_size::PaneGeom; use crate::position::Position; @@ -2763,10 +2763,10 @@ impl PipeMessage { #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default)] pub struct FloatingPaneCoordinates { - pub x: Option<SplitSize>, - pub y: Option<SplitSize>, - pub width: Option<SplitSize>, - pub height: Option<SplitSize>, + pub x: Option<PercentOrFixed>, + pub y: Option<PercentOrFixed>, + pub width: Option<PercentOrFixed>, + pub height: Option<PercentOrFixed>, pub pinned: Option<bool>, } @@ -2778,10 +2778,30 @@ impl FloatingPaneCoordinates { height: Option<String>, pinned: Option<bool>, ) -> Option<Self> { - let x = x.and_then(|x| SplitSize::from_str(&x).ok()); - let y = y.and_then(|y| SplitSize::from_str(&y).ok()); - let width = width.and_then(|width| SplitSize::from_str(&width).ok()); - let height = height.and_then(|height| SplitSize::from_str(&height).ok()); + // Parse x/y coordinates - allows 0% or 0 + let x = x.and_then(|x| PercentOrFixed::from_str(&x).ok()); + let y = y.and_then(|y| PercentOrFixed::from_str(&y).ok()); + + // Parse width/height - reject 0% or 0 + let width = width.and_then(|w| { + PercentOrFixed::from_str(&w) + .ok() + .and_then(|size| match size { + PercentOrFixed::Percent(0) => None, + PercentOrFixed::Fixed(0) => None, + _ => Some(size), + }) + }); + let height = height.and_then(|h| { + PercentOrFixed::from_str(&h) + .ok() + .and_then(|size| match size { + PercentOrFixed::Percent(0) => None, + PercentOrFixed::Fixed(0) => None, + _ => Some(size), + }) + }); + if x.is_none() && y.is_none() && width.is_none() && height.is_none() && pinned.is_none() { None } else { @@ -2795,7 +2815,7 @@ impl FloatingPaneCoordinates { } } pub fn with_x_fixed(mut self, x: usize) -> Self { - self.x = Some(SplitSize::Fixed(x)); + self.x = Some(PercentOrFixed::Fixed(x)); self } pub fn with_x_percent(mut self, x: usize) -> Self { @@ -2803,11 +2823,11 @@ impl FloatingPaneCoordinates { eprintln!("x must be between 0 and 100"); return self; } - self.x = Some(SplitSize::Percent(x)); + self.x = Some(PercentOrFixed::Percent(x)); self } pub fn with_y_fixed(mut self, y: usize) -> Self { - self.y = Some(SplitSize::Fixed(y)); + self.y = Some(PercentOrFixed::Fixed(y)); self } pub fn with_y_percent(mut self, y: usize) -> Self { @@ -2815,11 +2835,11 @@ impl FloatingPaneCoordinates { eprintln!("y must be between 0 and 100"); return self; } - self.y = Some(SplitSize::Percent(y)); + self.y = Some(PercentOrFixed::Percent(y)); self } pub fn with_width_fixed(mut self, width: usize) -> Self { - self.width = Some(SplitSize::Fixed(width)); + self.width = Some(PercentOrFixed::Fixed(width)); self } pub fn with_width_percent(mut self, width: usize) -> Self { @@ -2827,11 +2847,11 @@ impl FloatingPaneCoordinates { eprintln!("width must be between 0 and 100"); return self; } - self.width = Some(SplitSize::Percent(width)); + self.width = Some(PercentOrFixed::Percent(width)); self } pub fn with_height_fixed(mut self, height: usize) -> Self { - self.height = Some(SplitSize::Fixed(height)); + self.height = Some(PercentOrFixed::Fixed(height)); self } pub fn with_height_percent(mut self, height: usize) -> Self { @@ -2839,7 +2859,7 @@ impl FloatingPaneCoordinates { eprintln!("height must be between 0 and 100"); return self; } - self.height = Some(SplitSize::Percent(height)); + self.height = Some(PercentOrFixed::Percent(height)); self } } @@ -2847,10 +2867,10 @@ impl FloatingPaneCoordinates { impl From<PaneGeom> for FloatingPaneCoordinates { fn from(pane_geom: PaneGeom) -> Self { FloatingPaneCoordinates { - x: Some(SplitSize::Fixed(pane_geom.x)), - y: Some(SplitSize::Fixed(pane_geom.y)), - width: Some(SplitSize::Fixed(pane_geom.cols.as_usize())), - height: Some(SplitSize::Fixed(pane_geom.rows.as_usize())), + x: Some(PercentOrFixed::Fixed(pane_geom.x)), + y: Some(PercentOrFixed::Fixed(pane_geom.y)), + width: Some(PercentOrFixed::Fixed(pane_geom.cols.as_usize())), + height: Some(PercentOrFixed::Fixed(pane_geom.rows.as_usize())), pinned: Some(pane_geom.is_pinned), } } diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs index ae7d85a1..a7b2ebc6 100644 --- a/zellij-utils/src/input/layout.rs +++ b/zellij-utils/src/input/layout.rs @@ -715,7 +715,7 @@ pub struct TabLayoutInfo { pub swap_floating_layouts: Option<Vec<SwapFloatingLayout>>, } -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)] pub enum PercentOrFixed { Percent(usize), // 1 to 100 Fixed(usize), // An absolute number of columns or rows @@ -745,10 +745,10 @@ impl PercentOrFixed { }, } } - pub fn to_fixed(&self, full_size: usize) -> usize { + pub fn to_fixed(&self, whole: usize) -> usize { match self { PercentOrFixed::Percent(percent) => { - ((*percent as f64 / 100.0) * full_size as f64).floor() as usize + ((*percent as f64 / 100.0) * whole as f64).floor() as usize }, PercentOrFixed::Fixed(fixed) => *fixed, } diff --git a/zellij-utils/src/input/unit/layout_test.rs b/zellij-utils/src/input/unit/layout_test.rs index 292909e5..8a86247f 100644 --- a/zellij-utils/src/input/unit/layout_test.rs +++ b/zellij-utils/src/input/unit/layout_test.rs @@ -2361,3 +2361,120 @@ fn layout_node_with_name_and_only_floating_panes() { assert_eq!(layout.tabs.len(), 1); assert_eq!(layout.tabs[0].0, Some("floating-only".to_string())); } + +#[test] +fn floating_pane_coordinates_allows_zero_percent_for_x_y() { + use crate::data::FloatingPaneCoordinates; + use crate::input::layout::PercentOrFixed; + + let coords = FloatingPaneCoordinates::new( + Some("0%".to_string()), + Some("0%".to_string()), + Some("50%".to_string()), + Some("50%".to_string()), + None, + ); + + assert!(coords.is_some()); + let coords = coords.unwrap(); + assert_eq!(coords.x, Some(PercentOrFixed::Percent(0))); + assert_eq!(coords.y, Some(PercentOrFixed::Percent(0))); + assert_eq!(coords.width, Some(PercentOrFixed::Percent(50))); + assert_eq!(coords.height, Some(PercentOrFixed::Percent(50))); +} + +#[test] +fn floating_pane_coordinates_rejects_zero_percent_for_width() { + use crate::data::FloatingPaneCoordinates; + use crate::input::layout::PercentOrFixed; + + let coords = FloatingPaneCoordinates::new( + Some("10%".to_string()), + Some("10%".to_string()), + Some("0%".to_string()), + Some("50%".to_string()), + None, + ); + + // Should have coords but width will be None due to rejection + assert!(coords.is_some()); + let coords = coords.unwrap(); + assert!(coords.width.is_none()); + assert_eq!(coords.height, Some(PercentOrFixed::Percent(50))); +} + +#[test] +fn floating_pane_coordinates_rejects_zero_percent_for_height() { + use crate::data::FloatingPaneCoordinates; + use crate::input::layout::PercentOrFixed; + + let coords = FloatingPaneCoordinates::new( + Some("10%".to_string()), + Some("10%".to_string()), + Some("50%".to_string()), + Some("0%".to_string()), + None, + ); + + // Should have coords but height will be None due to rejection + assert!(coords.is_some()); + let coords = coords.unwrap(); + assert_eq!(coords.width, Some(PercentOrFixed::Percent(50))); + assert!(coords.height.is_none()); +} + +#[test] +fn floating_pane_coordinates_static_zero_works() { + use crate::data::FloatingPaneCoordinates; + use crate::input::layout::PercentOrFixed; + + let coords = FloatingPaneCoordinates::new( + Some("0".to_string()), + Some("0".to_string()), + Some("100".to_string()), + Some("100".to_string()), + None, + ); + + assert!(coords.is_some()); + let coords = coords.unwrap(); + assert_eq!(coords.x, Some(PercentOrFixed::Fixed(0))); + assert_eq!(coords.y, Some(PercentOrFixed::Fixed(0))); + assert_eq!(coords.width, Some(PercentOrFixed::Fixed(100))); + assert_eq!(coords.height, Some(PercentOrFixed::Fixed(100))); +} + +#[test] +fn floating_pane_coordinates_one_percent_works() { + use crate::data::FloatingPaneCoordinates; + use crate::input::layout::PercentOrFixed; + + let coords = FloatingPaneCoordinates::new( + Some("1%".to_string()), + Some("1%".to_string()), + Some("50%".to_string()), + Some("50%".to_string()), + None, + ); + + assert!(coords.is_some()); + let coords = coords.unwrap(); + assert_eq!(coords.x, Some(PercentOrFixed::Percent(1))); + assert_eq!(coords.y, Some(PercentOrFixed::Percent(1))); + assert_eq!(coords.width, Some(PercentOrFixed::Percent(50))); + assert_eq!(coords.height, Some(PercentOrFixed::Percent(50))); +} + +#[test] +fn tiled_pane_still_rejects_zero_percent() { + use crate::input::layout::SplitSize; + use std::str::FromStr; + + // Verify SplitSize::from_str still rejects 0% + let result = SplitSize::from_str("0%"); + assert!(result.is_err()); + + // But 1% should work + let result = SplitSize::from_str("1%"); + assert!(result.is_ok()); +} diff --git a/zellij-utils/src/ipc/protobuf_conversion.rs b/zellij-utils/src/ipc/protobuf_conversion.rs index 4ade64b6..7539fa15 100644 --- a/zellij-utils/src/ipc/protobuf_conversion.rs +++ b/zellij-utils/src/ipc/protobuf_conversion.rs @@ -2443,6 +2443,43 @@ impl TryFrom<crate::client_server_contract::client_server_contract::FloatingCoor } } +// FloatingCoordinate conversion - PercentOrFixed to FloatingCoordinate +impl From<crate::input::layout::PercentOrFixed> + for crate::client_server_contract::client_server_contract::FloatingCoordinate +{ + fn from(size: crate::input::layout::PercentOrFixed) -> Self { + match size { + crate::input::layout::PercentOrFixed::Percent(p) => Self { + coordinate_type: Some(crate::client_server_contract::client_server_contract::floating_coordinate::CoordinateType::Percent(p as f32)), + }, + crate::input::layout::PercentOrFixed::Fixed(f) => Self { + coordinate_type: Some(crate::client_server_contract::client_server_contract::floating_coordinate::CoordinateType::Fixed(f as u32)), + }, + } + } +} + +// Reverse FloatingCoordinate conversion for PercentOrFixed +impl TryFrom<crate::client_server_contract::client_server_contract::FloatingCoordinate> + for crate::input::layout::PercentOrFixed +{ + type Error = anyhow::Error; + fn try_from( + coord: crate::client_server_contract::client_server_contract::FloatingCoordinate, + ) -> Result<Self> { + use crate::client_server_contract::client_server_contract::floating_coordinate::CoordinateType; + match coord + .coordinate_type + .ok_or_else(|| anyhow!("FloatingCoordinate missing coordinate_type"))? + { + CoordinateType::Percent(p) => { + Ok(crate::input::layout::PercentOrFixed::Percent(p as usize)) + }, + CoordinateType::Fixed(f) => Ok(crate::input::layout::PercentOrFixed::Fixed(f as usize)), + } + } +} + // FloatingPaneCoordinates conversion impl From<crate::data::FloatingPaneCoordinates> for crate::client_server_contract::client_server_contract::FloatingPaneCoordinates diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 95d67ffd..16d75073 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -10,7 +10,7 @@ use crate::home::{find_default_config_dir, get_layout_dir}; use crate::input::config::{Config, ConfigError, KdlError}; use crate::input::keybinds::Keybinds; use crate::input::layout::{ - Layout, PluginUserConfiguration, RunPlugin, RunPluginOrAlias, SplitSize, TabLayoutInfo, + Layout, PercentOrFixed, PluginUserConfiguration, RunPlugin, RunPluginOrAlias, TabLayoutInfo, }; use crate::input::options::{Clipboard, OnForceClose, Options}; use crate::input::permission::{GrantedPermission, PermissionCache}; @@ -886,10 +886,10 @@ impl Action { if let Some(x) = floating_pane_coordinates.x { let mut x_node = KdlNode::new("x"); match x { - SplitSize::Percent(x) => { + PercentOrFixed::Percent(x) => { x_node.push(format!("{}%", x)); }, - SplitSize::Fixed(x) => { + PercentOrFixed::Fixed(x) => { x_node.push(KdlValue::Base10(x as i64)); }, }; @@ -898,10 +898,10 @@ impl Action { if let Some(y) = floating_pane_coordinates.y { let mut y_node = KdlNode::new("y"); match y { - SplitSize::Percent(y) => { + PercentOrFixed::Percent(y) => { y_node.push(format!("{}%", y)); }, - SplitSize::Fixed(y) => { + PercentOrFixed::Fixed(y) => { y_node.push(KdlValue::Base10(y as i64)); }, }; @@ -910,10 +910,10 @@ impl Action { if let Some(width) = floating_pane_coordinates.width { let mut width_node = KdlNode::new("width"); match width { - SplitSize::Percent(width) => { + PercentOrFixed::Percent(width) => { width_node.push(format!("{}%", width)); }, - SplitSize::Fixed(width) => { + PercentOrFixed::Fixed(width) => { width_node.push(KdlValue::Base10(width as i64)); }, }; @@ -922,10 +922,10 @@ impl Action { if let Some(height) = floating_pane_coordinates.height { let mut height_node = KdlNode::new("height"); match height { - SplitSize::Percent(height) => { + PercentOrFixed::Percent(height) => { height_node.push(format!("{}%", height)); }, - SplitSize::Fixed(height) => { + PercentOrFixed::Fixed(height) => { height_node.push(KdlValue::Base10(height as i64)); }, }; diff --git a/zellij-utils/src/pane_size.rs b/zellij-utils/src/pane_size.rs index 453e57c1..4ba87326 100644 --- a/zellij-utils/src/pane_size.rs +++ b/zellij-utils/src/pane_size.rs @@ -170,6 +170,18 @@ impl Dimension { }, } } + pub fn from_percent_or_fixed(size: PercentOrFixed, full_size: usize) -> Self { + match size { + PercentOrFixed::Fixed(fixed) => Dimension { + constraint: Constraint::Fixed(fixed), + inner: fixed, + }, + PercentOrFixed::Percent(percent) => Dimension { + constraint: Constraint::Percent(percent as f64), + inner: ((percent as f64 / 100.0) * full_size as f64).floor() as usize, + }, + } + } pub fn split_out(&mut self, by: f64) -> Self { match self.constraint { Constraint::Percent(percent) => { @@ -282,10 +294,10 @@ impl PaneGeom { viewport: Viewport, ) { self.apply_floating_pane_position( - floating_pane_coordinates.x.map(Into::into), - floating_pane_coordinates.y.map(Into::into), - floating_pane_coordinates.width.map(Into::into), - floating_pane_coordinates.height.map(Into::into), + floating_pane_coordinates.x, + floating_pane_coordinates.y, + floating_pane_coordinates.width, + floating_pane_coordinates.height, viewport.cols, viewport.rows, ); diff --git a/zellij-utils/src/plugin_api/action.rs b/zellij-utils/src/plugin_api/action.rs index aa4c8b09..96074948 100644 --- a/zellij-utils/src/plugin_api/action.rs +++ b/zellij-utils/src/plugin_api/action.rs @@ -2212,6 +2212,32 @@ impl TryFrom<SplitSize> for ProtobufSplitSize { } } +impl TryFrom<ProtobufSplitSize> for PercentOrFixed { + type Error = &'static str; + fn try_from(protobuf_split_size: ProtobufSplitSize) -> Result<Self, &'static str> { + use super::generated_api::api::action::split_size::SplitSizeVariant; + + match protobuf_split_size.split_size_variant { + Some(SplitSizeVariant::Percent(p)) => Ok(PercentOrFixed::Percent(p as usize)), + Some(SplitSizeVariant::Fixed(f)) => Ok(PercentOrFixed::Fixed(f as usize)), + None => Err("PercentOrFixed must have either percent or fixed value"), + } + } +} + +impl TryFrom<PercentOrFixed> for ProtobufSplitSize { + type Error = &'static str; + fn try_from(percent_or_fixed: PercentOrFixed) -> Result<Self, &'static str> { + use super::generated_api::api::action::split_size::SplitSizeVariant; + + let split_size_variant = match percent_or_fixed { + PercentOrFixed::Percent(p) => Some(SplitSizeVariant::Percent(p as u32)), + PercentOrFixed::Fixed(f) => Some(SplitSizeVariant::Fixed(f as u32)), + }; + Ok(ProtobufSplitSize { split_size_variant }) + } +} + // FloatingPaneCoordinates conversions impl TryFrom<ProtobufFloatingPaneCoordinates> for FloatingPaneCoordinates { type Error = &'static str; diff --git a/zellij-utils/src/plugin_api/plugin_command.rs b/zellij-utils/src/plugin_api/plugin_command.rs index 8c4bf451..d26ab7ec 100644 --- a/zellij-utils/src/plugin_api/plugin_command.rs +++ b/zellij-utils/src/plugin_api/plugin_command.rs @@ -63,7 +63,7 @@ use crate::data::{ SaveLayoutResponse, }; use crate::input::actions::Action; -use crate::input::layout::SplitSize; +use crate::input::layout::PercentOrFixed; use std::collections::BTreeMap; use std::convert::TryFrom; @@ -76,27 +76,31 @@ impl Into<FloatingPaneCoordinates> for ProtobufFloatingPaneCoordinates { .x .and_then(|x| match ProtobufFixedOrPercent::from_i32(x.r#type) { Some(ProtobufFixedOrPercent::Percent) => { - Some(SplitSize::Percent(x.value as usize)) + Some(PercentOrFixed::Percent(x.value as usize)) + }, + Some(ProtobufFixedOrPercent::Fixed) => { + Some(PercentOrFixed::Fixed(x.value as usize)) }, - Some(ProtobufFixedOrPercent::Fixed) => Some(SplitSize::Fixed(x.value as usize)), None => None, }), y: self .y .and_then(|y| match ProtobufFixedOrPercent::from_i32(y.r#type) { Some(ProtobufFixedOrPercent::Percent) => { - Some(SplitSize::Percent(y.value as usize)) + Some(PercentOrFixed::Percent(y.value as usize)) + }, + Some(ProtobufFixedOrPercent::Fixed) => { + Some(PercentOrFixed::Fixed(y.value as usize)) }, - Some(ProtobufFixedOrPercent::Fixed) => Some(SplitSize::Fixed(y.value as usize)), None => None, }), width: self.width.and_then(|width| { match ProtobufFixedOrPercent::from_i32(width.r#type) { Some(ProtobufFixedOrPercent::Percent) => { - Some(SplitSize::Percent(width.value as usize)) + Some(PercentOrFixed::Percent(width.value as usize)) }, Some(ProtobufFixedOrPercent::Fixed) => { - Some(SplitSize::Fixed(width.value as usize)) + Some(PercentOrFixed::Fixed(width.value as usize)) }, None => None, } @@ -104,10 +108,10 @@ impl Into<FloatingPaneCoordinates> for ProtobufFloatingPaneCoordinates { height: self.height.and_then(|height| { match ProtobufFixedOrPercent::from_i32(height.r#type) { Some(ProtobufFixedOrPercent::Percent) => { - Some(SplitSize::Percent(height.value as usize)) + Some(PercentOrFixed::Percent(height.value as usize)) }, Some(ProtobufFixedOrPercent::Fixed) => { - Some(SplitSize::Fixed(height.value as usize)) + Some(PercentOrFixed::Fixed(height.value as usize)) }, None => None, } @@ -121,44 +125,44 @@ impl Into<ProtobufFloatingPaneCoordinates> for FloatingPaneCoordinates { fn into(self) -> ProtobufFloatingPaneCoordinates { ProtobufFloatingPaneCoordinates { x: match self.x { - Some(SplitSize::Percent(percent)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Percent(percent)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Percent as i32, value: percent as u32, }), - Some(SplitSize::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Fixed as i32, value: fixed as u32, }), None => None, }, y: match self.y { - Some(SplitSize::Percent(percent)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Percent(percent)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Percent as i32, value: percent as u32, }), - Some(SplitSize::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Fixed as i32, value: fixed as u32, }), None => None, }, width: match self.width { - Some(SplitSize::Percent(percent)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Percent(percent)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Percent as i32, value: percent as u32, }), - Some(SplitSize::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Fixed as i32, value: fixed as u32, }), None => None, }, height: match self.height { - Some(SplitSize::Percent(percent)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Percent(percent)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Percent as i32, value: percent as u32, }), - Some(SplitSize::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { + Some(PercentOrFixed::Fixed(fixed)) => Some(ProtobufFixedOrPercentValue { r#type: ProtobufFixedOrPercent::Fixed as i32, value: fixed as u32, }), |
