From fe0938b1de0c46fc2afcaa3dcd6a0f4ec870d21a Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Fri, 2 Aug 2024 00:36:10 +0200 Subject: add state which is shared with the lua environment --- src/app.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/app.rs') diff --git a/src/app.rs b/src/app.rs index 0f740e8..b245b5b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,10 +1,7 @@ use std::{io, time::Duration}; use crate::{ - config, lua, - sheet::register::Register, - tui, - widgets::{logview::LogView, sheetview::SheetView}, + config, lua, sheet::register::Register, state::GlobalState, tui, widgets::{logview::LogView, sheetview::SheetView} }; use ratatui::{ @@ -22,7 +19,8 @@ pub struct App { impl App { pub fn new() -> Self { let sheet_id = Register::create(10, 50); - let view = SheetView::new(sheet_id); + GlobalState::instance_mut().sheetview.set_active_sheet(Some(sheet_id)); + let view = SheetView::new(); Self { exit: false, -- cgit v1.2.3-70-g09d2