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/src/plugin_api/plugin_command.rs | |
| 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/src/plugin_api/plugin_command.rs')
| -rw-r--r-- | zellij-utils/src/plugin_api/plugin_command.rs | 38 |
1 files changed, 21 insertions, 17 deletions
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, }), |
