Problem Description
I was trying to debug the problem with non-english keyboards and their shortcuts not working, as e.g. reported here: Wrong shortcut for indentation on German keyboard still not fixed.
I know that the superscript button doesn’t work because on a german keyboard it’s impossible to hit Control+=; it must be Control+Shift+= but that shortcut is already reserved for subscript.
I face a problem though. I thought the logical thing is to assume that if I change the shortcut in ts/editor/editor-toolbar/SuperscriptButton.svelte
, the shortcut should actually change. Here’s an example:
<TextAttributeButton
tagName="sup"
{matcher}
key="superscript"
tooltip={tr.editingSuperscript()}
keyCombination="Control+="
exclusiveNames={["subscript"]}
>
<Icon icon={superscriptIcon} />
</TextAttributeButton>
This above is the superscript button (actual code on master). I swapped the "Control+="
part with "Control+Shift+="
from the subscript button and vice versa. Then I ran ./run
.
The result? Nothing changed. The button behavior isn’t different at all. After trying lots of other things I decided to completely remove everything from SuperscriptButton.svelte
and recompile using ./run
(yes, that means that file was blank). I expected there to be some sort of compilation error, a runtime error or at least the superscript button to be missing / non functional. But that wasn’t the case at all. It’s as if I never even changed / removed anything in the first place.
Why does that happen? I am mostly interessted in being able to change those shortcut keys and read them in a terminal (basically read what anki thinks I pressed, i.e. what key and code).
It probably doesn’t help that I mostly have experience in bash, followed by C and I’m not an expert in either of them…
How I’m running / building Anki
I’m on debian linux, sid in a virtualbox (host is debian oldstable).
I ran the following:
git clone --single-branch --branch=main https://github.com/ankitects/anki.git anki
cd anki/
clear && ./run
source ./out/pyenv/bin/activate
pip install aqt[qt5]
pip install aqt[qt6]
clear && ./run
(I had pip installed qt5 and qt6 already in the past and never used the pyenv in that directory either in the past. I did it this time because anki refused to build otherwise, even though the current stable branch build fine without it. If I’m doing something wrong here, please feel free to point it out!)
Anki Debug Info
Anki 24.11 (87ccd24e) (src) (ao)
Python 3.9.18 Qt 6.8.1 PyQt 6.8.0
Platform: Linux-6.12.6-amd64-x86_64-with-glibc2.40
===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AnkiWebView Inspector ['31746032', 2023-06-27T21:26, 'None', '']
Image Occlusion Enhanced ['1374772155', 2022-04-09T09:15, 'None', '']
Review Heatmap ['1771074083', 2022-06-30T03:43, 'None', '']
Study Time Stats ['1247171202', 2024-02-24T17:59, 'None', '']
===IDs of active AnkiWeb add-ons===
1247171202 1374772155 1771074083 31746032
===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])