From 47499eccff9462ca707846126f61a552c12f9ba6 Mon Sep 17 00:00:00 2001 From: sudacode Date: Mon, 11 May 2026 01:07:11 -0700 Subject: [PATCH] fix: map openCharacterDictionary session action to --open-character-dict - Add missing Lua CLI dispatch entry for openCharacterDictionary - Add regression test for Alt+Meta+A binding and CLI flag forwarding --- ...er-dictionary-selector-session-shortcut.md | 44 +++++++++++++++++++ plugin/subminer/session_bindings.lua | 2 + scripts/test-plugin-session-bindings.lua | 25 +++++++++++ 3 files changed, 71 insertions(+) create mode 100644 backlog/tasks/task-343 - Fix-macOS-character-dictionary-selector-session-shortcut.md diff --git a/backlog/tasks/task-343 - Fix-macOS-character-dictionary-selector-session-shortcut.md b/backlog/tasks/task-343 - Fix-macOS-character-dictionary-selector-session-shortcut.md new file mode 100644 index 00000000..31e32d86 --- /dev/null +++ b/backlog/tasks/task-343 - Fix-macOS-character-dictionary-selector-session-shortcut.md @@ -0,0 +1,44 @@ +--- +id: TASK-343 +title: Fix macOS character dictionary selector session shortcut +status: Done +assignee: [] +created_date: '2026-05-11 08:05' +updated_date: '2026-05-11 08:06' +labels: + - bug + - macos + - character-dictionary + - plugin +dependencies: [] +modified_files: + - plugin/subminer/session_bindings.lua + - scripts/test-plugin-session-bindings.lua +priority: medium +ordinal: 181500 +--- + +## Description + + +Opening the character dictionary AniList selector from mpv/session shortcuts should work on macOS. Current generated session bindings include the openCharacterDictionary session action, but the Lua plugin CLI dispatch table does not map that action to the app flag, so the shortcut cannot reach the runtime selector. + + +## Acceptance Criteria + +- [x] #1 The openCharacterDictionary session action invokes the app with --open-character-dictionary from the mpv plugin. +- [x] #2 Regression coverage proves the Lua session-binding CLI map forwards openCharacterDictionary correctly. +- [x] #3 Existing session-binding regression coverage still passes. + + +## Implementation Notes + + +TDD red: `lua scripts/test-plugin-session-bindings.lua` failed because openCharacterDictionary did not emit --open-character-dictionary. Green after adding the missing Lua CLI mapping. + + +## Final Summary + + +Fixed the mpv plugin session action mapping so the character dictionary selector shortcut dispatches `--open-character-dictionary` to the app. Added Lua regression coverage for the macOS-style Alt+Meta+A binding and verified adjacent TypeScript session binding tests. + diff --git a/plugin/subminer/session_bindings.lua b/plugin/subminer/session_bindings.lua index 523d93e9..fee7ec14 100644 --- a/plugin/subminer/session_bindings.lua +++ b/plugin/subminer/session_bindings.lua @@ -159,6 +159,8 @@ function M.create(ctx) return { "--open-youtube-picker" } elseif action_id == "openSessionHelp" then return { "--open-session-help" } + elseif action_id == "openCharacterDictionary" then + return { "--open-character-dictionary" } elseif action_id == "openControllerSelect" then return { "--open-controller-select" } elseif action_id == "openControllerDebug" then diff --git a/scripts/test-plugin-session-bindings.lua b/scripts/test-plugin-session-bindings.lua index 5ca776e3..40552dd5 100644 --- a/scripts/test-plugin-session-bindings.lua +++ b/scripts/test-plugin-session-bindings.lua @@ -79,6 +79,14 @@ local ctx = { actionType = "session-action", actionId = "playNextSubtitle", }, + { + key = { + code = "KeyA", + modifiers = { "alt", "meta" }, + }, + actionType = "session-action", + actionId = "openCharacterDictionary", + }, { key = { code = "KeyL", @@ -153,6 +161,23 @@ local play_next_call = recorded.async_calls[#recorded.async_calls] assert_true(play_next_call ~= nil, "play-next binding should invoke CLI action") assert_true(play_next_call[2] == "--play-next-subtitle", "play-next binding should pass CLI flag") +local character_dictionary = nil +for _, binding in ipairs(recorded.bindings) do + if binding.keys == "Alt+Meta+a" then + character_dictionary = binding + break + end +end +assert_true(character_dictionary ~= nil, "character dictionary binding should be registered") + +character_dictionary.fn() +local character_dictionary_call = recorded.async_calls[#recorded.async_calls] +assert_true(character_dictionary_call ~= nil, "character dictionary binding should invoke CLI action") +assert_true( + character_dictionary_call[2] == "--open-character-dictionary", + "character dictionary binding should pass CLI flag" +) + starter.fn() local modified_digit = nil