From 901b1b543087e6f1471dda743d499fcbbb6fecd0 Mon Sep 17 00:00:00 2001 From: David <97603719+Commodore64user@users.noreply.github.com> Date: Fri, 14 Feb 2025 16:23:34 +0000 Subject: [PATCH] [Hotkeys] override self.ui.fonts key_events (#13257) * Removed [now] unnecessary conditions when removing actions for hotkeys in the `HotKeys:genMenu` function. No longer needed as of #13227 * Added code to reset key events for the overlooked `font` UI component in the `HotKeys:overrideConflictingKeyEvents` function. --- plugins/hotkeys.koplugin/main.lua | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/plugins/hotkeys.koplugin/main.lua b/plugins/hotkeys.koplugin/main.lua index f2f014848..c5b0cd52e 100644 --- a/plugins/hotkeys.koplugin/main.lua +++ b/plugins/hotkeys.koplugin/main.lua @@ -203,11 +203,7 @@ function HotKeys:genMenu(hotkey) self.updated = true touchmenu_instance:updateItems() end - if self.hotkeys[hotkey] and next(self.hotkeys[hotkey]) then - Dispatcher.removeActions(self.hotkeys[hotkey], do_remove) - else -- If no actions are selected, just update the defaults - do_remove() - end + Dispatcher.removeActions(self.hotkeys[hotkey], do_remove) end, }) end @@ -225,11 +221,7 @@ function HotKeys:genMenu(hotkey) self.updated = true touchmenu_instance:updateItems() end - if self.hotkeys[hotkey] and next(self.hotkeys[hotkey]) then - Dispatcher.removeActions(self.hotkeys[hotkey], do_remove) - else - do_remove() - end + Dispatcher.removeActions(self.hotkeys[hotkey], do_remove) end, }) Dispatcher:addSubMenu(self, sub_items, self.hotkeys, hotkey) @@ -429,6 +421,9 @@ function HotKeys:overrideConflictingKeyEvents() self.ui.bookmark.key_events = {} -- reset it. logger.dbg("Hotkey ReaderBookmark:registerKeyEvents() overridden.") + self.ui.font.key_events = {} -- reset it. + logger.dbg("Hotkey ReaderFont:registerKeyEvents() overridden.") + if Device:hasScreenKB() or Device:hasSymKey() then local readerconfig = self.ui.config readerconfig.key_events = {} -- reset it, then add our own