From 219c560c7c0ad9e3960298ec125d4e64637fe84b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 2 Aug 2024 20:41:29 +0200 Subject: add editor theme and state lua bindings --- src/state/editor/mod.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/state/editor/mod.rs') diff --git a/src/state/editor/mod.rs b/src/state/editor/mod.rs index 6fbd2b9..279a164 100644 --- a/src/state/editor/mod.rs +++ b/src/state/editor/mod.rs @@ -1,14 +1,16 @@ -use self::buffer::Buffer; +use self::{bar::EditorBarState, buffer::Buffer}; -use super::GlobalState; +use super::{GlobalState, DUMMY_STATE}; use mlua::{Lua, UserData}; pub mod buffer; +pub mod bar; #[derive(Default, Debug)] pub struct EditorState { pub visible: bool, pub buffer: Buffer, + pub bar: EditorBarState, } macro_rules! cfg { @@ -28,6 +30,7 @@ impl EditorState { Self { visible: false, buffer: Buffer::new(), + bar: EditorBarState::new(), } } @@ -45,7 +48,9 @@ impl UserData for EditorState { fields.add_field_function_set("visible", |_, _, visible: bool| { cfg_mut!().visible = visible; Ok(()) - }) + }); + + fields.add_field_function_get("bar", |_, _| Ok(DUMMY_STATE.editor.bar)); } fn add_methods<'lua, M: mlua::prelude::LuaUserDataMethods<'lua, Self>>(methods: &mut M) { -- cgit v1.2.3-70-g09d2