diff --git a/init.lua b/init.lua index bcae7d3..f6264b8 100644 --- a/init.lua +++ b/init.lua @@ -330,6 +330,7 @@ local actions = (function() function M.set_mode(m) state.set_mode(m) end function M.open_cheatsheet() state.open_modal("cheatsheet") end function M.close_modal() state.close_modal() end + function M.close_menu() state.close_menu() end -- 0.2.0c actions function M.toggle_flip() state.toggle_flip() end @@ -1004,10 +1005,16 @@ function update(ctx, dt) end end - -- Quit + -- Esc precedence: modal → dropdown → quit if input.was_action_pressed("quit") then - engine.exit() - return + if state.is_modal_open() then + actions.close_modal() + elseif state.get_menu_open() then + actions.close_menu() + else + engine.exit() + return + end end -- Update mouse-cell tracking for status chip