From 1e679aab90ef3d1fd9c6da181a91c21dbe72c5d5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 10 Nov 2020 18:32:25 +0530 Subject: [PATCH] Viewer: Fix regression causing custom shortcuts with shift key pressed not working. Fixes #1903699 [E-book viewer: some key combinations don't work](https://bugs.launchpad.net/calibre/+bug/1903699) --- src/pyj/read_book/shortcuts.pyj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pyj/read_book/shortcuts.pyj b/src/pyj/read_book/shortcuts.pyj index 3e5d29c5f9..e2ac485be5 100644 --- a/src/pyj/read_book/shortcuts.pyj +++ b/src/pyj/read_book/shortcuts.pyj @@ -35,8 +35,11 @@ def desc(sc, group, short, long): def keyevent_as_shortcut(evt): + key = evt.key + if capital_letters[key] and evt.shiftKey: + key = key.toLowerCase() return { - 'key': evt.key, 'altKey': evt.altKey, 'ctrlKey': evt.ctrlKey, + 'key': key, 'altKey': evt.altKey, 'ctrlKey': evt.ctrlKey, 'metaKey': evt.metaKey, 'shiftKey': evt.shiftKey } @@ -52,7 +55,7 @@ def get_key_text(evt): key = evt.key if key: # on Windows pressing ctrl+alt+ascii char gives capital letters. On all - # platforms shift+key gives capital letters # we define shortcuts using + # platforms shift+key gives capital letters we define shortcuts using # lowercase letters, so lowercase them here. if evt.code and key.toLowerCase() is not key and evt.code.startsWith('Key') and capital_letters[key]: key = key.toLowerCase()