Keyboard Shortcut for Indent not working

As a keyboard shortcut to indent (unindent) list items, Anki suggests CTRL+SHIFT+. / CTRL+SHIFT+,
Bildschirmfoto vom 2022-10-22 13-51-01

However, these shortcuts don’t work. All other keyboard shortcuts do work.

Version
Version ⁨2.1.54 (b6a7760c)⁩
Python 3.10.4 Qt 5.15.3 PyQt 5.15.6
OS: Ubuntu 22.04 LTS

Maybe something to do with your keyboard layout? It works for me on a Linux system with the Anki interface language set to German.

I also can’t use the keyboard shortcuts. I tried with .55 qt6 beta2 without any add-ons. Maybe I miss something but it doesn’t work for me in win10 (german keyboard, anki in german) and it even does not work with an english keyboard layout and the anki language set to English in linux-debian11-kde.

I’m in a list and the outdent/indent buttons work as expected on the list.

 

But I also can’t get the superscript or subscript shortcut to work with my German keyboard layout…

 

@kleinerpirat : you have a german keyboard layout I assume. Do I (we) make something obvious wrong here?

1 Like

I’ve also had issues with various editor shortcuts in the past. I think for indent/unindent the suggested one doesn’t work on my machine either, but some other key did the trick (Ctrl+<) maybe?).

I’ll take a look at this once I’m home.


@Rumo how do you fare with Anki shortcuts on a german keyboard?

1 Like

This one is almost working:

  • CTRL+> to indent
  • CTRL+SHIFT+> to unindent

But if I unindent, the cursor is not at the list item any longer…

The shortcut keys do not work with the Japanese keyboard layout either. Taking a quick look at ts/editor, it seems that the indent and outdent shortcut keys are only working when the icons for the block level formatting commands are popping up. You can confirm the behavior with the following code:

diff --git a/ts/components/Shortcut.svelte b/ts/components/Shortcut.svelte
index 0c8e77bfe..78d6be6e1 100644
--- a/ts/components/Shortcut.svelte
+++ b/ts/components/Shortcut.svelte
@@ -13,7 +13,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html

     const dispatch = createEventDispatcher();

-    onMount(() =>
+    onMount(() => {
+        console.log(`${keyCombination} has mounted!`);
         registerShortcut(
             (event: KeyboardEvent) => {
                 preventDefault(event);
@@ -21,6 +22,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
             },
             keyCombination,
             { event },
-        ),
-    );
+        );
+        return () => console.log(`${keyCombination} has destroyed!`);
+    });
 </script>

(I don’t know how to properly fix it.)

3 Likes

I switched to a US keyboard recently (my pinkies love it) and meant to try this on my second machine. But I guess @hkr has figured it out already. :slightly_smiling_face:

Thanks @hkr! I’ve pushed a fix.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.