diff options
Diffstat (limited to 'src/state')
| -rw-r--r-- | src/state/mod.rs | 9 | ||||
| -rw-r--r-- | src/state/view/mod.rs | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/state/mod.rs b/src/state/mod.rs index 3b5d3c5..a5528e3 100644 --- a/src/state/mod.rs +++ b/src/state/mod.rs @@ -16,6 +16,7 @@ pub struct GlobalState { pub editor: editor::EditorState, pub active_window: window::Window, pub log: log::LogState, + pub exit: bool, } static GLOBAL_STATE: RwLock<GlobalState> = RwLock::new(GlobalState::new()); @@ -28,6 +29,7 @@ impl GlobalState { editor: editor::EditorState::new(), log: LogState::new(), active_window: window::Window::View, + exit: false, } } @@ -62,4 +64,11 @@ impl UserData for GlobalState { Ok(()) }); } + + fn add_methods<'lua, M: mlua::prelude::LuaUserDataMethods<'lua, Self>>(methods: &mut M) { + methods.add_function("quit", |_, _: ()| { + GlobalState::instance_mut().exit = true; + Ok(()) + }) + } } diff --git a/src/state/view/mod.rs b/src/state/view/mod.rs index a63b6ed..b142227 100644 --- a/src/state/view/mod.rs +++ b/src/state/view/mod.rs @@ -181,7 +181,7 @@ impl UserData for SheetViewState { methods.add_function("move_cursor", |_, (row, column): (usize, usize)| { cfg_mut!() .cursor - .move_checked(CursorMove::Jump((row, column))); + .move_checked(CursorMove::Jump((column, row))); Ok(()) }); |