From 1a8f32766f0b62bfefd7ccb972790a33a2ab07e4 Mon Sep 17 00:00:00 2001 From: Riccardo Mazzarini Date: Sun, 1 Oct 2023 02:58:39 +0200 Subject: [PATCH] wip --- crates/oxi-api/src/types/window_config.rs | 120 +++++++++++++++------- 1 file changed, 85 insertions(+), 35 deletions(-) diff --git a/crates/oxi-api/src/types/window_config.rs b/crates/oxi-api/src/types/window_config.rs index 11fcb77e..5c03638f 100644 --- a/crates/oxi-api/src/types/window_config.rs +++ b/crates/oxi-api/src/types/window_config.rs @@ -5,7 +5,10 @@ use oxi_types::{ Float, Integer, Object, + WinHandle, }; +#[cfg(feature = "neovim-nightly")] +use oxi_types::{Boolean, String as NvimString}; use serde::Deserialize; use super::{WindowAnchor, WindowBorder, WindowRelativeTo, WindowStyle}; @@ -266,24 +269,27 @@ pub(crate) struct KeyDict_float_config { #[allow(non_camel_case_types)] #[repr(C)] pub(crate) struct KeyDict_float_config { - row: Object, - col: Object, - width: Object, - height: Object, - anchor: Object, - relative: Object, - win: Object, - bufpos: Object, - external: Object, - focusable: Object, - zindex: Object, - #[cfg(any(feature = "neovim-0-9", feature = "neovim-nightly"))] + is_set__float_config: u64, + row: Float, + col: Float, + width: Integer, + height: Integer, + anchor: NvimString, + relative: NvimString, + win: WinHandle, + bufpos: Array, + external: Boolean, + focusable: Boolean, + zindex: Integer, border: Object, title: Object, - #[cfg(any(feature = "neovim-0-9", feature = "neovim-nightly"))] - title_pos: Object, - style: Object, - noautocmd: Object, + title_pos: NvimString, + footer: Object, + footer_pos: NvimString, + style: NvimString, + noautocmd: Boolean, + fixed: Boolean, + hide: Boolean, } impl From<&WindowConfig> for KeyDict_float_config { @@ -295,25 +301,69 @@ impl From<&WindowConfig> for KeyDict_float_config { _ => Object::nil(), }; - Self { - col: config.col.into(), - row: config.row.into(), - win: config.win.as_ref().into(), - style: config.style.into(), - #[cfg(any(feature = "neovim-0-9", feature = "neovim-nightly"))] - title: config.title.as_ref().into(), - width: config.width.into(), - height: config.height.into(), - zindex: config.zindex.into(), - anchor: config.anchor.into(), - border: config.border.clone().into(), - bufpos, - external: config.external.into(), - relative: config.relative.as_ref().into(), - focusable: config.focusable.into(), - noautocmd: config.noautocmd.into(), - #[cfg(any(feature = "neovim-0-9", feature = "neovim-nightly"))] - title_pos: config.title_pos.as_ref().into(), + #[cfg(not(feature = "neovim-nightly"))] + { + Self { + anchor: config.anchor.into(), + border: config.border.clone().into(), + bufpos, + col: config.col.into(), + external: config.external.into(), + #[cfg(feature = "neovim-nightly")] + fixed: Object::nil(), + focusable: config.focusable.into(), + #[cfg(feature = "neovim-nightly")] + footer: Object::nil(), + #[cfg(feature = "neovim-nightly")] + footer_pos: Object::nil(), + height: config.height.into(), + #[cfg(feature = "neovim-nightly")] + hide: Object::nil(), + noautocmd: config.noautocmd.into(), + relative: config.relative.as_ref().into(), + row: config.row.into(), + style: config.style.into(), + #[cfg(any( + feature = "neovim-0-9", + feature = "neovim-nightly" + ))] + title: config.title.as_ref().into(), + #[cfg(any( + feature = "neovim-0-9", + feature = "neovim-nightly" + ))] + title_pos: config.title_pos.as_ref().into(), + width: config.width.into(), + win: config.win.as_ref().into(), + zindex: config.zindex.into(), + } + } + + #[cfg(feature = "neovim-nightly")] + { + Self { + is_set__float_config: 0b101111u64, + row: 1.5, + col: 1.5, + width: 5, + height: 10, + anchor: NvimString::default(), + relative: "editor".into(), + win: WinHandle::default(), + bufpos: Array::default(), + external: Boolean::default(), + focusable: Boolean::default(), + zindex: Integer::default(), + border: Object::default(), + title: Object::default(), + title_pos: NvimString::default(), + footer: Object::default(), + footer_pos: NvimString::default(), + style: NvimString::default(), + noautocmd: Boolean::default(), + fixed: Boolean::default(), + hide: Boolean::default(), + } } } }