Skip to content

Commit

Permalink
fix: don't activate items in non-callback mode menus when modifiers o…
Browse files Browse the repository at this point in the history
…r actions are used
  • Loading branch information
tomasklaen committed Sep 3, 2024
1 parent e4e8f07 commit fac1d98
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/uosc/lib/menus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ function open_command_menu(data, opts)
---@diagnostic disable-next-line: deprecated
mp.commandv(unpack(itable_join({'script-message-to'}, menu.root.callback, {utils.format_json(event)})))
elseif event.type == 'activate' then
run_command(event.value)
-- Modifiers and actions are not available on basic non-callback mode menus
if not event.modifiers and not event.action then
run_command(event.value)
end
-- Convention: Only pure item activations should close the menu.
-- Using modifiers or triggering item actions should not.
if not event.keep_open and not event.modifiers and not event.action then
Expand Down

0 comments on commit fac1d98

Please # to comment.